/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt */ if(typeof CINEMOVIES=="undefined"){var CINEMOVIES={};}CINEMOVIES.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;++i){d=a[i].split(".");o=CINEMOVIES;for(j=(d[0]=="CINEMOVIES")?1:0;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}return o;};CINEMOVIES.log=function(_2,_3,_4){var l=CINEMOVIES.widget.Logger;if(l&&l.log){return l.log(_2,_3,_4);}else{return false;}};CINEMOVIES.extend=function(_6,_7,_8){var F=function(){};F.prototype=_7.prototype;_6.prototype=new F();_6.prototype.constructor=_6;_6.superclass=_7.prototype;if(_7.prototype.constructor==Object.prototype.constructor){_7.prototype.constructor=_7;}if(_8){for(var i in _8){_6.prototype[i]=_8[i];}}};CINEMOVIES.augment=function(r,s){var rp=r.prototype,sp=s.prototype,a=arguments,i,p;if(a[2]){for(i=2;i<a.length;++i){rp[a[i]]=sp[a[i]];}}else{for(p in sp){if(!rp[p]){rp[p]=sp[p];}}}};CINEMOVIES.namespace("util","widget","example");(function(){var Y=CINEMOVIES.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf('opera')>-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}if(propertyCache[property]){return propertyCache[property];}while(patterns.HYPHEN.exec(property)){property=property.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}propertyCache[property]=property;return property;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}return val/100;break;default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}break;default:el.style[property]=val;}};}else{setStyle=function(el,property,val){el.style[property]=val;};}CINEMOVIES.util.Dom={get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=Y.Dom.get(el[i]);}return collection;}return null;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if(el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none'){return false;}var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}}if(isSafari&&this.getStyle(el,'position')=='absolute'){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){parentNode=el.parentNode;}else{parentNode=null;}while(parentNode&&parentNode.tagName.toUpperCase()!='BODY'&&parentNode.tagName.toUpperCase()!='HTML'){if(Y.Dom.getStyle(parentNode,'display')!='inline'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}if(parentNode.parentNode){parentNode=parentNode.parentNode;}else{parentNode=null;}}return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}var pageXY=this.getXY(el);if(pageXY===false){return false;}var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el['className']);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}el['className']=[el['className'],className].join(' ');};Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}var c=el['className'];el['className']=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(oldClassName===newClassName){return false;}var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return;}el['className']=el['className'].replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=Y.Dom.get(el);}else{el={};}if(!el.id){el.id=prefix+id_counter++;}return el.id;};return Y.Dom.batch(el,f,Y.Dom,true);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;}var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}else if(!parent.tagName||parent.tagName.toUpperCase()=='HTML'){return false;}parent=parent.parentNode;}return false;}};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';root=Y.Dom.get(root)||document;var nodes=[];var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}return nodes;},batch:function(el,method,o,override){var id=el;el=Y.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return method.call(scope,el,o);}var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=el[i];}collection[collection.length]=method.call(scope,el[i],o);}return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}return width;}};})();CINEMOVIES.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};CINEMOVIES.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};CINEMOVIES.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};CINEMOVIES.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new CINEMOVIES.util.Region(t,r,b,l);}else{return null;}};CINEMOVIES.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new CINEMOVIES.util.Region(t,r,b,l);};CINEMOVIES.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};CINEMOVIES.util.Region.getRegion=function(el){var p=CINEMOVIES.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new CINEMOVIES.util.Region(t,r,b,l);};CINEMOVIES.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};CINEMOVIES.util.Point.prototype=new CINEMOVIES.util.Region();CINEMOVIES.util.CustomEvent=function(_1,_2,_3,_4){this.type=_1;this.scope=_2||window;this.silent=_3;this.signature=_4||CINEMOVIES.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var _5="_YUICEOnSubscribe";if(_1!==_5){this.subscribeEvent=new CINEMOVIES.util.CustomEvent(_5,this,true);}};CINEMOVIES.util.CustomEvent.LIST=0;CINEMOVIES.util.CustomEvent.FLAT=1;CINEMOVIES.util.CustomEvent.prototype={subscribe:function(fn,_7,_8){if(this.subscribeEvent){this.subscribeEvent.fire(fn,_7,_8);}this.subscribers.push(new CINEMOVIES.util.Subscriber(fn,_7,_8));},unsubscribe:function(fn,_9){var _10=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_9)){this._delete(i);_10=true;}}return _10;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}var _14=[],ret=true,i;for(i=0;i<arguments.length;++i){_14.push(arguments[i]);}var _15=_14.length;if(!this.silent){}for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _16=s.getScope(this.scope);if(this.signature==CINEMOVIES.util.CustomEvent.FLAT){var _17=null;if(_14.length>0){_17=_14[0];}ret=s.fn.call(_16,_17,s.obj);}else{ret=s.fn.call(_16,this.type,_14,s.obj);}if(false===ret){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}},_delete:function(_18){var s=this.subscribers[_18];if(s){delete s.fn;delete s.obj;}this.subscribers.splice(_18,1);},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};CINEMOVIES.util.Subscriber=function(fn,obj,_20){this.fn=fn;this.obj=obj||null;this.override=_20;};CINEMOVIES.util.Subscriber.prototype.getScope=function(_21){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return _21;};CINEMOVIES.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return (this.fn==fn&&this.obj==obj);}else{return (this.fn==fn);}};CINEMOVIES.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!CINEMOVIES.util.Event){CINEMOVIES.util.Event=function(){var _22=false;var _23=[];var _24=[];var _25=[];var _26=[];var _27=0;var _28=[];var _29=[];var _30=0;return {POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var _31=this;var _32=function(){_31._tryPreloadAttach();};this._interval=setInterval(_32,this.POLL_INTERVAL);}},onAvailable:function(_33,_34,_35,_36){_28.push({id:_33,fn:_34,obj:_35,override:_36,checkReady:false});_27=this.POLL_RETRYS;this.startInterval();},onContentReady:function(_37,_38,_39,_40){_28.push({id:_37,fn:_38,obj:_39,override:_40,checkReady:true});_27=this.POLL_RETRYS;this.startInterval();},addListener:function(el,_42,fn,obj,_43){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],_42,fn,obj,_43)&&ok;}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){CINEMOVIES.util.Event.on(el,_42,fn,obj,_43);});return true;}}}if(!el){return false;}if("unload"==_42&&obj!==this){_24[_24.length]=[el,_42,fn,obj,_43];return true;}var _46=el;if(_43){if(_43===true){_46=obj;}else{_46=_43;}}var _47=function(e){return fn.call(_46,CINEMOVIES.util.Event.getEvent(e),obj);};var li=[el,_42,fn,_47,_46];var _50=_23.length;_23[_50]=li;if(this.useLegacyEvent(el,_42)){var _51=this.getLegacyIndex(el,_42);if(_51==-1||el!=_25[_51][0]){_51=_25.length;_29[el.id+_42]=_51;_25[_51]=[el,_42,el["on"+_42]];_26[_51]=[];el["on"+_42]=function(e){CINEMOVIES.util.Event.fireLegacyEvent(CINEMOVIES.util.Event.getEvent(e),_51);};}_26[_51].push(li);}else{this._simpleAdd(el,_42,_47,false);}return true;},fireLegacyEvent:function(e,_52){var ok=true;var le=_26[_52];for(var i=0,len=le.length;i<len;++i){var li=le[i];if(li&&li[this.WFN]){var _54=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_54,e);ok=(ok&&ret);}}return ok;},getLegacyIndex:function(el,_56){var key=this.generateId(el)+_56;if(typeof _29[key]=="undefined"){return -1;}else{return _29[key];}},useLegacyEvent:function(el,_58){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_58||"dblclick"==_58){return true;}}}return false;},removeListener:function(el,_59,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_59,fn)&&ok);}return ok;}}if(!fn||!fn.call){return this.purgeElement(el,false,_59);}if("unload"==_59){for(i=0,len=_24.length;i<len;i++){var li=_24[i];if(li&&li[0]==el&&li[1]==_59&&li[2]==fn){_24.splice(i,1);return true;}}return false;}var _60=null;var _61=arguments[3];if("undefined"==typeof _61){_61=this._getCacheIndex(el,_59,fn);}if(_61>=0){_60=_23[_61];}if(!el||!_60){return false;}if(this.useLegacyEvent(el,_59)){var _62=this.getLegacyIndex(el,_59);var _63=_26[_62];if(_63){for(i=0,len=_63.length;i<len;++i){li=_63[i];if(li&&li[this.EL]==el&&li[this.TYPE]==_59&&li[this.FN]==fn){_63.splice(i,1);}}}}else{this._simpleRemove(el,_59,_60[this.WFN],false);}delete _23[_61][this.WFN];delete _23[_61][this.FN];_23.splice(_61,1);return true;},getTarget:function(ev,_65){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_67){if(_67&&3==_67.nodeType){return _67.parentNode;}else{return _67;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,_71,fn){for(var i=0,len=_23.length;i<len;++i){var li=_23[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_71){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_30;++_30;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){_22=true;var EU=CINEMOVIES.util.Event;if(this.isIE){EU._simpleRemove(window,"load",EU._load);}},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _75=!_22;if(!_75){_75=(_27>0);}var _76=[];for(var i=0,len=_28.length;i<len;++i){var _77=_28[i];if(_77){var el=this.getEl(_77.id);if(el){if(!_77.checkReady||_22||el.nextSibling||(document&&document.body)){var _78=el;if(_77.override){if(_77.override===true){_78=_77.obj;}else{_78=_77.override;}}_77.fn.call(_78,_77.obj);delete _28[i];}}else{_76.push(_77);}}}_27=(_76.length===0)?0:_27-1;if(_75){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(el,_79,_80){var _81=this.getListeners(el,_80);if(_81){for(var i=0,len=_81.length;i<len;++i){var l=_81[i];this.removeListener(el,l.type,l.fn);}}if(_79&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_79,_80);}}},getListeners:function(el,_83){var _84=[];if(_23&&_23.length>0){for(var i=0,len=_23.length;i<len;++i){var l=_23[i];if(l&&l[this.EL]===el&&(!_83||_83===l[this.TYPE])){_84.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_84.length)?_84:null;},_unload:function(e){var EU=CINEMOVIES.util.Event,i,j,l,len,index;for(i=0,len=_24.length;i<len;++i){l=_24[i];if(l){var _85=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){_85=l[EU.OBJ];}else{_85=l[EU.ADJ_SCOPE];}}l[EU.FN].call(_85,EU.getEvent(e),l[EU.OBJ]);delete _24[i];l=null;_85=null;}}if(_23&&_23.length>0){j=_23.length;while(j){index=j-1;l=_23[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}j=j-1;}l=null;EU.clearCache();}for(i=0,len=_25.length;i<len;++i){delete _25[i][0];delete _25[i];}EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}},_simpleAdd:function(){if(window.addEventListener){return function(el,_87,fn,_88){el.addEventListener(_87,fn,(_88));};}else{if(window.attachEvent){return function(el,_89,fn,_90){el.attachEvent("on"+_89,fn);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,_91,fn,_92){el.removeEventListener(_91,fn,(_92));};}else{if(window.detachEvent){return function(el,_93,fn){el.detachEvent("on"+_93,fn);};}else{return function(){};}}}()};}();(function(){var EU=CINEMOVIES.util.Event;EU.on=EU.addListener;if(document&&document.body){EU._load();}else{EU._simpleAdd(window,"load",EU._load);}EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}CINEMOVIES.util.EventProvider=function(){};CINEMOVIES.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(_94,_95,_96,_97){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_94];if(ce){ce.subscribe(_95,_96,_97);}else{this.__yui_subscribers=this.__yui_subscribers||{};var _99=this.__yui_subscribers;if(!_99[_94]){_99[_94]=[];}_99[_94].push({fn:_95,obj:_96,override:_97});}},unsubscribe:function(_100,p_fn,_102){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_100];if(ce){return ce.unsubscribe(p_fn,_102);}else{return false;}},createEvent:function(_103,_104){this.__yui_events=this.__yui_events||{};var opts=_104||{};var _106=this.__yui_events;if(_106[_103]){}else{var _107=opts.scope||this;var _108=opts.silent||null;var ce=new CINEMOVIES.util.CustomEvent(_103,_107,_108,CINEMOVIES.util.CustomEvent.FLAT);_106[_103]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[_103];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}return _106[_103];},fireEvent:function(_110,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[_110];if(ce){var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}return ce.fire.apply(ce,args);}else{return null;}},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}return false;}};/* Copyright (c) 2006, CINEMOVIES! Inc. All rights reserved.Code licensed under the BSD License:http://developer.CINEMOVIES.net/yui/license.txt */ CINEMOVIES.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};CINEMOVIES.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}CINEMOVIES.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=CINEMOVIES.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(CINEMOVIES.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i];}}else{end=start+attributes[attr]['by'];}}this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=CINEMOVIES.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||CINEMOVIES.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=CINEMOVIES.util.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(CINEMOVIES.util.AnimMgr.fps*this.duration):this.duration;CINEMOVIES.util.AnimMgr.registerElement(this);};this.stop=function(finish){if(finish){this.currentFrame=this.totalFrames;this._onTween.fire();}CINEMOVIES.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new CINEMOVIES.util.CustomEvent('_start',this,true);this.onStart=new CINEMOVIES.util.CustomEvent('start',this);this.onTween=new CINEMOVIES.util.CustomEvent('tween',this);this._onTween=new CINEMOVIES.util.CustomEvent('_tween',this,true);this.onComplete=new CINEMOVIES.util.CustomEvent('complete',this);this._onComplete=new CINEMOVIES.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};CINEMOVIES.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=200;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index!=-1){queue.splice(index,1);}tweenCount-=1;if(tweenCount<=0){this.stop();}};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[i].isAnimated()){this.unRegister(tween,i);}}queue=[];thread=null;tweenCount=0;}else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null){tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}tween._onTween.fire();}else{CINEMOVIES.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};CINEMOVIES.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}return[tmp[0][0],tmp[0][1]];};};(function(){CINEMOVIES.util.ColorAnim=function(el,attributes,duration,method){CINEMOVIES.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};CINEMOVIES.extend(CINEMOVIES.util.ColorAnim,CINEMOVIES.util.Anim);var Y=CINEMOVIES.util;var superclass=Y.ColorAnim.superclass;var proto=Y.ColorAnim.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};proto.patterns.color=/color$/i;proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;proto.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;proto.parseColor=function(s){if(s.length==3){return s;}var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}return null;};proto.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=CINEMOVIES.util.Dom.getStyle(el,attr);if(this.patterns.transparent.test(val)){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&this.patterns.transparent.test(val)){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='#fff';}}}}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();CINEMOVIES.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-CINEMOVIES.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},bounceBoth:function(t,b,c,d){if(t<d/2)return CINEMOVIES.util.Easing.bounceIn(t*2,0,c,d)*.5+b;return CINEMOVIES.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){CINEMOVIES.util.Motion=function(el,attributes,duration,method){if(el){CINEMOVIES.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};CINEMOVIES.extend(CINEMOVIES.util.Motion,CINEMOVIES.util.ColorAnim);var Y=CINEMOVIES.util;var superclass=Y.Motion.superclass;var proto=Y.Motion.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};proto.patterns.points=/^points$/i;proto.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};proto.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}control=tmp;}if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}else{Y.Dom.setXY(el,Y.Dom.getXY(el));}start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){CINEMOVIES.util.Scroll=function(el,attributes,duration,method){if(el){CINEMOVIES.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};CINEMOVIES.extend(CINEMOVIES.util.Scroll,CINEMOVIES.util.ColorAnim);var Y=CINEMOVIES.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();/* Copyright (c) 2006, CINEMOVIES! Inc. All rights reserved.Code licensed under the BSD License:http://developer.CINEMOVIES.net/yui/license.txt */
CINEMOVIES.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id)
{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
{this._use_default_post_header=b;},setPollingInterval:function(i)
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
catch(e){}}}
finally
{return obj;}},getConnectionObject:function()
{var o;var tId=this._transaction_id;try
{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
catch(e){}
finally
{return o;}},asyncRequest:function(method,uri,callback,postData)
{var o=this.getConnectionObject();if(!o){return null;}
else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri,postData);this.releaseObject(o);return;}
if(method=='GET'){if(this._sFormData.length!=0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;}
else{uri+="?"+this._sFormData;}}
else if(method=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}}
o.conn.open(method,uri,true);if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}
if(this._has_http_headers){this.setHeader(o);}
this.handleReadyState(o,callback);o.conn.send(postData||null);return o;}},handleReadyState:function(o,callback)
{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){delete oConn._timeOut[o.tId];}
oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort)
{if(!callback){this.releaseObject(o);return;}
var httpStatus,responseObject;try
{if(o.conn.status!==undefined&&o.conn.status!=0){httpStatus=o.conn.status;}
else{httpStatus=13030;}}
catch(e){httpStatus=13030;}
if(httpStatus>=200&&httpStatus<300){try
{responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
else{callback.success.apply(callback.scope,[responseObject]);}}}
catch(e){}}
else{try
{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}}}
catch(e){}}
this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
{var obj={};var headerObj={};try
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
catch(e){}
obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
if(callbackArg){obj.argument=callbackArg;}
return obj;},initHeader:function(label,value)
{if(this._http_header[label]===undefined){this._http_header[label]=value;}
else{this._http_header[label]=value+","+this._http_header[label];}
this._has_http_headers=true;},setHeader:function(o)
{for(var prop in this._http_header){if(this._http_header.hasOwnProperty(prop)){o.conn.setRequestHeader(prop,this._http_header[prop]);}}
delete this._http_header;this._http_header={};this._has_http_headers=false;},setForm:function(formId,isUpload,secureUri)
{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);}
else if(typeof formId=='object'){oForm=formId;}
else{return;}
if(isUpload){this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
{switch(oElement.type)
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';hasSubmit=true;}
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';}
else if(typeof secureURI=='string'){io.src=secureUri;}}
else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
io.style.position='absolute';io.style.top='-9999px';io.style.left='-9999px';document.body.appendChild(io);},appendPostData:function(postData)
{var formElements=new Array();var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}}
return formElements;},uploadFile:function(id,callback,uri,postData){var frameId='yuiIO'+id;var io=document.getElementById(frameId);this._formNode.action=uri;this._formNode.method='POST';this._formNode.target=frameId;if(this._formNode.encoding){this._formNode.encoding='multipart/form-data';}
else{this._formNode.enctype='multipart/form-data';}
if(postData){var oElements=this.appendPostData(postData);}
this._formNode.submit();if(oElements&&oElements.length>0){try
{for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}}
catch(e){}}
this.resetFormState();var uploadCallback=function()
{var obj={};obj.tId=id;obj.argument=callback.argument;try
{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}
catch(e){}
if(callback.upload){if(!callback.scope){callback.upload(obj);}
else{callback.upload.apply(callback.scope,[obj]);}}
if(CINEMOVIES.util.Event){CINEMOVIES.util.Event.removeListener(io,"load",uploadCallback);}
else if(window.detachEvent){io.detachEvent('onload',uploadCallback);}
else{io.removeEventListener('load',uploadCallback,false);}
setTimeout(function(){document.body.removeChild(io);},100);};if(CINEMOVIES.util.Event){CINEMOVIES.util.Event.addListener(io,"load",uploadCallback);}
else if(window.attachEvent){io.attachEvent('onload',uploadCallback);}
else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
{if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];}
this.handleTransactionResponse(o,callback,true);return true;}
else{return false;}},isCallInProgress:function(o)
{if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}
else{return false;}},releaseObject:function(o)
{o.conn=null;o=null;}};/**
 * Create namespace
 */
