
var JSON={org:'http://www.JSON.org',copyright:'(c)2005 JSON.org',license:'http://www.crockford.com/JSON/license.html',stringify:function stringify(arg){var c,i,l,s='',v;switch(typeof arg){case'object':if(arg){if(arg.constructor==Array){for(i=0;i<arg.length;++i){v=this.stringify(arg[i]);if(s){s+=',';}
s+=v;}
return'['+s+']';}else if(typeof arg.toString!='undefined'){for(i in arg){v=arg[i];if(typeof v!='undefined'&&typeof v!='function'){v=this.stringify(v);if(s){s+=',';}
s+=this.stringify(i)+':'+v;}}
return'{'+s+'}';}}
return'null';case'number':return isFinite(arg)?String(arg):'null';case'string':l=arg.length;s='"';for(i=0;i<l;i+=1){c=arg.charAt(i);if(c>=' '){if(c=='\\'||c=='"'){s+='\\';}
s+=c;}else{switch(c){case'\b':s+='\\b';break;case'\f':s+='\\f';break;case'\n':s+='\\n';break;case'\r':s+='\\r';break;case'\t':s+='\\t';break;default:c=c.charCodeAt();s+='\\u00'+Math.floor(c/16).toString(16)+
(c%16).toString(16);}}}
return s+'"';case'boolean':return String(arg);default:return'null';}},parse:function(text){var at=0;var ch=' ';function error(m){throw{name:'JSONError',message:m,at:at-1,text:text};}
function next(){ch=text.charAt(at);at+=1;return ch;}
function white(){while(ch){if(ch<=' '){next();}else if(ch=='/'){switch(next()){case'/':while(next()&&ch!='\n'&&ch!='\r'){}
break;case'*':next();for(;;){if(ch){if(ch=='*'){if(next()=='/'){next();break;}}else{next();}}else{error("Unterminated comment");}}
break;default:error("Syntax error");}}else{break;}}}
function string(){var i,s='',t,u;if(ch=='"'){outer:while(next()){if(ch=='"'){next();return s;}else if(ch=='\\'){switch(next()){case'b':s+='\b';break;case'f':s+='\f';break;case'n':s+='\n';break;case'r':s+='\r';break;case't':s+='\t';break;case'u':u=0;for(i=0;i<4;i+=1){t=parseInt(next(),16);if(!isFinite(t)){break outer;}
u=u*16+t;}
s+=String.fromCharCode(u);break;default:s+=ch;}}else{s+=ch;}}}
error("Bad string");}
function array(){var a=[];if(ch=='['){next();white();if(ch==']'){next();return a;}
while(ch){a.push(value());white();if(ch==']'){next();return a;}else if(ch!=','){break;}
next();white();}}
error("Bad array");}
function object(){var k,o={};if(ch=='{'){next();white();if(ch=='}'){next();return o;}
while(ch){k=string();white();if(ch!=':'){break;}
next();o[k]=value();white();if(ch=='}'){next();return o;}else if(ch!=','){break;}
next();white();}}
error("Bad object");}
function number(){var n='',v;if(ch=='-'){n='-';next();}
while(ch>='0'&&ch<='9'){n+=ch;next();}
if(ch=='.'){n+='.';while(next()&&ch>='0'&&ch<='9'){n+=ch;}}
v=+n;if(!isFinite(v)){error("Bad number");}else{return v;}}
function word(){switch(ch){case't':if(next()=='r'&&next()=='u'&&next()=='e'){next();return true;}
break;case'f':if(next()=='a'&&next()=='l'&&next()=='s'&&next()=='e'){next();return false;}
break;case'n':if(next()=='u'&&next()=='l'&&next()=='l'){next();return null;}
break;}
error("Syntax error");}
function value(){white();switch(ch){case'{':return object();case'[':return array();case'"':return string();case'-':return number();default:return ch>='0'&&ch<='9'?number():word();}}
return value();}};

var BET={namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval('if (typeof '+rt+' == "undefined"){'+rt+' = {};} o = '+rt+';');for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}},Util:{valuesFromPanel:function(panel){var obj=null;panel.cascade(function(item){if(item.getValue&&item.getName){if(obj==null){obj={};}
obj[item.getName()]=item.getValue();}});return obj;}}};BET.ns=BET.namespace;BET.BLANK_IMAGE_URL='/inc/base/img/s.gif';

function _Util(){}
_Util.prototype.makeBlockAnchor=function(item,method){if(method==null){method='onclick';}
switch(method){case'onclick':var firstAnchor=jQuery(item).find("a").get(0);if(firstAnchor==null||firstAnchor.href==null){return null;}
if(item._doneMakeBlockAnchor!=null){return firstAnchor;}
var href=firstAnchor.href;if(href.length>=11&&href.substring(0,11).toLowerCase()=="javascript:"){href=href.substring(11,href.length);eval("item.onclick = function(){ "+href+"; };");}else{item.onclick=function(){document.location=firstAnchor.href;};}
item._doneMakeBlockAnchor=true;return firstAnchor;case'wrap':return this.makeBlockAnchorWithAnchorWrap(item);case'overlay':return this.makeBlockAnchorWithOverlay(item,true);}}
_Util.prototype.makeBlockAnchorWithAnchorWrap=function(item){var firstAnchor=jQuery(item).find("a").get(0);if(firstAnchor==null||firstAnchor.href==null){return null;}
if(item._doneMakeBlockAnchor!=null){return firstAnchor;}
jQuery(item).wrap('<a href="'+firstAnchor.href+'" style="display:block;"></a>');item._doneMakeBlockAnchor=true;return firstAnchor;}
_Util.prototype.makeBlockAnchorWithOverlay=function(item,isDL){var firstAnchor=jQuery(item).find("a").get(0);if(firstAnchor==null||firstAnchor.href==null){return null;}
if(item._doneMakeBlockAnchor!=null){return firstAnchor;}
var includeTooltips=false;var altText;if(includeTooltips){var firstSpan=jQuery(item).find('span:first').get(0);if(firstSpan){altText=firstSpan.innerHTML;}else{altText='BET';}}
if(isDL){item=jQuery(item).find('dd:first').get(0);if(item==null){return;}}
var width=jQuery(item).width();var height=jQuery(item).height();if(includeTooltips){jQuery(item).append('<a href="'+firstAnchor.href+'" style="display:block;width:'+width+'px;height:'+height+'px;position:absolute;top:0px;left:0px;" class="anchorOverlay"><img src="'+BET.BLANK_IMAGE_URL+'" width="'+width+'" height="'+height+'" alt="" title="'+altText+'" /></a>');}else{jQuery(item).append('<a href="'+firstAnchor.href+'" style="display:block;width:'+width+'px;height:'+height+'px;position:absolute;top:0px;left:0px;" class="anchorOverlay"><img src="'+BET.BLANK_IMAGE_URL+'" width="'+width+'" height="'+height+'" /></a>');}
item._doneMakeBlockAnchor=true;return firstAnchor;}
_Util.prototype.getRandom=function(){return(Math.random()+"")*1000000000000000000;}
_Util.prototype.concatUrls=function(url1,url2){if(this.stringEndsWith(url1,"/")){url1=url1.substr(0,url1.length-1);}a
if(!this.stringBeginsWith(url2,"/")){url2="/"+url2;}
return url1+url2;}
_Util.prototype.stringBeginsWith=function(text,partial){if(text==null||partial==null||text==""||partial==""){return false;}
if(text.length<partial.length){return false;}
return(text.substr(0,partial.length)==partial);}
_Util.prototype.stringEndsWith=function(text,partial){if(text==null||partial==null||text==""||partial==""){return false;}
if(text.length<partial.length){return false;}
return(text.substr(text.length-partial.length,text.length)==partial);}
_Util.prototype.getElementPosition=function(element){if(element==null)return null;var result=new Object();result.x=0;result.y=0;result.width=0;result.height=0;if(element.offsetParent){result.x=element.offsetLeft;result.y=element.offsetTop;var parent=element.offsetParent;while(parent){result.x+=parent.offsetLeft;result.y+=parent.offsetTop;var parentTagName=parent.tagName.toLowerCase();if(parentTagName!="table"&&parentTagName!="body"&&parentTagName!="html"&&parentTagName!="div"&&parent.clientTop&&parent.clientLeft){result.x+=parent.clientLeft;result.y+=parent.clientTop;}
parent=parent.offsetParent;}}
else if(element.left&&element.top){result.x=element.left;result.y=element.top;}
else{if(element.x){result.x=element.x;}
if(element.y){result.y=element.y;}}
if(element.offsetWidth&&element.offsetHeight){result.width=element.offsetWidth;result.height=element.offsetHeight;}
else if(element.style&&element.style.pixelWidth&&element.style.pixelHeight){result.width=element.style.pixelWidth;result.height=element.style.pixelHeight;}
return result;}
_Util.prototype.setElementHeight=function(element,height){if(element&&element.style){element.style.height=height+"px";}}
_Util.prototype.setElementWidth=function(element,width){if(element&&element.style){element.style.width=width+"px";}}
_Util.prototype.setElementX=function(element,x){if(element&&element.style){element.style.left=x+"px";}}
_Util.prototype.setElementY=function(element,y){if(element&&element.style){element.style.top=y+"px";}}
_Util.prototype.getIsIntEng=function(){var language=navigator.userLanguage;if(language==null){return false;}
language=language.toLowerCase();if(language=="en-au"){return true;}
if(language=="en-gb"){return true;}
if(language=="en-ie"){return true;}
return false;}
_Util.prototype.trim=function(stringToTrim){return stringToTrim.replace(/^\s+|\s+$/g,"");}
_Util.prototype.ltrim=function(stringToTrim){return stringToTrim.replace(/^\s+/,"");}
_Util.prototype.rtrim=function(stringToTrim){return stringToTrim.replace(/\s+$/,"");}
var Util=new _Util();

