var mys=0;e=0;function changeimgend(){var w=0;$(".history .frame img").each(function(i){if($(this).width()>w){w=$(this).width();e=i}});$(".history .frame img").eq(e).css("opacity",1)}function changeimgstart(direction){e=e-direction;if(e>=$(".history .frame img").size()){e=0}if(e<0){e=$(".history .frame img").size()-1}$(".history .frame img").css("opacity",0.5);$(".history .frame img").eq(e).css("opacity",1);$(".des").animate({scrollLeft:1003*e});$(".label em").text($(".history .frame img").eq(e).attr("title"))}(function($){function Reflection(img,reflHeight,opacity){var reflection,cntx,imageWidth=img.width,imageHeight=img.width,gradient,parent;parent=$(img.parentNode);this.element=reflection=parent.append("").find(":last")[0];if(!reflection.getContext&&/msie/.test(navigator.userAgent.toLowerCase())){this.element=reflection=parent.append("").find(":last")[0];reflection.src=img.src;reflection.style.filter="flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+(opacity*100)+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+(reflHeight/imageHeight*100)+")"}else{cntx=reflection.getContext("2d");try{$(reflection).attr({width:imageWidth,height:reflHeight});cntx.save();cntx.translate(0,imageHeight-1);cntx.scale(1,-1);cntx.drawImage(img,0,0,imageWidth,imageHeight);cntx.restore();cntx.globalCompositeOperation="destination-out";gradient=cntx.createLinearGradient(0,0,0,reflHeight);gradient.addColorStop(0,"rgba(255, 255, 255, "+(1-opacity)+")");gradient.addColorStop(1,"rgba(255, 255, 255, 1.0)");cntx.fillStyle=gradient;cntx.fillRect(0,0,imageWidth,reflHeight)}catch(e){return}}$(reflection).attr({"alt":$(img).attr("alt"),title:$(img).attr("title")})}var Item=function(imgIn,options){this.orgWidth=imgIn.width;this.orgHeight=imgIn.height;this.image=imgIn;this.reflection=null;this.alt=imgIn.alt;this.title=imgIn.title;this.imageOK=false;this.options=options;this.imageOK=true;if(this.options.reflHeight>0){this.reflection=new Reflection(this.image,this.options.reflHeight,this.options.reflOpacity)}$(this.image).css("position","absolute")};var Controller=function(container,images,options){var items=[],funcSin=Math.sin,funcCos=Math.cos,ctx=this;var obji=0,innera=$("#posterTvGrid .inner a"),sizea=innera.size()-1;this.controlTimer=0;this.stopped=false;this.container=container;this.xRadius=options.xRadius;this.yRadius=options.yRadius;this.showFrontTextTimer=0;this.autoRotateTimer=0;if(options.xRadius===0){this.xRadius=($(container).width()/2.3)}if(options.yRadius===0){this.yRadius=($(container).height()/6)}this.xCentre=options.xPos;this.yCentre=options.yPos;this.frontIndex=0;this.rotation=this.destRotation=Math.PI/2;this.timeDelay=1000/options.FPS;if(options.altBox!==null){$(options.altBox).css("display","block");$(options.titleBox).css("display","block")}$(container).css({position:"relative",overflow:"hidden"});$(options.buttonLeft).css("display","inline");$(options.buttonRight).css("display","inline");$(options.buttonLeft).bind("mouseup",this,function(event){obji++;if(obji>sizea){obji=0}innera.find("p").hide();innera.eq(obji).find("p").show();event.data.rotate(-1);return false});$(options.buttonRight).bind("mouseup",this,function(event){obji--;if(obji<0){obji=sizea}innera.find("p").hide();innera.eq(obji).find("p").show();event.data.rotate(1);return false});innera.eq(0).find("p").show();innera.eq(0).siblings().find("p").hide();if(options.mouseWheel){$(container).bind("mousewheel",this,function(event,delta){if(delta>1||delta<-1){return false}if(delta>=1){obji++;if(obji>sizea){obji=0}innera.find("p").hide();innera.eq(obji).find("p").show()}if(delta<=-1){obji--;if(obji<0){obji=sizea}innera.find("p").hide();innera.eq(obji).find("p").show()}event.data.rotate(-delta);return false})}$(container).bind("mouseover click",this,function(event){clearInterval(event.data.autoRotateTimer);var text=$(event.target).attr("alt");if(text!==undefined&&text!==null){clearTimeout(event.data.showFrontTextTimer);$(options.altBox).html(($(event.target).attr("alt")));$(options.titleBox).html(($(event.target).attr("title")));if(options.bringToFront&&event.type=="click"){var idx=$(event.target).parent().children().data("itemIndex");var frontIndex=event.data.frontIndex;var diff=(idx-frontIndex)%images.length;if(Math.abs(diff)>images.length/2){diff+=(diff>0?-images.length:images.length)}event.data.rotate(-diff)}}});$(container).bind("mouseout",this,function(event){var context=event.data;clearTimeout(context.showFrontTextTimer);context.showFrontTextTimer=setTimeout(function(){context.showFrontText()},10);context.autoRotate()});$(container).bind("mousedown",this,function(event){event.data.container.focus();return false});container.onselectstart=function(){return false};this.innerWrapper=$(container).wrapInner('
').children()[0];this.showFrontText=function(){if(items[this.frontIndex]===undefined){return }$(options.titleBox).html($(items[this.frontIndex].image).attr("title"));$(options.altBox).html($(items[this.frontIndex].image).attr("alt"))};this.go=function(){if(this.controlTimer!==0){return}var context=this;this.controlTimer=setTimeout(function(){context.updateAll()},this.timeDelay)};this.stop=function(){clearTimeout(this.controlTimer);this.controlTimer=0;if(mys==0){changeimgend()}mys=0};this.rotate=function(direction){this.frontIndex-=direction;this.frontIndex%=items.length;this.destRotation+=(Math.PI/items.length)*(2*direction);this.showFrontText();this.go();if(mys==0){changeimgstart(direction)}mys=0};this.autoRotate=function(){if(options.autoRotate!=="no"){var dir=(options.autoRotate==="right")?1:-1;this.autoRotateTimer=setInterval(function(){ctx.rotate(dir)},options.autoRotateDelay)}};this.updateAll=function(){var minScale=options.minScale;var smallRange=(1-minScale)*0.5;var w,h,x,y,scale,item,sinVal;var change=(this.destRotation-this.rotation);var absChange=Math.abs(change);this.rotation+=change*options.speed;if(absChange<0.001){this.rotation=this.destRotation}var itemsLen=items.length;var spacing=(Math.PI/itemsLen)*2;var radians=this.rotation;var isMSIE=/msie/.test(navigator.userAgent.toLowerCase());this.innerWrapper.style.display="none";var style,canversprev;var px="px",reflHeight;var context=this;for(var i=0;i>0;if(item.reflection!==null){reflHeight=options.reflHeight*scale;style=item.reflection.element.style;canversprev=item.reflection.element.previousSibling.style;style.left=x+px;style.top=y+h+options.reflGap*scale+px;style.width=w+px;canversprev.left=x+px;canversprev.top=y+h+options.reflGap*scale+px;canversprev.width=w+px;if(isMSIE){style.filter.finishy=(reflHeight/h*100)}else{style.height=reflHeight+px}}}radians+=spacing}this.innerWrapper.style.display="block";if(absChange>=0.001){this.controlTimer=setTimeout(function(){context.updateAll()},this.timeDelay)}else{this.stop()}};this.checkImagesLoaded=function(){var i;for(i=0;i