CINEMOVIES.namespace("Media.Dtk.GlobalSearch");


/**
 * Tabs Manager Class
 */
CINEMOVIES.Media.Dtk.GlobalSearch.TabsMgr = {
	oProcessed : {} , 
	set : function(sKey,bValue){
		this.oProcessed[sKey] = bValue;
	} , 
	get : function(sKey){
		return (typeof(this.oProcessed[sKey])!='undefined' && this.oProcessed[sKey]==1);
	}
};


/**
 * Tabs Class
 */
CINEMOVIES.Media.Dtk.GlobalSearch.Tabs = function(sModuleName){
	this.sModuleName=sModuleName;
	this.dCurTab="";
	this.dCurTabNum= 1;
	this.aTabs=[];
	this.sTrigger="click";
	this.fAction=null;
	this.oActionVars=null;
	this.sTabTag="li";
	this.sClickTag="a";
	this.sOnName="on";
	this.sOffName="off";
	this.sHiLiteName="sparkle";
	this.bRoundCorners=false;
	this.aDataProcessed=[];
	this.bDropShadow=false;

};

CINEMOVIES.Media.Dtk.GlobalSearch.Tabs.prototype.dropShadowOff=function(){this.bDropShadow=false;}
CINEMOVIES.Media.Dtk.GlobalSearch.Tabs.prototype.dropShadowOn=function(){this.bDropShadow=true;}

CINEMOVIES.Media.Dtk.GlobalSearch.Tabs.prototype.changeAction=function(action,vars){this.fAction=action;this.oActionVars=vars;};

CINEMOVIES.Media.Dtk.GlobalSearch.Tabs.prototype.setupTabs=function(){
	var dTab = document.getElementById(this.sModuleName).getElementsByTagName(this.sTabTag);
	var nTabLength = dTab.length,i,j;

  var defaultTab = CINEMOVIES.Top.SessionCookie.get('search_tab');
  
  if (dTab[defaultTab])
  {
    this.dCurTab = dTab[defaultTab];
    CINEMOVIES.util.Dom.addClass(this.dCurTab, this.sOnName);
    document.sf1.action= this.dCurTab.firstChild.href;
  }
	
	for( i=0 ; i<nTabLength ; i++ ){
		if( this.bDropShadow ){
			// dynamically add dropshadow nodes
			var txtNode = document.createTextNode(dTab[i].firstChild.innerHTML);
			var dShad = document.createElement("span");
			dShad.appendChild(txtNode);
			dTab[i].insertBefore(dShad, dTab[i].firstChild);
		}

		if( this.dCurTab == "" && CINEMOVIES.util.Dom.hasClass(dTab[i],this.sOnName) ){
			this.dCurTab = dTab[i];
		}
    else if (this.dCurTab != dTab[i]) {
      CINEMOVIES.util.Dom.removeClass(dTab[i], this.sOnName);
    }
		var dClickTag = dTab[i].getElementsByTagName(this.sClickTag) || 0;
		var nClickTagLength = dClickTag.length;
		for( j=0 ; j<nClickTagLength ; j++ ){
			if( dClickTag[j].href.indexOf('schedule.cgi')<0 ){
				var self=this;
				dClickTag[j].order = (i+1);
				this.aTabs[(i+1)]=dClickTag[j];
				var oSelf= this;
				var fAction = function(e){
					if(e){CINEMOVIES.util.Event.stopEvent(e);}
					self.tabAction(e, oSelf, self);
					return false;
				}
				CINEMOVIES.util.Event.addListener(dClickTag[j], this.sTrigger, fAction);
				if(this.sTrigger!="click"){
					dClickTag[j].onclick=function(){return false;};
				}
			}
		}
	}
};

CINEMOVIES.Media.Dtk.GlobalSearch.Tabs.prototype.tabAction=function(e, dNode,oSelf){
	if (typeof(dNode.href)=='undefined') { dNode = e.srcElement || e.target; }
	if(dNode.tagName=='IMG'){dNode=dNode.parentNode;}
  
	if((oSelf.dCurTabNum-1)>0){
		CINEMOVIES.util.Dom.removeClass(oSelf.aTabs[(oSelf.dCurTabNum-1)].parentNode.parentNode , oSelf.sOffName);
	}
	CINEMOVIES.util.Dom.removeClass( oSelf.dCurTab , oSelf.sOnName );
	oSelf.dCurTab = (oSelf.oActionVars.type=='tab' ? dNode.parentNode.parentNode : dNode.parentNode);
	CINEMOVIES.util.Dom.removeClass( oSelf.dCurTab , oSelf.sHiLiteName );
	oSelf.dCurTabNum = dNode.order;
	CINEMOVIES.util.Dom.addClass( oSelf.dCurTab , oSelf.sOnName );

	if((oSelf.dCurTabNum-1)>0){
		CINEMOVIES.util.Dom.addClass(oSelf.aTabs[(oSelf.dCurTabNum-1)].parentNode.parentNode , oSelf.sOffName);
	}
  
	if(oSelf.fAction){ oSelf.fAction(oSelf.oActionVars,dNode,this); }
	return false;
};


/**
 * Global Search Box
 */