BET.ns('bet.drawing');bet.drawing.Point=function(x,y){this.x=x;this.y=y;}

BET.ns('bet.drawing');bet.drawing.Size=function(width,height){this.width=width;this.height=height;}
bet.drawing.Size.prototype.constrainSize=function(constrainSize,allowStretch){if(allowStretch==null){allowStretch=true;}
var newWidth;var newHeight;if(this.width<constrainSize.width&&this.height<constrainSize.height&&!allowStretch){newWidth=this.width;newHeight=this.height;}else{var scaleX=this.width/constrainSize.width;var scaleY=this.height/constrainSize.height;var scale=(scaleX>scaleY?scaleX:scaleY);newWidth=this.width/scale;newHeight=this.height/scale;}
newWidth=parseInt(Math.round(newWidth),10);newHeight=parseInt(Math.round(newHeight),10);return new bet.drawing.Size(newWidth,newHeight);}
bet.drawing.Size.prototype.equals=function(size){return this.width==size.width&&this.height==size.height;}
bet.drawing.Size.prototype.proportionalTo=function(size){if(size.width==0||size.height==0||this.width==0||this.height==0){return this.equals(size);}else{return(this.width/size.width)==(this.height/size.height);}}

BET.ns('bet.drawing');bet.drawing.Rectangle=function(x,y,width,height){this.x=x;this.y=y;this.width=width;this.height=height;this.size=null;}
bet.drawing.Rectangle.getSize=function(){if(this.size==null){this.size=new bet.drawing.Size(this.width,this.height);}else{this.size.width=this.width;this.size.height=this.height;}
return this.size;}
bet.drawing.Rectangle.prototype.equals=function(rect){return this.x==rect.x&&this.y==rect.y&&this.width==rect.width&&this.height==rect.height;}
bet.drawing.Rectangle.prototype.proportionalTo=function(rect){return this.getSize().proportionalTo(rect.getSize());}
bet.drawing.Rectangle.prototype.getWrappingRectangle=function(size){var scaleX=size.width/this.width;var scaleY=size.height/this.height;var scale=(scaleX<scaleY?scaleX:scaleY);var newWidth=parseInt(Math.round(size.width/scale),10);var newHeight=parseInt(Math.round(size.height/scale),10);var newRect=new bet.drawing.Rectangle(0,0,newWidth,newHeight);this.centerRectangle(newRect);return newRect;}
bet.drawing.Rectangle.prototype.centerRectangle=function(rect){rect.x=this.x+parseInt(Math.round((this.width-rect.width)/2),10);rect.y=this.y+parseInt(Math.round((this.height-rect.height)/2),10);}

function FlashWModeEnum(){this.Window="window";this.Opaque="opaque";this.Transparent="transparent";}
var FlashWMode=new FlashWModeEnum();

function FlashAllowScriptAccessEnum(){this.Always="always";this.Never="never";this.SameDomain="sameDomain";}
var FlashAllowScriptAccess=new FlashAllowScriptAccessEnum();

function AdTypeEnum(){this.HeaderAd=1;this.PageAd=2;this.FooterAd=3;this.LeftNavSponsorAd=4;this.CoAd=5;}
var AdType=new AdTypeEnum();

function DateMap(){this.items=new Array();this.needsFix=false;}
DateMap.prototype.addMapBegin=function(mappedValue,year,month,day,hour,minute,second){var dateBegin=(year==null)?null:new Date(year,month,day,hour,minute,second,0);var item=new DateMapItem(dateBegin,null,mappedValue);this.items[this.items.length]=item;this.needsFix=true;return item;}
DateMap.prototype.fixItems=function(){this.items.sort(this.sortFunc);for(var index=0;index<this.items.length;index++){var item=this.items[index];if(index>0){var prevItem=this.items[index-1];if(prevItem.endDate==null||prev.endDate>item.beginDate){prevItem.endDate=new Date();prevItem.endDate.setTime(item.beginDate.getTime()-1);}}}
this.needsFix=false;}
DateMap.prototype.sortFunc=function(item1,item2){if(item1.beginDate==item2.beginDate){return 0;}
if(item1.beginDate==null){return-1;}
if(item2.beginDate==null){return 1;}
if(item1.beginDate<item2.beginDate){return-1;}
return 1;}
DateMap.prototype.getValue=function(date){if(this.needsFix){this.fixItems();}
for(var index=0;index<this.items.length;index++){var item=this.items[index];if((item.beginDate==null||item.beginDate<=date)&&(item.endDate==null||date<=item.endDate)){return item.mappedValue;}}
return null;}
function DateMapItem(beginDate,endDate,mappedValue){this.beginDate=beginDate;this.endDate=endDate;this.mappedValue=mappedValue;}
DateMapItem.prototype.setEndDate=function(year,month,day,hour,minute,second){this.endDate=new Date(year,month,day,hour,minute,second);if(this.endDate<this.beginDate){this.endDate=this.beginDate;}}

function _XmlTools(){}
_XmlTools.prototype.getXmlObject=function(xmlString){var xmlObject=null;if(window.ActiveXObject){xmlObject=new ActiveXObject("Microsoft.XMLDOM");xmlObject.async=false;xmlObject.loadXML(xmlString);}else if(window.XMLHttpRequest){xmlObject=(new DOMParser()).parseFromString(xmlString,"text/xml");}
return xmlObject;}
_XmlTools.prototype.getTagInnerValue=function(element,tagName,defaultValue){if(defaultValue==null){defaultValue="";}
var subElements=element.getElementsByTagName(tagName);if(!subElements||subElements.length==0){return defaultValue;}
if(subElements[0].firstChild==null){return defaultValue;}
return subElements[0].firstChild.nodeValue;}
_XmlTools.prototype.getFirstElement=function(element,tagName){var elements=element.getElementsByTagName(tagName);if(!elements||elements.length==0){return null;}
return elements[0];}
var XmlTools=new _XmlTools();

if(window.CommentController==null){var clone=function(obj){if(obj==null)
return obj;var copy={};for(var attr in obj)
copy[attr]=obj[attr];return copy;};var override=function(obj,ovr,deep){if(ovr==null)
return obj;var copy=clone(obj);for(var attr in ovr){if(typeof(obj[attr]!='undefined')){if((typeof(obj[attr])=='object')&&deep){copy[attr]=override(obj[attr],ovr[attr],deep);}
else{copy[attr]=ovr[attr];}}}
return copy;};window.CommentPager=function(config){var _private={settings:{pageSize:10,currentPage:0,hideClass:'hidden',showClass:'visible',firstClass:'first',lastClass:'last',nextHtml:'<span>Next</span>',prevHtml:'<span>Previous</span>',navigation:'both'},showPage:function(){var firstItem=_private.settings.currentPage*_private.settings.pageSize;var lastItem=firstItem+_private.settings.pageSize;if(lastItem>_private.commentList.length)
lastItem=_private.commentList.length;if(_private.currentItems!=null)
jQuery.each(_private.currentItems,_private.hideItem);_private.currentItems=_private.commentList.slice(firstItem,lastItem);jQuery.each(_private.currentItems,_private.showItem);},nextPage:function(){var next=_private.settings.currentPage+1;if(next>_private.lastPage)
next=_private.lastPage;_private.settings.currentPage=next;_private.showNavigation();_private.showPage();return false;},prevPage:function(){var prev=_private.settings.currentPage-1;if(prev<_private.firstPage)
prev=_private.firstPage;_private.settings.currentPage=prev;_private.showNavigation();_private.showPage();return false;},showItem:function(index,item){jQuery(item).removeClass(_private.settings.hideClass);jQuery(item).removeClass(_private.settings.firstClass);jQuery(item).removeClass(_private.settings.lastClass);jQuery(item).addClass(_private.settings.showClass);if(index==0)
jQuery(item).addClass(_private.settings.firstClass);if(index==(_private.settings.pageSize-1))
jQuery(item).addClass(_private.settings.lastClass);},hideItem:function(index,item){jQuery(item).removeClass(_private.settings.hideClass);jQuery(item).removeClass(_private.settings.firstClass);jQuery(item).removeClass(_private.settings.lastClass);jQuery(item).removeClass(_private.settings.showClass);},initNavigation:function(){if((_private.topNav==null)&&((_private.settings.navigation=='both')||(_private.settings.navigation=='top'))){jQuery(_private.commentControl).find('dd:first a:first').after('<dl class="navigation top"><dt>Comment Navigation</dt><dd><div class="navLinks"><a class="prevLink" href="#"></a><a class="nextLink" href="#"></a></div><div class="clearFloats"></div></dd></dl>');_private.topNav=jQuery(_private.commentControl).find('.navigation.top');_private.buildNavigation(_private.topNav);}
if((_private.bottomNav==null)&&((_private.settings.navigation=='both')||(_private.settings.navigation=='bottom'))){jQuery(_private.commentControl).find('dd:first').append('<dl class="navigation bottom"><dt>Comment Navigation</dt><dd><div class="navLinks"><a class="prevLink" href="#"></a><a class="nextLink" href="#"></a></div><div class="clearFloats"></div></dd></dl>');_private.bottomNav=jQuery(_private.commentControl).find('.navigation.bottom');_private.buildNavigation(_private.bottomNav);}
_private.showNavigation();},buildNavigation:function(nav){jQuery(nav).find('a.prevLink').html(_private.settings.prevHtml);jQuery(nav).find('a.nextLink').html(_private.settings.nextHtml);jQuery(nav).find('a.prevLink').click(_private.prevPage);jQuery(nav).find('a.nextLink').click(_private.nextPage);},showNavigation:function(){if(_private.settings.currentPage==_private.firstPage){jQuery(_private.commentControl).find('.navigation a.prevLink').addClass(_private.settings.hideClass);if(_private.lastPage!=_private.firstPage)
jQuery(_private.commentControl).find('.navigation a.nextLink').removeClass(_private.settings.hideClass);else
jQuery(_private.commentControl).find('.navigation a.nextLink').addClass(_private.settings.hideClass);}
else if(_private.settings.currentPage==_private.lastPage){jQuery(_private.commentControl).find('.navigation a.nextLink').addClass(_private.settings.hideClass);jQuery(_private.commentControl).find('.navigation a.prevLink').removeClass(_private.settings.hideClass);}
else{jQuery(_private.commentControl).find('.navigation a.prevLink').removeClass(_private.settings.hideClass);jQuery(_private.commentControl).find('.navigation a.nextLink').removeClass(_private.settings.hideClass);}},commentControl:null,commentList:null,currentItems:null,lastPage:0,firstPage:0,topNav:null,bottomNav:null};_private.settings=override(_private.settings,config);return{initialize:function(control,args){_private.settings=override(_private.settings,args);_private.commentControl=control;_private.commentList=jQuery(control).find('dl.comment');_private.lastPage=Math.floor(_private.commentList.length/_private.settings.pageSize)+((_private.commentList.length%_private.settings.pageSize)>0?0:-1);_private.initNavigation();_private.showPage();}};};window.CommentController=function(config){var _private={settings:{pager:{pageSize:10,currentPage:0,hideClass:'hidden',showClass:'visible',firstClass:'first',lastClass:'last',nextHtml:'<span>Next</span>',prevHtml:'<span>Previous</span>',navigation:'both'},enablePaging:true}};_private.settings=override(_private.settings,config,true);return{initialize:function(){jQuery('.commentList').each(function(index,item){if(_private.settings.enablePaging){var pager=new CommentPager(_private.settings.pager);pager.initialize(item);}});}};};}