CINEMOVIES.Media.Dtk.GlobalSearch.ChangeVert = function(args,self){
	var obj=args.obj,tab=self;
	CINEMOVIES.util.Dom.addClass(obj.dCurTab, 'on');
	CINEMOVIES.util.Dom.addClass(tab.parentNode, 'on');
	obj.dCurTab=tab.parentNode;
	document.sf1.action=tab.href;
	var text=tab.innerHTML;
	document.getElementById('dtk-search').className='tab-'+text.toLowerCase();
	CINEMOVIES.Top.updateSearchCookie(tab.order - 1);
	if (typeof(this.first)=="undefined") this.searchbox = document.getElementById("dtk-searchbox").innerHTML;
	this.first = true;
	var searchbox = document.getElementById("dtk-searchbox");
	var leftfooter = document.getElementById("dtk-sboxfooter");
	var rightfooter = document.getElementById("dtk-sboxlinks");
	if(typeof(CINEMOVIES.Media.Dtk.nSearchBoxWidth)=='undefined'){
		CINEMOVIES.Media.Dtk.nSearchBoxWidth=CINEMOVIES.util.Dom.getStyle("dtk-searchbox","width");
	}
	if (searchbox.innerHTML != this.searchbox) {
		var value = document.sf1.p.value;
		searchbox.innerHTML = this.searchbox;
		if(CINEMOVIES.Media.Dtk.nPageSize==1){searchbox.style.marginLeft="auto";}
		else{searchbox.style.width=CINEMOVIES.Media.Dtk.nSearchBoxWidth;}
		document.sf1.p.value = value;
	}
	if (leftfooter){ leftfooter.style.display = "block"; }
	if (rightfooter){ rightfooter.style.display = "block"; }
	frPrefix = "Dtk-tab-";
	_ver = (typeof(ver)!="undefined"?ver:"");
	if(typeof(CINEMOVIES.Media.Dtk.GlobalSearch.oSearch)=='object'){
		document.sf1.fr.value = frPrefix + CINEMOVIES.Media.Dtk.GlobalSearch.oSearch[text].frcode + "-t" + _ver;
	}
	if(document.getElementById("searchlabel")){
		document.getElementById("dtk-searchlabel").title = text + " search: enter a search term and press Enter";
	}
	document.getElementById("p").title = text + " search: enter a search term and press Enter";
  setTimeout("document.sf1.p.focus()",1);
};

CINEMOVIES.Media.Dtk.GlobalSearch.bProcKeyDown=1;

CINEMOVIES.Media.Dtk.GlobalSearch.fKeyDown = function(e,oVerts){
	var src = e.srcElement || e.target;
	var code=e.keyCode,id=e.id,gk,_ffs=0;
	if(typeof(CINEMOVIES.Media.Dtk.GlobalSearch.bKeyDown)=='undefined'){CINEMOVIES.Media.Dtk.GlobalSearch.bKeyDown=1;}
	//document.sf1.p.value=code;
	if(code==13){return;}
	else if((code==191||code==222)&&id!='p'&&CINEMOVIES.Media.Dtk.GlobalSearch._ff){_ffs=1;gk=0;} // the user is trying to use FF keyboard shortcuts for FF search
	else if((code<31||code>41)&&(code<16||code>18)&&code!=9&&code!=8){gk=1;} // user is not pressing a navigation key
	else{gk=0;}
	var sFormClassName = document.getElementById('dtk-search').className;
	if (src.id=='p' || src.id=='scsz' || src.id=='dtk-searchsubmit') {
		if (code==9 && !e.shiftKey && CINEMOVIES.Media.Dtk.GlobalSearch.bProcKeyDown==0) {
			CINEMOVIES.Media.Dtk.GlobalSearch.bProcKeyDown=1;
		} else if ( 
			(code==9 && src.id=='p') || 
			(code==9 && !e.shiftKey && src.id=='dtk-searchsubmit' && CINEMOVIES.Media.Dtk.GlobalSearch.bProcKeyDown==1)
		) {
			var nTab = oVerts.dCurTabNum, nTabLength = (oVerts.aTabs.length-1);
			nTab = (e.shiftKey && nTab>0) ? nTab-1 : (nTab <= nTabLength ? nTab+1 : nTab); // get next tab
			if (nTab>0&&nTab<=nTabLength&&!e.ctrlKey&&!e.altKey&&!e.metaKey) { // focus on next tab
				CINEMOVIES.util.Event.stopEvent(e);
				oVerts.tabAction(e, oVerts.aTabs[nTab], oVerts);
				document.sf1.p.focus();
				return false;
			}
		} else if (gk==1) {
			CINEMOVIES.Media.Dtk.GlobalSearch.bProcKeyDown=0;
		}
	}
	else if (!_ffs&&gk==1&&src.type!='text'&&src.type!='select-one'&&src.type!='textarea'&&src.type!='radio'&&src.type!='checkbox'&&!e.ctrlKey&&!e.altKey&&!e.metaKey) {
		document.sf1.p.value='';
		document.sf1.p.focus();
	}
}

/*
 * end Global Search Box
 */
CINEMOVIES.namespace("Top");

CINEMOVIES.Top.tabs = new Array();
CINEMOVIES.Top.panes = new Array();

CINEMOVIES.Top.getHeight = function(elm) {
  var h = CINEMOVIES.util.Dom.getStyle(elm, 'height');
  if (h == 'auto') {
    CINEMOVIES.util.Dom.setStyle(elm, "zoom", 1);
    h = elm.clientHeight + 'px';
  }
  return h;
}

CINEMOVIES.Top.tabsInit = function(tabsbase) {
	
	// get tab & pane handles
  CINEMOVIES.Top.tabs[tabsbase] = CINEMOVIES.util.Dom.getElementsByClassName("tab", "li", tabsbase);
  CINEMOVIES.Top.panes[tabsbase] = CINEMOVIES.util.Dom.getElementsByClassName("pane", "div", tabsbase);

  // hide all pane headers, get pane heights
  var paneMaxHeight = 0;

  for(i = 0; i < CINEMOVIES.Top.panes[tabsbase].length; i++) {
  
    var header = CINEMOVIES.util.Dom.getElementsByClassName("hd", "div", CINEMOVIES.Top.panes[tabsbase][i]);

    if (header && tabsbase != 'scoreboard') {
      CINEMOVIES.util.Dom.setStyle(header, "display", "none");
    }

    pane_body = CINEMOVIES.util.Dom.getElementsByClassName("bd", "div", CINEMOVIES.Top.panes[tabsbase][i]);

    if (pane_body.length) {
      rawheight = CINEMOVIES.Top.getHeight(pane_body[0]);
      paneMaxHeight = Math.max(paneMaxHeight, parseInt(rawheight));
    } else {
      rawheight = CINEMOVIES.Top.getHeight(CINEMOVIES.Top.panes[tabsbase][i]);
      paneMaxHeight = Math.max(paneMaxHeight, parseInt(rawheight));
    }
  }

	if (tabsbase != 'scoreboard') {
	  paneMaxHeight += 2; // IE
	  paneMaxHeight = paneMaxHeight + "px";
    
	  // set height of all panes to maxheight  
	  for(i = 0; i < CINEMOVIES.Top.panes[tabsbase].length; i++) {
	    pane_body = CINEMOVIES.util.Dom.getElementsByClassName("bd", "div", CINEMOVIES.Top.panes[tabsbase][i]);
	    
	    if (pane_body.length) {
	      CINEMOVIES.util.Dom.setStyle(pane_body, "height", paneMaxHeight);
	    } else {
	      CINEMOVIES.util.Dom.setStyle(CINEMOVIES.Top.panes[tabsbase][i], "height", paneMaxHeight);
	    }
	  }
	} 
	 
  // hook in tab handlers to show pane
  for(i = 0; i < CINEMOVIES.Top.panes[tabsbase].length; i++) {
    CINEMOVIES.util.Event.addListener(CINEMOVIES.Top.tabs[tabsbase][i], "click", CINEMOVIES.Top.showPane, {"tabsbase": tabsbase, "showPane": i});
  }
  
  // show first pane, hide others
  CINEMOVIES.Top.showPane(null, {"tabsbase": tabsbase, "showPane": 0});
}


CINEMOVIES.Top.showPane = function(e, oPane) {
  tabsbase = oPane.tabsbase;
  pane = oPane.showPane;

  for(i = 0; i < CINEMOVIES.Top.panes[tabsbase].length; i++) {
    if (i == pane) {
      CINEMOVIES.util.Dom.setStyle(CINEMOVIES.Top.panes[tabsbase][i], "display", "");
      CINEMOVIES.util.Dom.setStyle(CINEMOVIES.Top.panes[tabsbase][i], "visibility", "visible");
      CINEMOVIES.util.Dom.setStyle(CINEMOVIES.Top.panes[tabsbase][i], "position", "static");
      CINEMOVIES.util.Dom.addClass(CINEMOVIES.Top.tabs[tabsbase][i], "selected");      
    } else {
      CINEMOVIES.util.Dom.setStyle(CINEMOVIES.Top.panes[tabsbase][i], "display", "none");
      CINEMOVIES.util.Dom.removeClass(CINEMOVIES.Top.tabs[tabsbase][i], "selected");
    }
  }
}

CINEMOVIES.Top.gotoUrl = function(e, url) {
  document.location.href = url;
  CINEMOVIES.util.Event.stopPropagation(e);
}

CINEMOVIES.Top.expertsInit = function() {

  // get tab & expert handles
  CINEMOVIES.Top.experts = document.getElementById("experts").getElementsByTagName("dt");
  CINEMOVIES.Top.experts_desc = document.getElementById("experts").getElementsByTagName("dd");
  
  var paneMaxHeight = 0;

  for(i = 0; i < CINEMOVIES.Top.experts_desc.length; i++) {
    rawheight = CINEMOVIES.Top.getHeight(CINEMOVIES.Top.experts_desc[i]);
    paneMaxHeight = Math.max(paneMaxHeight, parseInt(rawheight));
  }

  paneMaxHeight += 2; // IE
  paneMaxHeight = paneMaxHeight + "px";

  // set height of all panes to maxheight          
  for(i = 0; i < CINEMOVIES.Top.experts_desc.length; i++) {
    CINEMOVIES.util.Dom.setStyle(CINEMOVIES.Top.experts_desc[i], "height", paneMaxHeight);
  }
  
  // only hook in event handlers if more than 2 experts
  if (CINEMOVIES.Top.experts.length > 2) {

    // hook in tab handlers to show/hide expert
    for(i = 0; i < CINEMOVIES.Top.experts.length; i++) {
      CINEMOVIES.util.Dom.addClass(CINEMOVIES.Top.experts[i], "activated");
      CINEMOVIES.util.Event.addListener(CINEMOVIES.Top.experts[i], "click", CINEMOVIES.Top.clickExpert, i);
    }

    // show first expert
    CINEMOVIES.Top.showExpert(0);
  }
  
  else {
    // show first two experts
    CINEMOVIES.Top.showExpert(1, true);
    CINEMOVIES.Top.showExpert(0, true);
  }
}

CINEMOVIES.Top.clickExpert = function(e, expert) {

  // collapse
  if(expert == CINEMOVIES.Top.currentExpert) {
    if(expert == (CINEMOVIES.Top.experts.length - 1)) {
      // expand first
      CINEMOVIES.Top.showExpert(0, false);
    } else {
      // expand next
      CINEMOVIES.Top.showExpert(expert + 1, false);
    }
  }
  
  else {
    CINEMOVIES.Top.showExpert(expert, false);
  }
}

CINEMOVIES.Top.showExpert = function(expert, hide_controls) {
  for(i = 0; i < CINEMOVIES.Top.experts.length; i++) {
    if (i == expert) {
      CINEMOVIES.util.Dom.setStyle(CINEMOVIES.Top.experts_desc[i], "display", "");
      CINEMOVIES.util.Dom.addClass(CINEMOVIES.Top.experts[i], "on");
    } else if (CINEMOVIES.Top.experts.length > 2) {
      CINEMOVIES.util.Dom.setStyle(CINEMOVIES.Top.experts_desc[i], "display", "none");
      CINEMOVIES.util.Dom.removeClass(CINEMOVIES.Top.experts[i], "on");
    }
    
    if (hide_controls) {
      CINEMOVIES.util.Dom.addClass(CINEMOVIES.Top.experts[i], "nocontrols");
    }
  }
  
  CINEMOVIES.Top.currentExpert = expert;
}

CINEMOVIES.Top.toggleHotNot = function(e, hot) {
  if(hot) {
    CINEMOVIES.util.Dom.addClass("hot-toggle", "selected");
    CINEMOVIES.util.Dom.removeClass("not-toggle", "selected");
    
    // show hot divs    
    CINEMOVIES.util.Dom.batch(
      CINEMOVIES.util.Dom.getElementsByClassName("hot", "div", "fantasy-performers"), 
      function(hot_div) { CINEMOVIES.util.Dom.setStyle(hot_div, "display", ""); }
    );
    
    // hide not divs
    CINEMOVIES.util.Dom.batch(
      CINEMOVIES.util.Dom.getElementsByClassName("not", "div", "fantasy-performers"), 
      function(not_div) { CINEMOVIES.util.Dom.setStyle(not_div, "display", "none"); }
    );
  } else {
    CINEMOVIES.util.Dom.addClass("not-toggle", "selected");
    CINEMOVIES.util.Dom.removeClass("hot-toggle", "selected");
    
    // show hot divs    
    CINEMOVIES.util.Dom.batch(
      CINEMOVIES.util.Dom.getElementsByClassName("not", "div", "fantasy-performers"), 
      function(not_div) { CINEMOVIES.util.Dom.setStyle(not_div, "display", ""); }
    );
    
    // hide not divs
    CINEMOVIES.util.Dom.batch(
      CINEMOVIES.util.Dom.getElementsByClassName("hot", "div", "fantasy-performers"), 
      function(hot_div) { CINEMOVIES.util.Dom.setStyle(hot_div, "display", "none"); }
    );
  } 
}




CINEMOVIES.Top.updateScorethinCookie = function (e, i) {

  CINEMOVIES.Top.Cookie.set("scorethin_league", CINEMOVIES.Top.scorethinPanes[i.index].replace('ysp-scorethin-', ''));
}

CINEMOVIES.Top.updateStoriesCookie = function (e, i) {
  CINEMOVIES.Top.SessionCookie.set(i.league + "_stories_tab", i.index);
}
CINEMOVIES.Top.updateLastSearchCookie = function (e) {
  CINEMOVIES.Top.SessionCookie.set("last_search", document.sf1.p.value);
}

CINEMOVIES.Top.updateSearchCookie = function (i) {

  CINEMOVIES.Top.SessionCookie.set("search_tab", i);
}





/* revise the scorethin function */
CINEMOVIES.Top.scorethin = function () {
 //console.log("fired scorethin");
	function setAlternatingGameColor(myGames) {
     for (i = 0; i < myGames.length; i++) {
       var game = myGames[i];
					var className = (i % 2 == 0) ? "odd" : "even";  
					game.className = (game.className.match(/odd|even/)) ?  
						game.className.replace(/(odd|even)/, className) :	game.className+' '+className;
     } 
	} 

	function removeEmptyDate(dateList) {
			if (!dateList.getElementsByTagName('li').length) { 
				dateList.parentNode.parentNode.removeChild(dateList.parentNode);
			}  
	}		
	 
	function removeDuplicateGames() {
	    if ( aRemoveIds && games  ) {			
	      for (var i = games.length - 1; i >= 0; i--) {
	        var game = games[i];
	          for (var j = 0; j < aRemoveIds.length; j++) {
	            if (game.id == aRemoveIds[j]) {
								var thisDate = game.parentNode;							
								thisDate.removeChild(game); removeEmptyDate(thisDate);  
								setAlternatingGameColor(CINEMOVIES.util.Dom.getElementsBy(getGameLis, 'li', thisDate));
								break;
	            }
	          } 	
	      } 
	    } 
	} 
	
	var getGameLis = function(el) {
				return (el.parentNode.className == "game-list") ? true : false;		
	}
	
	if (document.getElementById('my-teams-game-list')) {
		var myTeams = CINEMOVIES.util.Dom.getElementsBy(getGameLis, 'li', document.getElementById('my-teams-game-list') );
	  setAlternatingGameColor(myTeams);
	}
	
	if (document.getElementById('game-list')) {
		var games =	CINEMOVIES.util.Dom.getElementsBy(getGameLis, 'li', document.getElementById('game-list') );
		if (CINEMOVIES.Top.sRemoveIds) {
			var aRemoveIds = CINEMOVIES.Top.sRemoveIds.split( "," );
			removeDuplicateGames();
		}
	}

	
	//if (document.getElementById('date-links')) { // only load this if tabs are in the page
	
			var getDateGameList =	function ( myDate ) {
				switch( myDate.replace(/ /g, '') ) {
					case 'today':
						var on=todaySections; var off=yesterdaySections; var bp='72';
					  break    
					case 'yesterday':
						var on=yesterdaySections; var off=todaySections; var bp='148';									
					  break
					}
					for(i=0;i<on.length;i++) {
						if(on[i] && off[i]) { 
							on[i].style.display = 'block'; 
							off[i].style.display = 'none'; }
					}
/*					document.getElementById('date-links').style.background = 
						'transparent url("http://us.i1.yimg.com/us.yimg.com/i/us/sp/el/scorethin_tab_long_01.gif") no-repeat '+bp+'px 1px'; */
				}	
	
				var setGameListDate = function(e, fnObj ) {
			 		CINEMOVIES.util.Event.preventDefault(e);	
					fnObj( this.innerHTML.toLowerCase() );
			 }	
			 
			 
			var t = document.getElementById('ysp-scorethin-'+CINEMOVIES.Top.scoreboard_tab); //get current sport tabnode 
			uls = CINEMOVIES.util.Dom.getElementsByClassName('date-links', 'ul');
			
			var dateLinks = new Array;
			for (it in uls) {
				dateLinks = dateLinks.concat( CINEMOVIES.util.Dom.getElementsBy(function() { return true; }, 'li', uls[it]) );				
			}
			
			var todaySections = CINEMOVIES.util.Dom.getElementsByClassName('today', 'li');
			var yesterdaySections = CINEMOVIES.util.Dom.getElementsByClassName('yesterday', 'li');
			getDateGameList('today');
			CINEMOVIES.util.Event.addListener(dateLinks, 'click', setGameListDate, getDateGameList );
	//}


	if ( document.getElementById('ysp-scorethin-'+CINEMOVIES.Top.ysp_league) && false) {
			var getMediaLink = function(e) {
			 		CINEMOVIES.util.Event.stopEvent(e);	 
					if (this.href.match('gamechannel')) {
						var win='gcst'; var w=740; var h=600;
					}	else {
						var win='AudioPlayer'; var w=793; var h=527; //window.open(this.href,'AudioPlayer','width=793,height=527');
					}
					//another one? window.open(this.href,'GameChannel','width=40,height=550');
					//window.open(this.href, win,'width='+w+',height='+h+',toolbar=0,left=0,top=0,status=0,resizable=0,scrollbars=0');
		 		}	
				var getMediaLinkList = function(el) {
							return (el.parentNode.className == "media") ? true : (el.innerHTML == 'GameChannel') ? true : false;		
				}
				var mediaLinkList = CINEMOVIES.util.Dom.getElementsBy( getMediaLinkList, 'a', document.getElementById('ysp-scorethin-'+CINEMOVIES.Top.ysp_league) );
				CINEMOVIES.util.Event.addListener( mediaLinkList, 'click', getMediaLink );
	}
	
	//console.log(CINEMOVIES.util.Dom.getElementsByClassName('pane', 'div', document.getElementById('scoreboard') ));
};

CINEMOVIES.Top.sportstreamInit = function (url) {

  var windowName = "playerWindow";
  var windowParams = "width=793,height=666,scrollbars=no,toolbar=no,directories=no,status=no,menubar=no";
  
  var notice = function () {
    var blockerDiv    = document.getElementById('sportstream-blocker');
    var blockerLaunch = document.getElementById('sportstream-blocker-launch');

    var openLaunch =  function(){
      var w = window.open(url,windowName,windowParams);
      blockerDiv.style.display = 'none';
      return false;
    }
  
    blockerDiv.style.display = 'block';

  }

  var result;
  result = window.open(url, windowName, windowParams);

  if ( result == undefined ) {
    CINEMOVIES.util.Event.addListener(window, "load", notice);
  }
}

CINEMOVIES.Top.Cookie = {
	"dc": document,
  a: {},
  c: {},
  site_vals: {},
  "cookie_name" : "spt_site",
  "expire" : 0,

  init: function (){
    this.expire = new Date();
    this.expire.setTime(this.expire.getTime() + 90 * 1000 * 60 * 60 * 24);

    if(this.dc.cookie.length>0){
      this.a = this.dc.cookie.split("; ");
      var cl = this.a.length;
      var ca = [];
      for(var i=cl-1; i>=0; i--){
        var j= this.a[i].indexOf('=');
        if(j===-1) {
          this.c[this.a[i]] = '';
        } else {
          this.c[this.a[i].substr(0,j)] = this.a[i].substr(j+1);
        }
      }
    }
    var site_cookie = unescape(this.c[this.cookie_name]);
    if (site_cookie) {
      if(site_cookie.length > 2) {
        var vals = site_cookie.split("&");
        for(var i = 0; i < vals.length; i++) {
          if (vals[i].type != 'undefined') {
            var t = vals[i].split('=');
            this.site_vals[t[0]] = t[1];
          }
        }
      }
    }
  },

	get: function(n){
    return(this.site_vals[n]) ? unescape(this.site_vals[n]) : null;
  },


	set: function(n,v,p,d,s){
    var today=new Date();
    this.site_vals[n] = v;
    var tv = this.serializeVals();
    var nv = this.cookie_name + "=" + tv;
    
    var str=nv+((this.expire)?"; expires="+this.expire:"")+((p)?"; path="+p:"")+((d)?"; domain="+d:"")+((s)?"; secure":"");
    if((n.length>0&&tv.length>0)&&(((this.expire)&&(this.expire>today))||(!this.expire))&&(nv.length<4000)){
      this.dc.cookie=str;
      this.a[this.a.length]=nv;
      this.c[n]=v;
      return 1;
    }
    else return 0;
	},

	remove: function(n,p,d){
		if(this.c[n]){
			this.dc.cookie=n+"="+((p)?"; path="+p:"")+((d)?"; domain="+d:"")+"; expires=Thu, 01-Jan-1970 00:00:01 GMT";
			for(var i=this.a.length-1;i>=0;i--){
        if(this.a[i].indexOf(n)!=-1)
          this.a.splice(i,1);
      }
      this.c[n]=null;
      return 1;
		}
    else return 0;
	},

  serializeVals: function () {
    var i = 0;
    var ret = new Array();
    for (var j in this.site_vals) {
      if (j && typeof(j) != 'undefined' && j != 'undefined') {
        ret[i] = escape(j + "=" + this.site_vals[j]);
        i++;
      }
    }
    return ret.join("&");
  }
}

CINEMOVIES.Top.SessionCookie = {
	"dc": document,
  a: {},
  c: {},
  site_vals: {},
  "cookie_name" : "spt_site_sess",
  "expire" : 0,

  init: function (){

    if(this.dc.cookie.length>0){
      this.a = this.dc.cookie.split("; ");
      var cl = this.a.length;
      var ca = [];
      for(var i=cl-1; i>=0; i--){
        var j= this.a[i].indexOf('=');
        if(j===-1) {
          this.c[this.a[i]] = '';
        } else {
          this.c[this.a[i].substr(0,j)] = this.a[i].substr(j+1);
        }
      }
    }
    var site_cookie = unescape(this.c[this.cookie_name]);
    if (site_cookie) {
      if(site_cookie.length > 2) {
        var vals = site_cookie.split("&");
        for(var i = 0; i < vals.length; i++) {
          if (vals[i].type != 'undefined') {
            var t = vals[i].split('=');
            this.site_vals[t[0]] = t[1];
          }
        }
      }
    }
  },

	get: function(n){
    return(this.site_vals[n]) ? unescape(this.site_vals[n]) : null;
  },


	set: function(n,v,p,d,s){
    var today=new Date();
    this.site_vals[n] = v;
    var tv = this.serializeVals();
    var nv = this.cookie_name + "=" + tv;
    
    var str=nv+((this.expire)?"; expires="+this.expire:"")+((p)?"; path="+p:"")+((d)?"; domain="+d:"")+((s)?"; secure":"");
    if((n.length>0&&tv.length>0)&&(((this.expire)&&(this.expire>today))||(!this.expire))&&(nv.length<4000)){
      this.dc.cookie=str;
      this.a[this.a.length]=nv;
      this.c[n]=v;
      return 1;
    }
    else return 0;
	},

	remove: function(n,p,d){
		if(this.c[n]){
			this.dc.cookie=n+"="+((p)?"; path="+p:"")+((d)?"; domain="+d:"")+"; expires=Thu, 01-Jan-1970 00:00:01 GMT";
			for(var i=this.a.length-1;i>=0;i--){
        if(this.a[i].indexOf(n)!=-1)
          this.a.splice(i,1);
      }
      this.c[n]=null;
      return 1;
		}
    else return 0;
	},

  serializeVals: function () {
    var i = 0;
    var ret = new Array();
    for (var j in this.site_vals) {
      if (j && typeof(j) != 'undefined' && j != 'undefined') {
        ret[i] = escape(j + "=" + this.site_vals[j]);
        i++;
      }
    }
    return ret.join("&");
  }
}