function SimplePopupSurvey(surveyKey,url,probability,width,height){this._surveyKey=surveyKey;this._url=url;this._probability=probability;this._width=width;this._height=height;this._isSeen=false;this.maxChanceCount=-1;this.maxDisplayCount=-1;}
SimplePopupSurvey.prototype.activate=function(){var chanceCountCookieKey=this._surveyKey+"_ChanceCount";var chanceCount=this.intFromCookie(chanceCountCookieKey);if(this.maxChanceCount>0&&chanceCount>=this.maxChanceCount)return;var date=new Date();var seconds=date.getSeconds();var showSurvey=this.isHit(seconds,this._probability);chanceCount++;this.setCookie(chanceCountCookieKey,chanceCount,false);if(showSurvey){var displayCountCookieKey=this._surveyKey+"_DisplayCount";var displayCount=this.intFromCookie(displayCountCookieKey);if(this.maxDisplayCount>0&&displayCount>=this.maxDisplayCount)return;window.open(this._url,"surveyWindow","resizable=1,status=1,toolbar=1,width="+this._width+",height="+this._height);displayCount++;this.setCookie(displayCountCookieKey,displayCount,false);}}
SimplePopupSurvey.prototype.setCookie=function(key,value,isTemp,path,domain,secure){var cookieString=key+"="+escape(value);if(!isTemp){var expires=new Date(2060,1,1);cookieString+="; expires="+expires.toGMTString();}
if(path){cookieString+="; path="+escape(path);}
if(domain){cookieString+="; domain="+escape(domain);}
if(secure){cookieString+="; secure";}
document.cookie=cookieString;}
SimplePopupSurvey.prototype.deleteCookie=function(key){var cookieDate=new Date();cookieDate.setTime(cookieDate.getTime()-1);document.cookie=key+="=; expires="+cookieDate.toGMTString();}
SimplePopupSurvey.prototype.getCookie=function(key){var results=document.cookie.match(key+'=(.*?)(;|$)');if(results){return(unescape(results[1]));}else{return null;}}
SimplePopupSurvey.prototype.intFromCookie=function(key,defaultValue){if(defaultValue==null){defaultValue=0;}
var value=this.getCookie(key);if(value==null){return defaultValue;}
value=parseInt(value,10);return value;}
SimplePopupSurvey.prototype.isHit=function(num,probability){if(probability>=1)return true;if(probability<=0)return false;var useInverse=(probability>0.5);if(useInverse){probability=1/probability;}
var isHit=Math.round(num%(1/probability)*1000)/1000==0;if(useInverse)return!isHit;return isHit;}

BET.ns('bet.web');bet.web.ImageManager=function(){this.imageList=new Array();this.imageLookup=new Object();}
bet.web.ImageManager.prototype.append=function(data){if(data==null||data.images==null||data.images.length<1){return;}
for(var i=0;i<data.images.length;i++){var image=data.images[i];image.width=image.w;image.height=image.h;this.imageList.push(image);this.imageLookup[image.id]=image;}
this.indexes=data.indexes;}
bet.web.ImageManager.prototype.getImageByElementID=function(elementID){var image=this.imageLookup[elementID];if(typeof(image)=='undefined'){image=null;}
return image;}
bet.web.ImageManager.prototype.findIndexedImages=function(indexKey){var list=new Array();if(this.indexes==null){return list;}
var index=this.indexes[indexKey];if(index==null){return list;}
for(var i=0;i<index.length;i++){list.push(this.imageList[index[i]]);}
return list;}
bet.web.ImageManager.prototype.constrainIndexedImages=function(indexKey,width,height,allowStretch){if(width==null||width<1||height==null||height<1){return;}
var images=this.findIndexedImages(indexKey);if(images==null||images.length==0){return;}
var style='';var constrainRect=new bet.drawing.Rectangle(0,0,width,height);for(var i=0;i<images.length;i++){var img=images[i];if(img.width&&img.height&&img.width>0&&img.height>0){if(img.ct){var oldSize=new bet.drawing.Size(img.width,img.height);var newRect=constrainRect.getWrappingRectangle(oldSize);if(newRect.width>width||newRect.height>height){style+='#'+img.ct+' { position: relative !important; display: block !important; overflow: hidden !important; width: '+width+'px !important; height: '+height+'px !important; }\n';style+='#'+img.id+' { position: absolute !important; display: block !important; left: '+newRect.x+'px !important; top: '+newRect.y+'px !important; width: '+newRect.width+'px !important; height: '+newRect.height+'px !important; }\n';}}}}
if(style!=''){style='<style type="text/css" media="all">\n'+style+'</style>\n';document.write(style);}}