CINEMOVIES.Top.flashdetect = {
	control: function()
	{
		var oF = navigator.plugins["Shockwave Flash"] || new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
		return (oF) ? 1 : 0;
	},

	version: function()
	{
		var oF;
		var v = null;
		if (navigator.plugins && navigator.mimeTypes.length)
		{
			oF = navigator.plugins["Shockwave Flash"];

			if (oF && oF.description)
			{
				v = oF.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")[0];
			}
		}
		else if (window.ActiveXObject)
		{
			var vb = '<scr' + 'ipt language=vbscript type=text/vbscript\> \n';
			vb += 'Function VBGetSwfVer(i) \n';
			vb += 'on error resume next \n';
			vb += 'Dim swControl, swVersion \n';
			vb += 'swVersion = 0 \n';

			vb += 'set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i)) \n';
			vb += 'if (IsObject(swControl)) then \n';
			vb += 'swVersion = swControl.GetVariable("$version") \n';
			vb += 'end if \n';
			vb += 'VBGetSwfVer = swVersion \n';
			vb += 'End Function \n';
			vb += '<\/scr' + 'ipt\>';

			document.write(vb);

			for (i=25;i>0;i--)  v =	VBGetSwfVer(i);

			if(v != 0 && v!= null ) v = v.split(",")[0].split(" ")[1];
		}
		return parseInt(v);
	}
};

CINEMOVIES.Top.Cookie.init();
CINEMOVIES.Top.SessionCookie.init();
/**
 * DTK Carousel Component.
 * @description http://twiki.corp.CINEMOVIES.com/view/Media/DTKDaemonManager
 **/

(function(){

var $U = CINEMOVIES.util;
var $D = $U.Dom;
var $C = $U.CustomEvent;
var DTK = CINEMOVIES.namespace('Media.Dtk');
CINEMOVIES.namespace('Media.Dtk.util');

/**
 * spawn {function}
 * This function creates an object of type "cls", constructed with arguments in the "args" array.
 * spawn : new :: apply : call
 * Note: even though this function is private, you can still arbitrarily spawn unmanaged daemons using the public spawnDaemon method.
 * @private
 * @param cls {Class} The function constructor to use.
 * @param args {Array} The arguments to pass to the constructor.
 **/
var spawn = function(cls,args) {
	if(!args) args = [];
	else if(!args instanceof Array) args = [args];
	var f=function(){};
	f.prototype=cls.prototype;
	f.prototype.constructor = cls;
	var obj = new f();
	cls.apply(obj,args);
	return obj;
};

/**
 * CINEMOVIES.Media.Dtk.util.Manager
 * Daemon Manager Constructor
 * @public
 * @param daemonClass {Class} The constructor that will be used to create daemons.
 * If this daemonClass does not implement the getId or toString functions, or an "id" property, then generic versions will be added.
 **/
DTK.util.Manager = function(daemonClass) {

	var idCounter = [0];
	var p=daemonClass.prototype;
	
	if(typeof p.getId !== 'function') {
		p.getId = function(){
			if(this.id) {
				return this.id;
			}
			return (this.id = 'daemon_'+(idCounter[0]++));
		};
	}
	if(typeof p.toString !== 'function') {
		p.toString = function() {
			return 'Daemon ' + this.getId();
		};
	}
	/**
	 * onCreate {CustomEvent}
	 * Event that fires whenever a daemon is spawned.
	 * @privileged
	 **/
	this.onCreate = new $C('create',this);
	/**
	 * onDaemonEvent {CustomEvent}
	 * Event that fires whenever any daemon's custom event of any sort fires.
	 * As far as the listener is concerned, it will be just as if it was listening to the actual event that fired.
	 * @privileged
	 **/
	this.onDaemonEvent = new $C('daemonEvent'); // actual event time at firing time will likely be different.
	/**
	 * daemonClass
	 * The class that's used for daemons.
	 * @public
	 **/
	this.daemonClass = daemonClass;
	
	/**
	 * unload {function}
	 * A function to help with memory management in IE; called on window.unload.
	 * If daemonClass implements an unload method, then all managed daemons will be unloaded.
	 * Then the references to the daemons are nulled.
	 * @private
	 **/
	var unload = function(e){
		var s=this.stack;
		for(var i=s.length-1; i>-1; i--) {
			if(s[i]) {
				s[i].manager = null;
				if(typeof(s[i].unload) == 'function') {
					s[i].unload();
				}
				this.daemons[s[i].getId()] = null;
				s[i] = null;
			}
		}
	};
	$U.Event.addListener(window,'unload',unload,this,true);
};
DTK.util.Manager.prototype={
	/**
	 * daemons {object}
	 * A collection of all the managed daemons.  manager.daemons[daemon.getId()] == daemon
	 * @public
	 **/
	daemons:{},
	/**
	 * stack {Array}
	 * An array of all the managed daemons.  (Refers to the same objects as the daemons collection.)
	 * @public
	 **/
	stack:[],
	/**
	 * daemonEvents {Object}
	 * If any daemon implements any CustomEvents, then a correllary CustomEvent is created as a pass-through.
	 * As a result, assigning a listener to manager.daemonEvents.onFoo is the same as assigning a listener to all of the managed daemons' onFoo event.
	 * @public
	 **/
	daemonEvents:{},
	
	/**
	 * spawnDaemon {Function}
	 * method to create a daemon object.  Fires the onCreate event.
	 * manager.spawnDaemon('a','b') is equivalent to new manager.daemonClass('a','b'), except that the onCreate event will be fired.
	 * @params {Optional} Any parameters passed to this function will be sent to the daemon constructor.
	 * @public
	 **/
	spawnDaemon:function() {
		var obj = spawn(this.daemonClass,arguments)
		this.onCreate.fire(obj);
		return obj;
	},
	/**
	 * idString {String}
	 * String that identifies what kind of manager this object is.  Designed to be overwritten by the classes that extend the Manager class.
	 * @public
	 **/
	idString:'Generic Daemon Manager', // designed to be overwritten in classes that extend the Manager class.
	/**
	 * toString {function}
	 * Method to identify this object.  Uses the idString property.
	 * @public
	 **/
	toString:function(){
		var s=[this.idString,'{\n'];
		for(var c in this.daemons) {
			if(this.daemons[c] instanceof this.daemonClass) {
				s.push('\t',c,' : (',this.daemons[c].toString(),')\n');
			}
		}
		s.push('}');
		return s.join('');
	},
	/**
	 * init {Function}
	 * Create a single daemon and manage it.
	 * @params {Optional} Any parameters sent to this function will be passed to the daemon constructor.
	 * @return A reference to the created daemon object.
	 **/
	init:function() {
		var d=this.spawnDaemon.apply(this,arguments);
		
		if(d && d.manager != this) {
			var onDaemonEvent = this.onDaemonEvent;
			d.manager = this;
			this.daemons[d.getId()] = d;
			this.stack.push(d);
			for(var e in d){
				// walk through all the daemon's properties looking for customevents to watch for.
				// this implements a "bubbling" sort of functionality.
				if(d[e] instanceof $C) {
					if(!this.daemonEvents[e]) {
						this.daemonEvents[e]=new $C(d[e].type);
					}
					var evMgr = this.daemonEvents[e];
					var fn=function(type,data){
						// fire the manager's version of the child event, and the onDaemonEvent, as if they were the ones that happened in the first place -- same scope, same type, same everything.
						evMgr.scope=this;
						evMgr.fire.apply(evMgr,data);
						onDaemonEvent.scope=this;
						onDaemonEvent.type=type;
						onDaemonEvent.fire.apply(onDaemonEvent,data);
					};
					d[e].subscribe(fn);
				}
			}
		}
		return d;
	},
	/**
	 * initAll {Function}
	 * Run init() a bunch of times.
	 * Note: often overridden or extended in classes that extend the Manager class.
	 * @param finder {Function} Function that returns an array of objects that can be sent as the first argument to the daemon constructor.  For example, it could be a function that returns an array of DOM nodes.
	 * @params {Optional} Additional parameters are passes as additional arguments to the daemon constructor function.
	 * @return An array of references to the created daemon objects.
	 **/
	initAll:function(finder) {
		if(typeof(finder) != 'function') return [];
		var things = finder();
		var ret = [];
		var len = things.length;
		var args = [null];
		var arglen=arguments.length;
		for(var i=1;i<arglen;i++) {
			args.push(arguments[i]);
		}
		for(var i = 0; i < len; i++) {
			args[0] = things[i];
			var d=this.init.apply(this, args);
			if(d) {
				ret.push(d);
			}
		}
		return ret;
	},
	/**
	 * getDaemonById {Function}
	 * Get a reference to a certain daemon by its ID.
	 * @param id {string || HTMLElement} The ID of the daemon, or an HTML element with an id that is the id of the daemon.
	 * @return A reference to the daemon, or null if not found.
	 **/
	getDaemonById:function(id) {
		if(id.id) return this.getDaemonById(id.id);
		return this.daemons[id] || null;
	}
};

})();/**
 * DTK Carousel Component.
 * @description http://twiki.corp.CINEMOVIES.com/view/Media/DTKCarousel
 * @requires DTK Manager Utility
 **/

// keep out of global scope.
(function() {

// shorthand
var $U=CINEMOVIES.util;
var $D=$U.Dom;
var $E=$U.Event;
var $S=$U.Scroll;
var DTK=CINEMOVIES.namespace('Media.Dtk');

var Carousel; // varred here, but defined inside its own scope.  This is the line in.
(function(){

// private static methods used by DTK.Carousel
/**
 * addPageIndicators Method
 * @description Adds the links to individual pages
 * @private
 * @param C {Carousel Object} Reference to the carousel that is getting set up.
 **/
var addPageIndicators=function() {
	
	// check to see if there's already one there.  If so, we're going to enslave its babies.
	var n=$D.getElementsByClassName('scrollnav','div',this.getElement());
	n=n[0] || document.createElement('div');
	n.className='scrollnav';
	
	removeNavLinks.call(this);
	
	var p=this.pages.length;
	for(var x=0;x<p;x++){
		var a=this.navLinks[x] || document.createElement('a');
		// a.href='#pg:'+(x+1);
		a.index=x;
		a.carousel=this;
		a.onmousedown=a.onclick=this.scrollTo_click;
		if(x==this.current) {
			a.className='current';
		}
		n.appendChild(a);
		this.navLinks[x]=a;
	}
	
	var s=this.scrollBody;
	s.parentNode.insertBefore(n,s);
	return;
};

/**
 * removeNavLinks Method
 * @description Clears out the navLinks array.  Called by unload, and also by addPageIndicators if pages were removed by an ajax call.
 * @private
 * @param C {Carousel Object} Reference to the carousel whose navLinks are getting yanked out.
 **/
var removeNavLinks=function() {
	if(this.navLinks) {
		for(var j=this.navLinks.length-1;j>-1;j--) {
			var a=this.navLinks[j];
			if(a) {
				a.onclick=null;
				a.onmousedown=null;
				a.onmouseup=null;
				a.carousel=null;
			}
			a=null;
			this.navLinks[j]=null;
	//		delete this.navLinks[j];
		}
	}
	this.navLinks=[];
};
	
/**
 * addNavButtons Method
 * @description Adds the next/prev page indicators.
 * @private
 * @param C {Carousel Object} Reference to the carousel that is getting set up.
 **/
var addNavButtons=function() {
	// create prev/next links, if they haven't already been done.
	if(this.prev || this.next) return;
	var p=document.createElement('a'), n=p.cloneNode(true);
	
	var i=this.getElement().id;
	
	// n.href=p.href="#"+i;
	
	// add appropriate classes to each
	p.className="prev";
	n.className="next";
	
	// insert nodes into dom before <div class="scrollbody">
	var s=this.scrollBody;
	s.parentNode.insertBefore(p, s);
	s.parentNode.insertBefore(n, s);
	
	// add handlers
	p.onmousedown=p.onclick=this.scrollPrev_click;
	n.onmousedown=n.onclick=this.scrollNext_click;
	
	this.prev=p;
	this.next=n;
	n.carousel=p.carousel=this;
	s=null;
};
/**
 * updateNavState Method
 * @description Update the state of the page/prev/next links.
 * @private
 * @param C {Carousel Object} Reference to the carousel that is getting updated.
 **/
var updateNavState=function() {
	// get # of pages
	var l = this.navLinks.length;
	
	// update page indicator styles
	for (var x=0; x<l; x++) {
		if(x == this.current) {
			this.navLinks[x].className='current';
		} else {
			this.navLinks[x].className='';
		}
	}
	// update button styles
	if(this.current == 0 && !this.roundRobin){
		// first page (left inactive)
		$D.addClass(this.prev,'off');
		//$D.setStyle(this.prev,'opacity',0.6);
		$D.removeClass(this.next,'off');
		//$D.setStyle(this.next,'opacity',1);
		$D.setStyle(this.next,'cursor','')
		$D.setStyle(this.prev,'cursor','default')
	}else if(this.current == (l-1) && !this.roundRobin){
		// last page (right inactive)
		$D.removeClass(this.prev,'off');
		//$D.setStyle(this.prev,'opacity',1);
		$D.addClass(this.next,'off');
		//$D.setStyle(this.next,'opacity',0.6);
		$D.setStyle(this.prev,'cursor','')
		$D.setStyle(this.next,'cursor','default')
	} else {
		// all other pages (all active)
		$D.removeClass(this.prev,'off');
		//$D.setStyle(this.prev,'opacity',1);
		$D.removeClass(this.next,'off');
		//$D.setStyle(this.next,'opacity',1);
		$D.setStyle(this.next,'cursor','')
		$D.setStyle(this.prev,'cursor','')
	}
};
/**
 * clickHandler method
 * @description Creates an event handler which can be assigned to a carousel A tag.  Used to create the scrollNext_click, scrollPrev_click, and scrollTo_click methods.
 * @private
 * @param whichFn {String} The name of the member function of the Carousel object to call, if appropriate.  Note: Not a function--send in the NAME of a function as a string.
 * @param fnFailure {Function} In addition to !a and !a.carousel, additional failure cases can be specified.  This function is called with the A tag passed as an arg.  If it returns True, then the carousel operation is aborted and normal behavior is used.
 * @param fnArgs {Function} This function can be specified to send additional arguments to the carousel function.  The A tag is passed as an argument, and the return value is sent to fnWhich.
 **/
var clickHandler=function(whichFn,fnFailure,fnArgs) {
	return function(e) {
		e=e||window.event;
		fnFailure=fnFailure || function(){return false;};
		fnArgs=fnArgs || function(){};
		var a=$E.getTarget(e);
		if(!a || !a.carousel || fnFailure(a)) {
			return true;
		}
		if(!a.didMouseDown) {
			// do the stuff, only the first time.
			a.carousel.autoPlay=false;
			a.carousel[whichFn](fnArgs(a));
		} else {
			// if we got a mousedown, then this is click, and it's time to blur.
			// flag will be reset on the next line.
			a.blur();
		}
		// record or reset.
		a.didMouseDown=(e.type=='mousedown');
		// break reference to prevent the leak.
		a=null;
		$E.stopEvent(e);
		return false;
	};
};

Carousel = function(el,args) {
	
	/**
	 * self-reference.
	 * @private
	 **/
	var me=this;
	/**
	 * currentScroll property
	 * Stores the current position of the scroller.
	 * @private
	 **/
	var currentScroll=0;
	/**
	 * getCurrentScroll method
	 * @return {Number} the current position of the scroller.
	 * @privileged
	 **/
	this.getCurrentScroll=function() {
		return currentScroll;
	};
	/**
	 * ontween Animation onTween handler.
	 * Used to keep track of the scrollLeft property of the scrollBody.
	 * @private
	 **/
	var ontween=function(e,data){
		// this is faster than just looking it up from the DOM.
		currentScroll=this.anim.doMethod('scroll', this.animAttrs.scroll.from, this.animAttrs.scroll.to)[0];
	};
	
	/**
	 * oncomplete Animation onComplete handler.
	 * Fires the onPageChange event.
	 * @private
	 **/
	var oncomplete=function(e,data){
		// only fire if it actually finished.
		if(data[0].duration >= this.animDur) {
			data=data[0];
			data.carousel=this;
			var _toString=data.toString;
			data.toString = function(){ return _toString() + ', current page:' + this.carousel.current; };
			//data.toString=function(){return this.time.getTime()+' duration:'+this.duration+', frames:'+this.frames+', fps:'+this.fps+', carousel:'+this.carousel.toString();};
			this.onPageChange.fire(data);
		}
	};
	/**
	 * onclick Method
	 * Attached to click event of scrollBody
	 * Through event bubbling, fires whenever an element in the scrolling body is clicked, unless event is caught and killed before bubbling up.
	 * fires the onClick event.
	 * @private
	 **/
	var onclick=function(e) {
		this.onClick.fire(e);
	};
	/**
	 * element Object
	 * Reference to the root of the Carousel element.
	 * Accessible via the privileged getElement() method.
	 * @private
	 **/
	var _element=null;
	
	/**
	 * getElement prototype method
	 * @privileged
	 * @return {HTMLElement | null} The root element of the Carousel.
	 * @description Note: The element is not set until init is called.
	 **/
	this.getElement=function() {
		return _element;
	};
	/**
	 * init Method
	 * @param el { String | HTMLElement } ID of or reference to the root element of the carousel
	 * @param args { Object } Name-value pair of any public member items that should be replaced.  For example, you send it {easeMethod:CINEMOVIES.util.easeNone,animDur:2} to overwrite the default easing method and animation duration.
	 *  With great power comes great responsibility!
	 * @description Typically called by CarouselMgr.init or CarouselMgr.initAll.
	 * @privileged
	 **/
	this.init=function(el,args) {
		el=$D.get(el);
		if(el) {
			_element=el;
		}
		$D.generateId(el,'carousel_');
		s = $D.getElementsByClassName('scrollbody','div',el)[0];
		
		if(typeof(args) == 'object') {
			for(var i in args) {
				this[i]=args[i];
			}
		}
		
		
		var me=this;
		var list = this.pages = $D.getElementsBy(function(el) { return me.pageFinder(el); },this.pageTagName,el);
		var len = list.length;
		
		if(!el || !s || !len) {
			return false;
		}
		
		// set up the exposed variables that don't exist pre-init.
		this.onScrollStart=new $U.CustomEvent('scrollstart',this);
		this.onPageChange=new $U.CustomEvent('scrollcomplete',this);
		this.onClick=new $U.CustomEvent('click',this);
		this.onAutoPlayStart=new $U.CustomEvent('autoplaystart',this);
		this.onAutoPlayStop=new $U.CustomEvent('autoplaystop',this);
		
		var r = $D.getRegion(list[0]);		// get region of first item, as all "page" items should be same width
		this.scrollDistance = r.right - r.left;			// width of first "page" item
		
		this.scrollBody = s;
		$E.addListener(s,'click',onclick,this,true);
		
		// set some styles here to make carousels less rude to the myBar
		var h=$D.getRegion(s);
		h=(h.bottom-h.top)+'px';
		s.parentNode.style.height=h;
		s.style.height=h;
		s.style.position='absolute';
		//s.style.overflow='auto';
		var p=$D.getElementsByClassName('scrollpages','div',s)[0];
		p.style.width=(len * this.scrollDistance * 1.0)+'px';
		p.style.position='absolute';
		
		// http://bug.corp.CINEMOVIES.com/show_bug.cgi?id=832779
		// figure out what page we're REALLY on (which will usually be 0), and then go there.
		// this needs to be down here, because the browser won't get the right values unless the styles and heights above are set.
		// This is the ONLY time that we manually read the scrollLeft property, since this tends to be very sluggish to read in Mozilla.
		var sl = Math.round(s.scrollLeft / this.scrollDistance);
		if(sl < 0) sl = 0;
		else if(sl >= this.pages.length) sl = this.pages.length-1;
		this.current = sl;
		
		
		this.scrollBody.scrollLeft = currentScroll = sl * this.scrollDistance;
		
		this.anim=new $S(this.scrollBody , this.animAttrs, this.animDur, this.easeMethod);
		this.anim.onTween.subscribe(ontween,this,true);
		this.anim.onComplete.subscribe(oncomplete,this,true);
		
		if( len > 1 ){
			// only add nav buttons and page indicators if more than one page
			addNavButtons.call(this);
			addPageIndicators.call(this);
			updateNavState.call(this);
		} else this.navLinks=[];
		list=s=null;
		return true;
	};
	
	
	/**
	 * autoPlayTimeOut
	 * @private
	 * Recording the timeout ID so that it can be cleared when autoplay is stopped.
	 **/
	var autoPlayTimeOut=0;
	/**
	 * autoPlayFn {null | Function}
	 * @private
	 * @description Function that actually switches the card.  Set as a timeout by autoPlayer.
	 **/
	var autoPlayFn=function(){
		me.autoPlay= (me.autoPlayDirection>0)?me.scrollNext():me.scrollPrev();
	};
	/**
	 * autoPlaySubscribed {Boolean}
	 * True if autoPlayer has subscribed to the onPageChange event.
	 * @private
	 **/
	var autoPlaySubscribed=false;
	/**
	 * autoPlayer {Function}
	 * @private
	 * @description The autoPlay workhorse.  Sets up the proper things based on the value of this.autoPlay.
	 **/
	var autoPlayer=function() {
		clearTimeout(autoPlayTimeOut);
		
		// check to see if it's going to fail before it does.
		// this ends autoplay as soon as it's known that it will stop.
		if(me.autoPlay && !me.roundRobin && (me.current == me.pages.length-1 && me.autoPlayDirection > 0 || me.autoPlayDirection <= 0 && me.current == 0) ) {
			me.autoPlay = false;
		}
		
		if(!me.autoPlay) {
			// stop if running.  Unsubscribe.
			me.onPageChange.unsubscribe(autoPlayer);
			autoPlaySubscribed=false;
			me.onAutoPlayStop.fire(me.current);
		} else {
			/*
			1. In me.autoPlayDur seconds, call autoPlayFn
			2. This scrolls next or prev.
			3. When the scrolling is done, it triggers the onPageChange event.
			4. This calls autoPlayer.  (Goto step 1.)
			*/
			if(!autoPlaySubscribed) {
				autoPlaySubscribed=true;
				me.onPageChange.subscribe(autoPlayer);
				autoPlayFn();
			} else {
				autoPlayTimeOut=window.setTimeout(autoPlayFn,me.autoPlayDur*1000);
			}
		}
	};
	/**
	 * autoPlayStart method
	 * @description Starts the autoPlay
	 * @privileged
	 **/
	this.autoPlayStart=function() {
		if(!this.autoPlay) {
			this.onAutoPlayStart.fire(this.current);
		}
		this.autoPlay=true;
		autoPlayer();
	};
	/**
	 * autoPlayStop method
	 * @description Stops the autoPlay
	 * @privileged
	 **/
	this.autoPlayStop=function() {
		this.autoPlay=false;
		autoPlayer();
	};
	
	/**
	 * getData method
	 * @description Called to make an ajax call for the rest of a collection.  It expects that the data to be found at url will be a JSON string of the form [{pgIdx:<page number>, pgHtml:<html of the page>},{...},...]
	 * @param url {String} url to request
	 * @param postExecute {Function} function to call after elements have been loaded 
	 * @privileged
	 **/
	this.getData = function(url,postExecute) {
		var id=this.getId();
		var me=this;
		var s = function() { me.getDataSuccess.apply(me,arguments); };
		var f = function() { me.getDataFailure.apply(me,arguments); };
		var callback = {
			success: s,
			failure: f,
			argument: {
				postExecute:postExecute
			}
		};
		var oConObj = $U.Connect.asyncRequest('GET',url,callback,null);
	};
	
    /**
	 * getDataSuccess method
	 * @description Called upon successful execution of ajax call
	 * @privileged
	 **/
	this.getDataSuccess = function(o) {
		if(o.responseText){
			var sText = o.responseText;
			/*
			* remove any comments that might have been added, 
			* yapache shouldn't send them if the header is application/x-json,
			* but you never know 
			*/
			sText = sText.replace(/<\!--.+-->/gim,'');
			// instantiate json
			var oArr = eval('(' + sText + ')');
			// loop through end of array
			var createdPages = false, removedPages=false;
			if( oArr ){
				var numPages = this.pages.length;
				var len=oArr.length;
				for(var i=0;i<len;i++){
					var pg = oArr[i].pgIdx;
					var html = oArr[i].pgHtml;
					var page;
					if(pg < numPages && pg >= 0){
						page=this.pages[pg];
					} else {
						// page is out of bounds.
						// make a new one.
						var p=this.pages[numPages-1];
						page = p.cloneNode(false);
						p.parentNode.appendChild(page);
						this.pages[numPages++]=page;
						createdPages=true;
					}
					page.innerHTML=html;
					if(oArr[i].attributes) {
						for(var a in oArr[i].attributes) {
							page.setAttribute(a,oArr[i].attributes[a]);
						}
					}
				}
				// trim the pages that didn't get data, if there are any.
				while(i < numPages) {
					this.pages[i].parentNode.removeChild(this.pages[i]);
					delete this.pages[i];
					removedPages = true;
					i++;
				}
				
				// now we might need to re-do the navLinks.
				if(createdPages || removedPages) {
					addPageIndicators.call(this);
				}
			}
			
			//if a "postExecute" function is passed in, execute it.
			if (o.argument.postExecute) {
				o.argument.postExecute();
			}
		}
	};
	
	/**
	 * getDataFailure method
	 * @description Called when getData call returns an error
	 * @privileged
	 **/
	this.getDataFailure = function(o) {
		// stub func
	};
	
	/**
	 * An unload handler that releases all elements and breaks any circular links caused by this object.
	 * Called by the CarouselMgr on page unload.
	 * @privileged
	 **/
	this.unload = function() {
		if(!this.navLinks){this.navLinks = [];}
		this.navLinks.push(_element, this.prev, this.next, this.scrollBody, this.anim);
		removeNavLinks.call(this);
		for(var j=this.pages.length-1;j>-1;j--) {
			this.pages[j]=null;
		}
	};
	
	/**
	 * animAttrs
	 * @public
	 * Attributes passed to the animation object.
	 **/
	this.animAttrs={
		scroll:{
			from:[0,0],
			to:[0,0]
		}
	};
	
	// initialize this carousel.
	if(el)this.init(el,args);
};

Carousel.prototype = {
	/**
	 * pageFinder { Function }
	 * Passed to Dom.getElementsBy to define what a "page" is.
	 * Defaults to getting by className of this.pageClassName
	 * @public
	 **/
	pageFinder:function(el) {
		return $D.hasClass(el,this.pageClassName);
	},
	/**
	 * pageTagName { String }
	 * Passed to Dom.getElementsBy to define what a "page" is.  This speeds up the grabbing of pages.
	 * @default 'div'
	 * @public
	 **/
	pageTagName:'div',
	/**
	 * pageClassName {String}
	 * Passed to dom.getElementsBy to define what a "page" is.  This is the className that is searched for by default.
	 * Note that if pageFinder is overwritten, then this might not have any effect.
	 * @public
	 * @default scrollpage
	 **/
	pageClassName:'scrollpage',
	
	/**
	 * easeMethod
	 * Easing method to be used by animation.
	 * @default CINEMOVIES.util.Easing.easeOut
	 * @public
	 **/
	easeMethod:$U.Easing.easeOut,
	/**
	 * roundRobin
	 * Whether or not this carousel can go around in circles.
	 * @public
	 **/
	roundRobin:false,
	/**
	 * animDur
	 * duration of the animation, in seconds.
	 * @public
	 * @default 1.5 seconds
	 **/
	animDur:1.5,
	/**
	 * autoPlayDur
	 * @public
	 * The duration in seconds that autoplay should switch the card.
	 **/
	autoPlayDur:5,
	/**
	 * onScrollStart
	 * {Object CustomEvent} Event that occurs when the scrolling starts.
	 * @public
	 **/
	 onScrollStart:null,
	 /**
	  * onPageChange
	 * {Object CustomEvent} Event that occurs when the scrolling completes.
	 * @public
	 **/
	onPageChange:null,
	 /**
	  * onClick
	 * {Object CustomEvent} Event that occurs when the contents of the carousel are clicked.
	 * @public
	 **/
	onClick:null,
	
	/**
	 * autoPlayDirection
	 * {Number} The direction that autoPlay should cycle.  Positive for "next," negative for "prev"
	 * @public
	 * @default 1
	 **/
	autoPlayDirection:1, // set to negative for previous scrolling.
	/**
	 * onAutoPlayStart
	 * {CustomEvent} Event that fires when the autoplay starts.
	 * @public
	 **/
	onAutoPlayStart:null,
	/**
	 * onAutoPlayStop
	 * {CustomEvent} Event that fires when autoplay stops.
	 * @public
	 **/
	onAutoPlayStop:null,
	
	/**
	 * scrollTo Method
	 * @param index {Integer} The index of the page to scroll to.
	 * @public
	 * @description Scrolls to a given "index" (page numbers, starting with 0)  Called by scrollNext and scrollPrev.
	 **/
	scrollTo:function(index) {
		// this is an exposed function, so deal with bad arg.
		// do nothing if:
			// index is null or undefined
			// index is too big or too small (and not roundRobin)
			// index refers to the current page
		if(this.roundRobin) {
			if(index < 0) {
				index=this.pages.length-1;
			} else if(index >= this.pages.length) {
				index=0;
			}
		}
		if((!index && index !== 0) || index >= this.pages.length || index < 0 || index == this.current) {
			return false;
		}
		
		if(this.anim.isAnimated()) {
			this.anim.stop();
		}
		
		this.onScrollStart.fire({to:index,from:this.current,toString:function(){return 'from:'+this.from+', to:'+this.to;}});
		
		// set the destination.
		var end=index * this.scrollDistance;
		this.animAttrs.scroll.from=[this.getCurrentScroll(),0];
		this.animAttrs.scroll.to=[end,0];
		this.current=index;
		updateNavState.call(this);
		
		// set the attributes each time so that we can take into consideration changes that may occur to the exposed object.
		this.anim.attributes=this.animAttrs;
		this.anim.duration = this.animDur;
		
		// this setTimeout makes it work properly in Firefox, by making it asynchronous.
		var a=this.anim;
		window.setTimeout(function(){a.animate();},0);
		//a.animate();
		return true;
	},
	/**
	 * scrollNext Method
	 * @public
	 * @description Scrolls to the next page.
	 **/
	scrollNext : function() {
		var ret=this.scrollTo(this.current+1);
		return ret;
	},
	/**
	 * scrollNext_click Method
	 * @public
	 * @description Scrolls to the next page.  If attached to the click and mousedown events, it will handle keyboard and mouse events properly and accessibly.
	 * <p>Usage: var a=CINEMOVIES.util.Dom.get('nextpagelink'); a.carousel=CINEMOVIES.Media.Dtk.CarouselMgr.init('dtk-car-0'); a.onclick=a.carousel.scrollNext_click; </p>
	 **/
	scrollNext_click : clickHandler('scrollNext'),
	/**
	 * scrollNext Method
	 * @public
	 * @description Scrolls to the previous page.
	 **/
	scrollPrev : function() {
		var ret= this.scrollTo(this.current-1);
		return ret;
	},
	/**
	 * scrollPrev_click Method
	 * @public
	 * @description Scrolls to the prev page.  If attached to the click and mousedown events, it will handle keyboard and mouse events properly and accessibly.
	 * <p>Usage: var a=CINEMOVIES.util.Dom.get('prevpagelink'); a.carousel=CINEMOVIES.Media.Dtk.CarouselMgr.init('dtk-car-0'); a.onclick=a.carousel.scrollPrev_click; </p>
	 **/
	scrollPrev_click:clickHandler('scrollPrev'),
	/**
	 * scrollTo_click Method
	 * @public
	 * @description Scrolls to a given next page.  If attached to the click and mousedown events, it will handle keyboard and mouse events properly and accessibly.
	 * <p>Usage: var a=CINEMOVIES.util.Dom.get('page2link'); a.index=2; a.carousel=CINEMOVIES.Media.Dtk.CarouselMgr.init('dtk-car-0'); a.mousedown=a.onclick=a.carousel.scrollTo_click; </p>
	 **/
	scrollTo_click:clickHandler('scrollTo',function(el){return (!el.index && el.index!==0);},function(el){return el.index;}),
	/**
	* toString method
	* @return {String} string represenation of carousel obj
	*/
	toString:function(){
		var el=this.getElement();
		if(el) {
			return 'Carousel #'+el.id+' .'+el.className;
		} else {
			return 'Carousel [Not Initiated]';
		}
		el=null;
	},
	/**
	 * getId methods
	 * @public
	 * @description Returns the ID of the carousel's root element.
	 * Used by the CarouselMgr to identify individual Carousel daemons.
	 **/
	getId:function(){
		return this.getElement().id;
	}
}

})(); // end of the Carousel scope.


(function(){ // begin scope for CarouselMgr.
/**
 * CarouselMgr
 * @class Singleton for managing Carousel Widgets
 * <p>Usage: CINEMOVIES.Media.Dtk.CarouselMgr.init("myDtkElement");</p>
 * @requires CINEMOVIES.util.Scroll
 * @requires CINEMOVIES.util.Dom
 * @requires CINEMOVIES.util.Event
 * @requires Carousel
 **/
var CarouselMgr = function(){
	CarouselMgr.superclass.constructor.call(this,Carousel);
};
CINEMOVIES.extend(CarouselMgr,DTK.util.Manager);
/**
 * Method to init all carousels that have a certain className
 * @privileged
 * @param cls { String } The className that designates a carousel element. Defaults to "carousel"
 * @param args { Object } Optional.  Arguments passed to Carousel.init()
 * @return Collection of all carousels created by this method.
 **/
CarouselMgr.prototype.initAll = function(cls,args){
	return CarouselMgr.superclass.initAll.call(this, function(){ return $D.getElementsByClassName(cls||'carousel','div',document);}, args);
};
CarouselMgr.prototype.getCarousel = CarouselMgr.prototype.getDaemonById;
CarouselMgr.prototype.idString='Carousel Manager';

DTK.CarouselMgr = new CarouselMgr();

})(); // end of the CarouselMgr scope



})();var console = window.console || {};
//console.log = console.log || function(t) { document.title = t };
console.log = console.log || function(t) {  };