BET.ns('bet.web');bet.web.PageController=function(){this._idCounter=-1;this.isEditMode=false;this.searchUrlFormat='/WebApplications/BetSearch/Search.aspx?searchType=bet&c=all&searchQuery={0}';this.enableAds=true;this.enableAdsPlaceholder=true;this.enableOmniture=true;this.enableFlash=true;this.enableFlashPlaceholder=true;this.s=null;this.baseDartTarget=null;this.useInterstitial=true;this.imageManager=new bet.web.ImageManager();this.currentDateKey=null;this.onInitialize=null;this.coAd=false;this.coAdServeCount=-1;}
bet.web.PageController.prototype.onLoad=function(){if(this.enableOmniture){this.callOmnitureForPage();}
this.setupLoginMenu();this.setupMenus();this.setupSearch();}
bet.web.PageController.prototype.initialize=function(rootUrl){if(rootUrl==null||rootUrl=="/"){rootUrl="";}
this.rootUrl=rootUrl;var me=this;$(document).ready(function(){me.onLoad();});if(this.onInitialize){this.onInitialize();}}
bet.web.PageController.prototype.writeJavaScriptInclude=function(url,appendRootUrl){if(url==null||url==""){return;}
if(appendRootUrl){url=Util.concatUrls(this.rootUrl,url);}
document.write("<script type=\"text/javascript\" src=\""+url+"\"></script>");}
bet.web.PageController.prototype.writeCssInclude=function(url,appendRootUrl){if(url==null||url==""){return;}
if(appendRootUrl){url=Util.concatUrls(this.rootUrl,url);}
document.write("<link type=\"text/css\" rel=\"stylesheet\" href=\""+url+"\" media=\"all\" />");}
bet.web.PageController.prototype.setDartValues=function(categoryKey,subCategoryKey,pageName){this.baseDartTarget=categoryKey+";sub="+subCategoryKey+";n="+pageName;}
bet.web.PageController.prototype.setBaseDartTarget=function(baseDartTarget){this.baseDartTarget=baseDartTarget;}
bet.web.PageController.prototype.setOmnitureValues=function(config,channel,prop3,prop4,pageName){if(typeof(config)=='object'){this.omniServer=config.server;this.omniChannel=config.channel;this.omniProp3=config.prop3;this.omniProp4=config.prop4;this.omniPageName=config.pageName;}else{this.omniServer=config;this.omniChannel=channel;this.omniProp3=prop3;this.omniProp4=prop4;this.omniPageName=pageName;}}
bet.web.PageController.prototype.setOriginServeDate=function(year,month,day,hour,minute,second){this.originServeDate=new Date(year,month,day,hour,minute,second,0);}
bet.web.PageController.prototype.callOmnitureForPage=function(){this.callOmniture(this.omniServer,this.omniChannel,this.omniPageName,this.omniProp3,this.omniProp4,null,null);}
bet.web.PageController.prototype.callOmnitureForVideoPlay=function(channelKey,subsectionKey,showKey,episodeKey,segmentKey){if(channelKey==null||subsectionKey==null||showKey==null||episodeKey==null||segmentKey==null){return;}
this.callOmniture(this.omniServer,channelKey,segmentKey,subsectionKey,null,showKey,episodeKey);}
bet.web.PageController.prototype.callOmniture=function(server,channel,pageName,prop3,prop4,prop5,prop6){if(!window.s){return;}
if(!this.enableOmniture){return;}
s.server=server;s.channel=channel;s.pageName=pageName;s.prop3=prop3;s.prop4=prop4;if(prop5){s.prop5=prop5;}
if(prop6){s.prop6=prop6;}
var myJSONUser=this.readCookie("cm_JSONUser");if(myJSONUser!=null){var parseJSONUser=JSON.parse(myJSONUser);s.prop1=parseJSONUser.uid;s.prop2="Logged In";s.prop7=parseJSONUser.age;s.prop8=parseJSONUser.gender;s.prop9=parseJSONUser.state;s.prop10=parseJSONUser.zip;s.prop11=parseJSONUser.rdate;}else{s.prop1="";s.prop2="Not Logged In";}
s.events="";s.eVar1=s.prop1;s.eVar2=s.prop2;if(location.search.indexOf('format=print')!=-1){s.events='event11';var slashindex=location.pathname.lastIndexOf("/");s.eVar12='article:'+location.pathname.substr(slashindex+1);}
var s_code=s.t();}
bet.web.PageController.prototype.getPlaceholderHtml=function(width,height){return"<div style=\"width:"+width+"px;height:"+height+"px;background:#CCCCCC;\"></div>";}
bet.web.PageController.prototype.writeAdHtml=function(adType){document.write(this.getAdHtml(adType));}
bet.web.PageController.prototype.getAdHtml=function(adType){var width,height;switch(adType){case AdType.HeaderAd:width=728;height=90;break;case AdType.PageAd:width=300;height=250;break;case AdType.FooterAd:width=728;height=90;break;case AdType.LeftNavSponsorAd:width=135;height=35;break;case AdType.CoAd:width=300;height=250;this.coAd=true;break;case AdType.SkyscraperAd:width=160;height=600;break;default:return"";}
if(!this.enableAds){return this.enableAdsPlaceholder?this.getPlaceholderHtml(width,height):"";}
if(adType==5)
{return this.handleCoAd(width,height,this.getNextTile());}
return this.getAdScriptInclude(width,height,this.getNextTile());}
bet.web.PageController.prototype.handleCoAd=function(width,height,tile){var p=jQuery("#pageAdDiv2 dl dd");p.append('<div style="background:#D7D5D6;height:250px;width:300px;overflow:hidden;"></div>');p.append('<div class="clearFloats"></div>');}
bet.web.PageController.prototype.reloadCoAd=function(width,height,tile){var p=jQuery("#pageAdDiv2 dl dd");var adS=this.baseDartTarget;adS+='mid='+this.getNextCoAdSlot()+";";var ord=this.getDartOrd();var adString='<nolayer>';adString+='<iframe id="adi_01" src="http://ad.doubleclick.net/adi/www.bet.com/'+adS+'sz='+width+'x'+height+';tile='+tile+';ord='+ord+'?" width="'+width+'" height="'+height+'" frameborder="0" border="0" marginwidth="0" marginheight="0" align="left" scrolling="no" style="height: '+height+'; width: '+width+'>';adString+='</iframe>';adString+='</nolayer>';adString+='<ilayer id="ad_01" visibility="hidden" width='+width+' height='+height+'></ilayer>';p.html(adString);p.append('<div class="clearFloats"></div>');}
bet.web.PageController.prototype.getNextTile=function(){if(this.currentTile==null){this.currentTile=0;}
this.currentTile++;return this.currentTile;}
bet.web.PageController.prototype.getNextCoAdSlot=function(){if(this.coAdServeCount==null){this.coAdServeCount=-1;}
this.coAdServeCount++;return this.coAdServeCount;}
bet.web.PageController.prototype.writeFlashHtml=function(width,height,file,version,id,wmode,vars,loop,appendDartTarget,allowScriptAccess){var html=this.getFlashHtml(width,height,file,version,id,wmode,vars,loop,appendDartTarget,allowScriptAccess);document.write(html);}
bet.web.PageController.prototype.getFlashHtml=function(width,height,file,version,id,wmode,vars,loop,appendDartTarget,allowScriptAccess){if(!this.enableFlash){return this.enableFlashPlaceholder?this.getPlaceholderHtml(width,height):"";}
if(file==null||file==""){return"";}
var qs=(file.indexOf("?")>-1)?"&":"?";var d=new Date();file=file+qs;switch(version){case 7:minorVersion=19;break;case 6:minorVersion=79;break;case 5:minorVersion=30;break;default:minorVersion=0;}
if(appendDartTarget){file+="&dartString="+this.dartTarget;}
if(this.currentDateKey){file+="&currDateKey="+this.currentDateKey;}
var html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+',0,'+minorVersion+',0"';html+=' width="'+width+'" height="'+height+'" id="'+id+'" align="">';html+='<param name="movie" value="'+file+'"/><param name="loop" value="'+loop+'"/><param name="quality" value="high"/><param name="wmode" value="'+wmode+'"/>';html+='<param name="FlashVars" value="'+vars+'">';if(allowScriptAccess!=null){html+='<param name="allowScriptAccess" value="'+allowScriptAccess+'">';}
html+='<embed src="'+file+'" loop="'+loop+'" quality="high" wmode="'+wmode+'" width="'+width+'" height="'+height+'" name="'+id+'" flashVars="'+vars+'" align=""';if(allowScriptAccess!=null){html+=' allowScriptAccess="'+allowScriptAccess+'"';}
html+=' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';return html;}
bet.web.PageController.prototype.getDartOrd=function(){if(this.dartOrd==null){this.dartOrd=Util.getRandom();}
return this.dartOrd;}
bet.web.PageController.prototype.getAdScriptInclude=function(width,height,tile){var ord=this.getDartOrd();var adS="www.bet.com/"+this.baseDartTarget;if(this.baseDartTarget.indexOf("serve=false")!=-1){return;}
if(this.useInterstitial&&tile==1){adS+="dcopt=ist;";}
adS+="sz="+width+"x"+height+";tile="+tile+";ord="+ord+"?";var output='<script type="text/javascript" src="http://ad.doubleclick.net/adj/'+adS+'" ></script>';if((!document.images&&navigator.userAgent.indexOf("Mozilla/2.")>=0)||navigator.userAgent.indexOf("WebTV")>=0){output+='<a href="http://ad.doubleclick.net/jump/'+adS+'" target="_blank">';output+='<img src="http://ad.doubleclick.net/ad/'+adS+'" width="'+width+'" height="'+height+'" border="0" alt="" /></a>';}
return output;}
bet.web.PageController.prototype.addBlockHover=function(selector,hoverCssClass){jQuery(selector).hover(function(){jQuery(this).addClass(hoverCssClass);},function(){jQuery(this).removeClass(hoverCssClass);});}
bet.web.PageController.prototype.makeBlockAnchors=function(selector,hoverCssClass,method){if(hoverCssClass){this.addBlockHover(selector,hoverCssClass);}
jQuery(selector).each(function(index,item){Util.makeBlockAnchor(item,method);});}
bet.web.PageController.prototype.makeBlockAnchorsWithOverlays=function(selector,hoverCssClass){if(hoverCssClass){this.addBlockHover(selector,hoverCssClass);}
jQuery(selector).each(function(index,item){var anchor=Util.makeBlockAnchor(item);if(anchor){var buttonText=anchor.innerHTML;jQuery(item).append("<div class=\"overlay\"><div class=\"overlayBG\"></div><div class=\"overlayButton\"><div class=\"overlayButtonLeft\"></div><div class=\"overlayButtonMiddle\"><span>"+buttonText+"</span></div><div class=\"overlayButtonRight\"></div></div></div>");}});}
bet.web.PageController.prototype.createCookie=function(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}
document.cookie=name+"="+value+expires+"; path=/";}
bet.web.PageController.prototype.readCookie=function(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length);}}
return null;}
bet.web.PageController.prototype.killCookie=function(name){this.createCookie(name,"",-1);}
bet.web.PageController.prototype.cookieCheck=function(){var cookieName="BET_Test_Cookie";var cookieValue="A Test";this.createCookie(cookieName,cookieValue);var cookieSuccess=(this.readCookie(cookieName)==cookieValue);this.killCookie(cookieName);return cookieSuccess;}
bet.web.PageController.prototype.setupMenus=function(){var me=this;var utilityNavigationDiv=document.getElementById("utilityNavigation");var divPos=Util.getElementPosition(utilityNavigationDiv);jQuery("#utilityNavigation > dd > ul > li.hasChildren").each(function(index,item){var subMenu=jQuery(item).find("dl").get();if(subMenu!=null){var itemPos=Util.getElementPosition(item);var x=itemPos.x-divPos.x;var y=itemPos.y+itemPos.height-divPos.y;var newID=me.getNextID();var html="<div id=\""+newID+"\" class=\"utilDropMenu\" style=\"left:"+x+"px;top:"+y+"px;\">"+item.innerHTML+"</div>";jQuery("#pageDiv2").append(html);var newSubMenu=document.getElementById(newID);item._subMenu=newSubMenu;newSubMenu._parent=item;item._pageController=this;jQuery(item).hover(function(){me.showSubMenu(item);},function(){me.hideSubMenu(item);});jQuery(newSubMenu).hover(function(){me.showSubMenu(item);},function(){me.hideSubMenu(item);});}});}
bet.web.PageController.prototype.undoSetupMenus=function(){var me=this;jQuery("#utilityNavigation > dd > ul > li.hasChildren").each(function(index,item){if(item._subMenu!=null){var subMenu=jQuery(item).find("dl").get();if(subMenu!=null){jQuery(item._subMenu).remove();item._subMenu=null;}}});}
bet.web.PageController.prototype.getNextID=function(){this._idCounter++;return"_i"+this._idCounter;}
bet.web.PageController.prototype.showSubMenu=function(item){if(item._subMenu==null){return;}
if(this._menuExpanded!=null&&this._menuExpanded!=item){this.hideSubMenuNow();}
this._menuExpanded=item;item._isCollapsing=false;jQuery(item).addClass("expanded");jQuery(item._subMenu).addClass("expanded");}
bet.web.PageController.prototype.hideSubMenu=function(item){if(item._subMenu==null){return;}
if(this._menuExpanded!=item){return;}
item._isCollapsing=true;if(this._hideSubMenuTimeout!=null){clearTimeout(this._hideSubMenuTimeout);this._hideSubMenuTimeout=null;}
this._hideSubMenuTimeout=setTimeout("PC.hideSubMenuNow();",50);}
bet.web.PageController.prototype.hideSubMenuNow=function(){if(this._menuExpanded!=null&&this._menuExpanded._isCollapsing){jQuery(this._menuExpanded).removeClass("expanded");jQuery(this._menuExpanded._subMenu).removeClass("expanded");this._menuExpanded._isCollapsing=false;this._menuExpanded=null;}}
bet.web.PageController.prototype.setupSearch=function(){if(this.searchUrlFormat==null||this.searchUrlFormat==""){return;}
var searchButton=document.getElementById("searchButton");if(searchButton==null){return;}
jQuery(searchButton).replaceWith("<input id=\"searchButton\" type=\"button\" value=\"Go\" />");searchButton=document.getElementById("searchButton");if(searchButton==null){return;}
var me=this;searchButton.onclick=function(){me.onClickSearch();};}
bet.web.PageController.prototype.onClickSearch=function(){this.doSearch();}
bet.web.PageController.prototype.doSearch=function(){var textBox=document.getElementById("searchQuery");var text=textBox.value;if(text==""){return;}
text=text.replace(" ","%20");var url=this.searchUrlFormat.replace("{0}",text);document.location=url;}
bet.web.PageController.prototype.setupLoginMenu=function(){var isLoggedIn=this.getIsLoggedIn();if(isLoggedIn){$('#utilityNavigation .register').css('display','none');$('#utilityNavigation .login').css('display','none');$('#utilityNavigation .updateProfile').css('display','block');$('#utilityNavigation .logout').css('display','block');}else{$('#utilityNavigation .register').css('display','block');$('#utilityNavigation .login').css('display','block');$('#utilityNavigation .updateProfile').css('display','none');$('#utilityNavigation .logout').css('display','none');}}
bet.web.PageController.prototype.setupContent=function(){jQuery("dl.socialMenu ul li a").each(function(index,item){var parent=item.parentNode;parent._anchor=item;parent.onclick=function(){this._anchor.click();};});jQuery("div.articleDiv dl.socialMenu .diggLink span").replaceWith("<img src=\"/WebApplications/betRoot/includes/base/img/soc_digg.gif\" title=\"Digg\" />");jQuery("div.articleDiv dl.socialMenu .deliciousLink span").replaceWith("<img src=\"/WebApplications/betRoot/includes/base/img/soc_delicious.gif\" title=\"Del.icio.us\" />");}
bet.web.PageController.prototype.popupWindow=function(url,width,height,id,scrollbars,locationbar,toolbar,statusbar,menubar,resizable,xPosition,yPosition){if(width==null||width<1){width=300;}
if(height==null||height<1){height=300;}
if(id==null){id="_popup";}
if(xPosition==null||xPosition<0){xPosition=50;}
if(yPosition==null||yPosition<0){yPosition=50;}
var parms="width="+width;parms+=",height="+height;parms+=",scrollbars="+(scrollbars?"1":"0");parms+=",location="+(locationbar?"1":"0");parms+=",toolbar="+(toolbar?"1":"0");parms+=",statusbar="+(statusbar?"1":"0");parms+=",menubar="+(menubar?"1":"0");parms+=",resizable="+(resizable?"1":"0");parms+=",toolbar="+(toolbar?"1":"0");var x,y;switch(xPosition){case"left":x=0;break;case"right":x=0;break;case"center":x=0;break;case null:x=0;break;default:x=xPosition;break;}
switch(yPosition){case"left":y=0;break;case"right":y=0;break;case"center":y=0;break;case null:y=0;break;default:y=yPosition;break;}
parms+=",left="+xPosition;parms+=",top="+yPosition;eval("page"+id+" = window.open(url, '"+id+"', '"+parms+"');");}
bet.web.PageController.prototype.playLeaderboardAd=function(adUrl,adClickUrl){var html=null;var adUrlLower=adUrl.toLowerCase();if(adUrlLower.indexOf(".swf")>=0){html=PC.getFlashHtml(728,90,adUrl,8,null,FlashWMode.Transparent);html="<div style=\"z-index:0;\">"+html+"</div>";}else{if(adUrlLower.indexOf(".jpg")>=0||adUrlLower.indexOf(".gif")>=0||adUrlLower.indexOf(".png")>=0){html="<img src=\""+adUrl+"\" />";if(adClickUrl!=null&&adClickUrl!=""){html="<a href=\""+adClickUrl+"\">"+html+"</a>";}}}
jQuery("#headerAdDiv dd div").empty();jQuery("#headerAdDiv dd div").append(html);}
bet.web.PageController.prototype.updateLayout=function(){if(!this.updateLayoutReady){this.primaryContentDiv=document.getElementById('primaryContentDiv');this.secondaryContentDiv=document.getElementById('secondaryContentDiv');this.updateLayoutReady=true;}
if(this.primaryContentDiv!=null&&this.secondaryContentDiv!=null){var primaryDivHeight=jQuery(this.primaryContentDiv).height();var secondaryDivHeight=jQuery(this.secondaryContentDiv).height()
if(primaryDivHeight>secondaryDivHeight){jQuery(this.secondaryContentDiv).height(primaryDivHeight);}else if(secondaryDivHeight>primaryDivHeight){}}}
bet.web.PageController.prototype.initCommenting=function(config){var cc=new CommentController(config);cc.initialize();}
bet.web.PageController.prototype.getUser=function(){var uid=this.readCookie('cm_UserName');if(uid==null||uid==''){return null;}
var email=this.readCookie('cm_Email');return{uid:uid,email:email}}
bet.web.PageController.prototype.getIsLoggedIn=function(){var user=this.getUser();return user!=null;}
bet.web.PageController.prototype.logout=function(){document.location='/WebApplications/betRoot/support/logout.aspx';}
bet.web.PageController.prototype.layoutColumns=function(o){var container=o.container;var items=o.items;var itemWidth=o.itemWidth;var itemSpacing=o.itemSpacing;var columnSpacing=o.columnSpacing;var columnCount=o.columnCount;var minColumnHeight=o.minColumnHeight;var origin=o.origin;if(items){items=$(items);}else{if(o.itemsSelector){items=$(o.itemsSelector);}}
if(!items||items.length==0){return false;}
if(container){container=$(container);}else{if(o.containerSelector){container=$(o.containerSelector).get(0);}else{container=$(items.get(0)).parent();}}
if(!container||!items||items.length==0){return false;}
var rectangles=new Array();var totalItemHeight=0;items.each(function(i){var itemJQ=$(this);if(itemJQ.is(':visible')){var itemPosition=itemJQ.position();var itemWidth=itemJQ.width();var itemHeight=itemJQ.height();if(itemHeight<=0){return false;}
rectangles.push({item:this,x:itemPosition.left,y:itemPosition.top,width:itemWidth,height:itemHeight,x2:itemPosition.left+itemWidth,y2:itemPosition.top+itemHeight});totalItemHeight+=itemHeight;}});var itemCount=rectangles.length;if(itemCount<2){return false;}
if(!columnCount){columnCount=2;}
if(columnCount<2){return false;}
if(!minColumnHeight){minColumnHeight=0;}
if(!itemWidth){itemWidth=1;for(var i=0;i<rectangles.length;i++){var rect=rectangles[i];if(rect.width>itemWidth){itemWidth=rect.width;}}}
if(!itemSpacing){if(rectangles[0].x==rectangles[1].x){itemSpacing=rectangles[1].y-rectangles[0].y2;}}
if(!itemSpacing||itemSpacing<0){itemSpacing=0;}
if(!columnSpacing){columnSpacing=itemSpacing;}
if(!origin){origin={x:rectangles[0].x,y:rectangles[0].y};}
var singleColumnHeight=totalItemHeight+(itemSpacing*(itemCount-0));if(singleColumnHeight<=minColumnHeight){return false;}
var targetColHeight=Math.ceil(singleColumnHeight/columnCount)+(columnCount*itemSpacing);if(targetColHeight<minColumnHeight){targetColHeight=minColumnHeight;}
var finalColCount=-1;var moves=new Array();var maxColHeight=0;var layoutAttemptCount=0;var maxLayoutAttemptCount=3;var _doLayout=function(){moves=new Array();maxColHeight=0;layoutAttemptCount++;var currentColHeight;var currentColOrigin;var currentColIndex=-1;var previousColItemRect=null;var firstColumnHeight=null;var secondColumnFirstRect=null;for(var i=0;i<rectangles.length;i++){var rect=rectangles[i];if(currentColIndex<0){currentColIndex=0;currentColOrigin=origin;newItemPos={x:currentColOrigin.x,y:currentColOrigin.y};currentColHeight=rect.height;previousColItemRect=rect;}else{if(currentColHeight+itemSpacing+rect.height>targetColHeight){if(currentColIndex==0){firstColumnHeight=currentColHeight;secondColumnFirstRect=rect;}
currentColIndex++;currentColOrigin={x:currentColOrigin.x+itemWidth+columnSpacing,y:currentColOrigin.y};newItemPos={x:currentColOrigin.x,y:currentColOrigin.y};currentColHeight=rect.height;previousColItemRect=rect;}else{newItemPos={x:currentColOrigin.x,y:currentColOrigin.y+currentColHeight+itemSpacing};currentColHeight+=itemSpacing+rect.height;previousColItemRect=rect;}}
if(currentColHeight>maxColHeight){maxColHeight=currentColHeight;}
moves.push({item:rect.item,x:newItemPos.x-origin.x,y:newItemPos.y-origin.y});}
var actualColCount=currentColIndex+1;if(actualColCount>columnCount){if(layoutAttemptCount<maxLayoutAttemptCount){targetColHeight=firstColumnHeight+itemSpacing+secondColumnFirstRect.height;finalColCount=actualColCount;return _doLayout();}else{finalColCount=actualColCount;return true;}}else{finalColCount=actualColCount;return true;}}
_doLayout();if(moves.length>0){container.css('position','relative');container.css('display','block');items.css('position','absolute');for(var i=0;i<moves.length;i++){var move=moves[i];var itemJQ=$(move.item);itemJQ.css('position','absolute');itemJQ.css('left',move.x+'px');itemJQ.css('top',move.y+'px');}
var containerHeight=maxColHeight+(1*origin.y);container.css('height',containerHeight+'px');}
if(o.success){if(!o.scope){o.scope=this;}
o.success({data:{columnCount:finalColCount,containerSize:{width:(finalColCount*itemWidth)+((finalColCount-1)*itemSpacing),height:containerHeight+origin.y}}});}};

BET.ns('bet.web.controls');var offset=0;var currentPage=0;bet.web.controls.HorizontalThumbSelector=function(config){return{attached:false,attach:function(element){if(this.attached){return;}
this.attached=true;}};};function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+
((expiredays==null)?"":";expires="+exdate.toGMTString());}
function getCookie(c_name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";}
jQuery(document).ready(function(){var carouselWidth=getCarouselWidth();if(carouselWidth>0)
{addNumOfVideos();if(getCookie("carouselOffPref").indexOf("false")!=-1)
{resetCarousel();}
else
{setListView("dl.videoPlayerPlaylist dl.title div span.listStyle");}
jQuery("dl.videoPlayerPlaylist dl.content div.rightButton").click(function(){if(jQuery("dl.videoPlayerPlaylist dl.content div.rightButton div").hasClass("active"))
{setCurrentPage(currentPage+1);goToPage(currentPage,139*4);}});jQuery("dl.videoPlayerPlaylist dl.content div.leftButton").click(function(){if(jQuery("dl.videoPlayerPlaylist dl.content div.leftButton div").hasClass("active"))
{setCurrentPage(currentPage-1);goToPage(currentPage,139*4);}});jQuery("dl.videoPlayerPlaylist dl.content div.scrollButton div").hover(function(){if(jQuery(this).hasClass("active")){jQuery(this).addClass("hover");}},function(){jQuery(this).removeClass("hover");});jQuery("dl.videoPlayerPlaylist dl.content dl.thumbList dl.thumb").hover(function(){var artist=jQuery(this).find("dl.artist span").text();var song=jQuery(this).find("dl.title span").text();addInfoWindow(this,artist,song);},function(){removeInfoWindow(this);});}});function setCurrentPage(val)
{currentPage=val;}
function resetCarousel()
{var carouselWidth=getCarouselWidth();var width=139*4;var selectedIndex=getSelectedIndex(0,jQuery(".videoPlayerPlaylist dl.thumbList div dl.thumb"));setCurrentPage(ceilingDivision(selectedIndex+1,4));setCarouselWidth(carouselWidth+11);jQuery("dl.videoPlayerPlaylist dl.content dl.thumbList").css("height","82px");goToPage(currentPage,width);}
function addInfoWindow(thumb,artist,song)
{var windowOffset=findOffsetForWindow(thumb);var html='<div style="left:'+windowOffset+'px;" class="infoWindow"><span class="artist">'+artist+'</span><span class="delimiter">-</span><span class="title">'+song+'</span></div>';if(jQuery(".videoPlayerPlaylist").hasClass("listView")!=true)
{jQuery(thumb).append(html);}}
function addNumOfVideos()
{var count=getPlayListCount();var html="";var leftString="";var currentHeight=jQuery("#secondaryContentDiv").outerHeight();var difference=86*(ceilingDivision(count,2));if(count==1)
{leftString="1 Video | ";}
else
{leftString=count+" Videos | ";}
html='<div class="options"><span class="count">'+leftString+'</span><span class="listStyle">Show All</span></div>';jQuery("dl.videoPlayerPlaylist dl.title:first").append(html);jQuery("dl.videoPlayerPlaylist dl.title div span.listStyle").click(function(){jQuery("dl.videoPlayerPlaylist").toggleClass("listView");if(jQuery(this).text()=="Show All")
{jQuery(this).text("Show in Carousel");setCarouselWidth(628);addHeight(currentHeight+difference,difference);setCurrentPage(1);setCookie("carouselOffPref",true,7);goToPage(1,139*4);}
else
{currentHeight=jQuery("#secondaryContentDiv").outerHeight();currentHeight=currentHeight-difference;addHeight(currentHeight,82);resetCarousel();setCookie("carouselOffPref",false,7);jQuery(this).text("Show All");}});}
function setListView(selector)
{jQuery(selector).triggerHandler('click');}
function findOffsetForWindow(thumb)
{var windowOffset=0;windowOffset=jQuery(thumb).prevAll().size()*getThumbnailWidth();return windowOffset;}
function removeInfoWindow(thumb)
{jQuery("dl.videoPlayerPlaylist dl.content dl.thumbList div.infoWindow").remove();}
function setOffset(value)
{offset=value;}
function getOffset()
{return offset;}
function goToPage(pageNumber,pageWidth)
{goToOffset((pageNumber-1)*pageWidth);jQuery("dl.videoPlayerPlaylist dl.content div.scrollButton div").addClass("active");if(isFirstPage(pageNumber))
{jQuery("dl.videoPlayerPlaylist dl.content div.leftButton div").removeClass("active");jQuery("dl.videoPlayerPlaylist dl.content div.leftButton div").removeClass("hover");}
if(isLastPage(pageNumber))
{jQuery("dl.videoPlayerPlaylist dl.content div.rightButton div").removeClass("active");jQuery("dl.videoPlayerPlaylist dl.content div.rightButton div").removeClass("hover");}}
function isLastPage(page)
{var numOfPages=getPageCount();if(page==numOfPages)
{return true;}
else
{return false;}}
function isFirstPage(page)
{if(page==1)
{return true;}
else
{return false;}}
function goToOffset(offset)
{var delta=offset-getOffset();setOffset(offset);var phaseOne=(delta/10)*7.5;var phaseTwo=(delta/10)*.5;var phaseThree=(delta/10)*.5;var phaseFour=(delta/10)*.5;var phaseFive=(delta/10)*.5;var phaseSix=(delta/10)*.5;if(jQuery("dl.videoPlayerPlaylist").hasClass("listView"))
{jQuery(".videoPlayerPlaylist dl.thumbList div").animate({left:'-='+delta},0);}
else{if(navigator.appName!="Microsoft Internet Explorer")
{jQuery(".videoPlayerPlaylist dl.thumbList div").animate({left:'-='+phaseOne},450);jQuery(".videoPlayerPlaylist dl.thumbList div").animate({left:'-='+phaseTwo},45);jQuery(".videoPlayerPlaylist dl.thumbList div").animate({left:'-='+phaseThree},65);jQuery(".videoPlayerPlaylist dl.thumbList div").animate({left:'-='+phaseFour},90);jQuery(".videoPlayerPlaylist dl.thumbList div").animate({left:'-='+phaseFive},120);jQuery(".videoPlayerPlaylist dl.thumbList div").animate({left:'-='+phaseSix},155);}
else{jQuery(".videoPlayerPlaylist dl.thumbList div").animate({left:'-='+delta},900);}}}
function getPlayListCount()
{return jQuery(".videoPlayerPlaylist dl.thumbList div").size()-2;}
function getSelectedIndex(index,thumbs)
{var found=thumbs.slice(index,index+1).hasClass("selected");if(found==true)
{return index;}
else
{index++;return getSelectedIndex(index,thumbs);}}
function getCarouselWidth()
{var playlistCount=getPlayListCount();var width=getThumbnailWidth();width=width*playlistCount;return width;}
function getThumbnailWidth()
{return 139;}
function setCarouselWidth(carouselWidth)
{jQuery(".videoPlayerPlaylist dl.thumbList div").css("width",carouselWidth+"px");}
function getPageCount()
{var pageWidth=getThumbnailWidth()*4;var count=getPlayListCount();return ceilingDivision(count,4);}
function ceilingDivision(value,divisor)
{var remainder=value%divisor;if(remainder!=0){value=value+divisor-remainder;}
return value/divisor;}
function addHeight(height,difference)
{jQuery("#secondaryContentDiv").css("height",height+"px");jQuery("#primaryContentDiv2 dl.listView dl.content dl.thumbList").css("height",difference+"px");}

jQuery(document).ready(function(){jQuery('.videoPlayerPlaylist').each(function(){var thumbSlider=new bet.web.controls.HorizontalThumbSelector();thumbSlider.attach(this);});});


var PC=new bet.web.PageController();$(document).ready(function(){if(PC.updateLayout){setInterval(function(){PC.updateLayout();},200);}});