/*

Sally Carson: for the Fantasy nav drop down, in the "Fantasy Games" section down below, can we test out putting 2 really long game names next to each other? Here are the longest ones: College Football Pick'em  and  Fantasy Football Plus
Sally Carson: to see if having them side by side is too wide for the drop down?

*/
CINEMOVIES.Top.navInit = function() {

  if (!document.getElementById || !document.getElementsByTagName || !CINEMOVIES.Top.nav_flyouts) return;

	var timer = false;
	var current_fo = false;
	var open_msec = 125;
	var close_msec = 250;
	var sep_width = 9;
	var hit = null;		
	var outside_check = null;
	var fe = false;
	
	var bread = document.getElementById('yse-bread');
	var ft = document.createElement('div'); ft.className = "ft";			
	var fo = document.createElement('div'); fo.className = "yse-flyout"; ft.appendChild(fo);			
	var fo_hd = document.createElement('div'); fo_hd.className = "hd"; fo.appendChild(fo_hd);	fo_hd.appendChild(document.createElement('span'));	
	var fo_bd = document.createElement('div'); fo_bd.className = "bd"; fo.appendChild(fo_bd);				 	
	var fo_ft = document.createElement('div'); fo_ft.className = "ft"; fo.appendChild(fo_ft);			
	bread.appendChild(ft);		

	var bread_crumbs = CINEMOVIES.util.Dom.getElementsBy( function() { return true; }, 'em', bread);	
	if (bread_crumbs.length > 1) {
    bread_crumbs.pop(); //forgeddabout the last one
	}

	var getHijackedLink = function(e, obj) {  // hijack link if its clicked in the triangle areas
		CINEMOVIES.util.Event.preventDefault(e);	
		var hit = CINEMOVIES.util.Event.getTarget(e);
		if (outsideHitArea(e, hit)) { 
			hit = getNextBread(hit); 
		}	
		closeFlyout(e);
		window.location = hit.parentNode.href;
	}

	
	
	var outsideHitArea = function(e, hit) { // check to see where we hit in our mouse over
			
			var r = CINEMOVIES.util.Dom.getRegion(hit);
			
			var a = {x: (r.right-sep_width), y : r.top};
			var b = {x: r.right, y : (r.top+(hit.clientHeight/2))};
			var c = {x: (r.right-sep_width), y : r.bottom };
			var d = {x: CINEMOVIES.util.Event.getPageX(e), y : CINEMOVIES.util.Event.getPageY(e) };
		
			var next = Math.max( ((d.x-a.x)*(b.y-a.y)-(d.y-a.y)*(b.x-a.x)) , ((d.x-b.x)*(c.y-b.y)-(d.y-b.y)*(c.x-b.x)) ) ;
	
			return (Math.abs(next) == next) ? true : false;  //not negative returns true, we are outside acceptable hit area
	} 

	
	var getNextBread = function(hit) { // return next hit node when outside a hit area
		hit.parentNode.style.textDecoration = 'none'; //kill underline on actual mouseover node
		return hit.parentNode.nextSibling.nextSibling.firstChild;	
	}
	
	
	
	var checkWhileInsideCrumb = function(e, hit) {
		//if (CINEMOVIES.util.Event.isIE) { hit.style.cursor = 'pointer'; }
/*
       cursor: pointer;
       cursor: hand;
*/

		if (outsideHitArea(e, hit)) { //outside: need to adjust for next fo
			if (CINEMOVIES.util.Event.getTarget(e).parentNode.className == 'last-previous-sibling') {
				closeFlyout(e);	 return false;   	//if second to last node and out of the arrow node then cancel  
			}			
			hit = getNextBread(hit); //move hit to next node
		}	 				
	 paintFlyout(hit);	
	}
		
	var getFlyout =  function(e) {		// mouseover has hit one:
		var h = CINEMOVIES.util.Event.getTarget(e, 1);
		outside_check = CINEMOVIES.util.Event.addListener(h, "mousemove", checkWhileInsideCrumb, h ); // start mousemove that checks for exact mouse position
	}
		
	var paintFlyout =  function(hit) {	//set up hidden flyout					
		if (timer) window.clearTimeout(timer); timer = false; //somethin happened, kill current close or open timer
		if (hit.nodeName != 'EM') { return; } //return if not an em crumb
		if ((fo.style.display && fo.style.display == 'block') && (current_fo == hit.parentNode)) return; //return if correct fo is open		

		fo.style.display = 'none'; // OK we need to refresh: hide first	
			
		var i = bread_crumbs.length-1;	// we already skipped the final breadcrumb	
		do { //loop through breadcrumbs
			
			bread.getElementsByTagName('em')[i].parentNode.style.textDecoration = 'none';
			
			if ( bread.getElementsByTagName('em')[i].parentNode == hit.parentNode  ) { //matched mouseover id  
			
				hit.parentNode.style.textDecoration = 'underline';
				hit.parentNode.style.color = '#FFF';	//simulate the a:hover				
		
				while( fo_bd.hasChildNodes() ) { fo_bd.removeChild( fo_bd.lastChild ); } //killall nav nodes
				if(CINEMOVIES.util.Event.isIE) removeIeTransparentPNG();
				
				var data = CINEMOVIES.Top.nav_flyouts.aNav[i];  //JSON data
				
				var h5 = document.createElement('h5');	//header
				h5.innerHTML = ( !i ) ? 'CINEMOVIES! Top' : '<a href="'+data[0].url+'">'+data[0].txt+'</a>';
				fo_bd.appendChild(h5);
				fo_bd.className = (!i) ? 'bd sports-home' : 'bd';
				
				var menu = document.createElement('ul');	//list			
				var j = data.length-1;
				var last = true; 
				do {
					var li = document.createElement('li');
					li.innerHTML = '<a href="'+data[j].url+'">'+data[j].txt+'</a>';
					if ( !i ) li.className = (j %2) ? 'even' : 'odd'; //!i == first breadcrumb flyout,  has 2 col floated list
					if (!i || j ) menu.insertBefore(li, menu.firstChild); //first breadcrumb flyout has hard coded header, the other breads moved first link to header
					if (!i && last ) li.className = li.className + ' last'; 
					if (last) last = false;
				} while (j--);
				fo_bd.style.width = '';	// unset width
				fo_bd.appendChild(menu);
							

				
				var offset = (!i) ? 0 : 14; //offset for sports home
	 			timer = setTimeout(function() {openFlyout(hit, offset); timer = false;}, open_msec);	//delayed opening
								
			} 
		} while (i--);
	};		
			

	
	
	var openFlyout = function(hit, offset) {	//display fo after the delay
		current_fo = hit.parentNode;
		
		if (!fo.style.display || fo.style.display == 'none' ) fo.style.display = 'block';
		
		var pos = CINEMOVIES.util.Dom.getRegion(hit);					
		
		switch(current_fo) {
			case fan_hit: // fantasy flyout 
				//TODO: if there has been a resize, the fantasy flyout is wrong		
				fo_bd.style.width = '';
				CINEMOVIES.util.Dom.setXY(ft, [pos.right-fo.offsetWidth, pos.bottom]);			
				break;
			default: 
				if(CINEMOVIES.util.Event.isIE) offset = offset-4;
				if(CINEMOVIES.util.Event.isSafari) offset = offset+9;		
										
				CINEMOVIES.util.Dom.setXY(ft, [pos.left-offset, pos.bottom]);		
				
				if ( (ft.clientWidth-35) < (hit.offsetWidth-9) ) {	//resize if flyout is wider than crumb
					fo_bd.style.width = (CINEMOVIES.util.Event.isIE) ? (hit.offsetWidth+1)+'px' : (hit.clientWidth-30)+'px';
				} 
				
				break;
		}

		
		//console.log(CINEMOVIES.util.Event.isIE);
		//if(CINEMOVIES.util.Event.isIE) //IE need to take control of the cursor here
		//hit.style.cursor = 'pointer';
		
		if(CINEMOVIES.util.Event.isIE) addIeTransparentPNG(); // IE needs additional elements for shadows
				
	};
	
	
	
	var closeFlyout = function(e) {
		if (timer) clearTimeout(timer);
		var h = CINEMOVIES.util.Event.getTarget(e, 1);
		outside_check = CINEMOVIES.util.Event.removeListener(h, "mousemove", checkWhileInsideCrumb, h );
		CINEMOVIES.util.Event.getTarget(e).parentNode.style.textDecoration = 'none';
		if (fo.style.display == 'block') {
	 		timer = setTimeout(function() {fo.style.display = 'none'; removeIeTransparentPNG(); timer = false; current_fo = false;}, close_msec);  
		}
	};
	
	
	var fantasyFlyout  = function(e) { //build hidden fantasy fo

		var h = CINEMOVIES.util.Event.getTarget(e);
		
		if (timer) window.clearTimeout(timer); timer = false; //kill current close or open timer		
		if (!CINEMOVIES.Top.nav_flyouts.fNav) return;
		
		if (h.nodeName != 'A') { return; } //return if not fantasy a
		if ((fo.style.display && fo.style.display == 'block') && (current_fo == h.parentNode)) return; //return if correct fo is open		
		
		fo.style.display = 'none';
	
		try { //if curl/fantasy data is bad prevent JS errors in IE
		
			var data = CINEMOVIES.Top.nav_flyouts.fNav;  //JSON data						
			
			while( fo_bd.hasChildNodes() ) { fo_bd.removeChild( fo_bd.lastChild ); } //killall nav nodes
			if(CINEMOVIES.util.Event.isIE) removeIeTransparentPNG();
	
			fo_bd.className = 'bd fantasy';
			
			if (CINEMOVIES.Top.nav_flyouts.fNav.my_teams.ul.length) {			
				var mt_h5 = document.createElement('h5');								
				mt_h5.innerHTML = data.my_teams.h5;
				fo_bd.appendChild(mt_h5);
			
				var mt = document.createElement('ul');// my-teams list
				mt.className = 'my-teams';	
				var i = data.my_teams.ul.length-1; 
				do {
					var g = data.my_teams.ul[i]; // game type header
					var li = document.createElement('li'); 
					li.innerHTML = '<h6><a href="' + g.g_url + '">'+g.game+'</a></h6>';
					
					var tl = document.createElement('ul'); // team-league list
					var j = g.teams.length-1; 
					do {
						var t_li = document.createElement('li'); 
						t_li.className = 'team'; 
						t_li.innerHTML = '<a href="'+g.teams[j].t_url+'">'+g.teams[j].team+'</a>';
						t_li.innerHTML += (g.teams[j].league  && g.teams[j].l_url) ? ' - <a class="league" href="'+g.teams[j].l_url+'">'+g.teams[j].league+'</a>' : '';							
						tl.insertBefore(t_li, tl.firstChild);							
					} while (j--);
					li.appendChild(tl);
					mt.appendChild(li);	//mt.insertBefore(li, mt.firstChild);
				
					if (!i && CINEMOVIES.Top.nav_flyouts.fNav.more_link) {
						var li = document.createElement('li'); 
						li.innerHTML = '<h6><a href="http://fantasysports.CINEMOVIES.com/">See All of My Teams &raquo;</a></h6>';
						mt.appendChild(li);
					}
					
					if (!i) li.className = 'last';	
	
				} while (i--);
				
				fo_bd.appendChild(mt);
			}
		} catch (e) {
					//TODO: log JSON errors so we can debug fan/curl problems?
			
		} finally {
		  var og_h5 = document.createElement('h5');	//other games header
      og_h5.innerHTML = data.other_games.h5;
      fo_bd.appendChild(og_h5);
			
			var og = document.createElement('div');	//other games list			
      og.innerHTML = data.other_games.text;
			fo_bd.appendChild(og);
			
		 timer = setTimeout(function() {openFlyout(h, 0); timer = false;}, open_msec);	//delayed opening
			
	 }	// end try

	}
	
	
	/* set listeners */
	CINEMOVIES.util.Event.addListener(bread_crumbs, "mouseover", getFlyout, this); //start individual mousemove on mouseover
	CINEMOVIES.util.Event.addListener(bread_crumbs, "mouseout", closeFlyout, this); //set close timer
 	
	CINEMOVIES.util.Event.addListener(fo, "mouseover", paintFlyout, this); //just kill close timer and return
	CINEMOVIES.util.Event.addListener(fo, "mouseout", closeFlyout, this); //set close timer 
		
	CINEMOVIES.util.Event.addListener(bread.getElementsByTagName('em'), "click", getHijackedLink, this);
	
	var fan_hit = CINEMOVIES.util.Dom.getElementsByClassName('last', 'li', document.getElementById('yse-sub-nav'))[0];
	//f_hit = f_hit.getElementsByTagName('a')[0];
	//console.log(f_hit.innerHTML);
	
	CINEMOVIES.util.Event.addListener(fan_hit, "mouseover", fantasyFlyout, this);
	CINEMOVIES.util.Event.addListener(fan_hit, "mouseout", closeFlyout, this);			


	
	
	
	
	
		
	
/* IE only stuff */
	var addIeTransparentPNG  = function() {
		if ( document.getElementById('yse-flyout-ie-rt')   ) removeIeTransparentPNG();

		var fly = CINEMOVIES.util.Dom.getElementsByClassName('yse-flyout')[0];
		var hd =  CINEMOVIES.util.Dom.getElementsByClassName('hd', 'div', fly)[0];
		
		var ie_lt = document.createElement('div'); 
		ie_lt.id = "yse-flyout-ie-lt"; 
		ft.appendChild(ie_lt); 

		var ie_lt_crnr = document.createElement('div'); 
		ie_lt_crnr.id = "yse-flyout-ie-lt-crnr"; 
		hd.appendChild(ie_lt_crnr); 

		var ie_rt = document.createElement('div'); 
		ie_rt.id = "yse-flyout-ie-rt"; 
		ft.appendChild(ie_rt);			
		
		var h = fly.parentNode.clientHeight; 
		h = (h%2) ? h-1 : h;
		document.getElementById('yse-flyout-ie-rt').style.height = h;
		document.getElementById('yse-flyout-ie-lt').style.height = h;

		var w = fly.parentNode.clientWidth;	

		w = (w%2) ? w-27 : w-26;
		w = ( navigator.userAgent.search('MSIE 7') != -1) ? w : w+5;

		fly.getElementsByTagName('span')[0].style.width = w;
		
		//hide page form elements/flash when fo is over them: IE
		if (!bread.getElementsByTagName('iframe')[0]) {
			var ifr = document.createElement('iframe');
			ifr.style.width= fly.parentNode.clientWidth-12;
			ifr.style.height= fly.parentNode.clientHeight;				
			bread.appendChild(ifr);
			var loc = CINEMOVIES.util.Dom.getXY(fo);
			CINEMOVIES.util.Dom.setXY( ifr, [loc[0]+4, loc[1]] );			
		}

	}
	
	var removeIeTransparentPNG  = function() {
		if (bread.getElementsByTagName('iframe')[0]) {
			bread.removeChild(bread.getElementsByTagName('iframe')[0]);
		}		
	
		if ( !document.getElementById('yse-flyout-ie-rt')  && 
					!document.getElementById('yse-flyout-ie-lt') && 
					!document.getElementById('yse-flyout-ie-lt-crnr') ) return; 
	
		if (document.getElementById('yse-flyout-ie-rt')){
			var fly = document.getElementById('yse-flyout-ie-rt').parentNode;
			 fly.removeChild( document.getElementById('yse-flyout-ie-rt')  );
			if (document.getElementById('yse-flyout-ie-lt')) fly.removeChild( document.getElementById('yse-flyout-ie-lt')  );
		}
		
		if (document.getElementById('yse-flyout-ie-lt-crnr')) {
			var fly_hd = document.getElementById('yse-flyout-ie-lt-crnr').parentNode;		
			fly_hd.removeChild( document.getElementById('yse-flyout-ie-lt-crnr')  );
		}
	}	
/* /IE only stuff */
		
};

//sports.init call moved to YSENavUtil

