////////////////////////////////////////////////////////////////////////////////// // CloudCarousel V1.0.4 // (c) 2010 by R Cecco. // MIT License // // Reflection code based on plugin by Christophe Beyls // // Please retain this copyright header in all versions of the software ////////////////////////////////////////////////////////////////////////////////// (function($){function Reflection(a,b,c){var d,cntx,imageWidth=a.width,imageHeight=a.width,gradient,parent;parent=$(a.parentNode);if($.browser.msie){this.element=d=parent.append("").find(':last')[0];d.src=a.src;d.style.filter="flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+(c*100)+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+(b/imageHeight*100)+")"}else{this.element=d=parent.append("").find(':last')[0];if(!d.getContext){return}cntx=d.getContext("2d");try{$(d).attr({width:imageWidth,height:b});cntx.save();cntx.translate(0,imageHeight-1);cntx.scale(1,-1);cntx.drawImage(a,0,0,imageWidth,imageHeight);cntx.restore();cntx.globalCompositeOperation="destination-out";gradient=cntx.createLinearGradient(0,0,0,b);gradient.addColorStop(0,"rgba(255, 255, 255, "+(1-c)+")");gradient.addColorStop(1,"rgba(255, 255, 255, 1.0)");cntx.fillStyle=gradient;cntx.fillRect(0,0,imageWidth,b)}catch(e){return}}$(d).attr({'alt':$(a).attr('alt'),title:$(a).attr('title')})}var s=function(a,b){this.orgWidth=a.width;this.orgHeight=a.height;this.image=a;this.reflection=null;this.alt=a.alt;this.title=a.title;this.imageOK=false;this.options=b;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 t=function(o,p,q){var r=[],funcSin=Math.sin,funcCos=Math.cos,ctx=this;this.controlTimer=0;this.stopped=false;this.container=o;this.xRadius=q.xRadius;this.yRadius=q.yRadius;this.showFrontTextTimer=0;this.autoRotateTimer=0;if(q.xRadius===0){this.xRadius=($(o).width()/2.3)}if(q.yRadius===0){this.yRadius=($(o).height()/6)}this.xCentre=q.xPos;this.yCentre=q.yPos;this.frontIndex=0;this.rotation=this.destRotation=Math.PI/2;this.timeDelay=1000/q.FPS;if(q.altBox!==null){$(q.altBox).css('display','block');$(q.titleBox).css('display','block')}$(o).css({position:'relative',overflow:'hidden'});$(q.buttonLeft).css('display','inline');$(q.buttonRight).css('display','inline');$(q.buttonLeft).bind('mouseup',this,function(a){a.data.rotate(-1);return false});$(q.buttonRight).bind('mouseup',this,function(a){a.data.rotate(1);return false});if(q.mouseWheel){$(o).bind('mousewheel',this,function(a,b){a.data.rotate(b);return false})}$(o).bind('mouseover click',this,function(a){clearInterval(a.data.autoRotateTimer);var b=$(a.target).attr('alt');if(b!==undefined&&b!==null){clearTimeout(a.data.showFrontTextTimer);$(q.altBox).html(($(a.target).attr('alt')));$(q.titleBox).html(($(a.target).attr('title')));if(q.bringToFront&&a.type=='click'){var c=$(a.target).data('itemIndex');var d=a.data.frontIndex;var e=c-d;a.data.rotate(-e)}}});$(o).bind('mouseout',this,function(a){var b=a.data;clearTimeout(b.showFrontTextTimer);b.showFrontTextTimer=setTimeout(function(){b.showFrontText()},1000);b.autoRotate()});$(o).bind('mousedown',this,function(a){a.data.container.focus();return false});o.onselectstart=function(){return false};this.innerWrapper=$(o).wrapInner('
').children()[0];this.showFrontText=function(){if(r[this.frontIndex]===undefined){return}$(q.titleBox).html($(r[this.frontIndex].image).attr('title'));$(q.altBox).html($(r[this.frontIndex].image).attr('alt'))};this.go=function(){if(this.controlTimer!==0){return}var a=this;this.controlTimer=setTimeout(function(){a.updateAll()},this.timeDelay)};this.stop=function(){clearTimeout(this.controlTimer);this.controlTimer=0};this.rotate=function(a){this.frontIndex-=a;this.frontIndex%=r.length;this.destRotation+=(Math.PI/r.length)*(2*a);this.showFrontText();this.go()};this.autoRotate=function(){if(q.autoRotate!=='no'){var a=(q.autoRotate==='right')?1:-1;this.autoRotateTimer=setInterval(function(){ctx.rotate(a)},q.autoRotateDelay)}};this.updateAll=function(){var a=q.minScale;var b=(1-a)*0.5;var w,h,x,y,scale,item,sinVal;var c=(this.destRotation-this.rotation);var d=Math.abs(c);this.rotation+=c*q.speed;if(d<0.001){this.rotation=this.destRotation}var e=r.length;var f=(Math.PI/e)*2;var g=this.rotation;var j=$.browser.msie;this.innerWrapper.style.display='none';var k;var l='px',reflHeight;var m=this;for(var i=0;i>0;if(item.reflection!==null){reflHeight=q.reflHeight*scale;k=item.reflection.element.style;k.left=x+l;k.top=y+h+q.reflGap*scale+l;k.width=w+l;if(j){k.filter.finishy=(reflHeight/h*100)}else{k.height=reflHeight+l}}}g+=f}this.innerWrapper.style.display='block';if(d>=0.001){this.controlTimer=setTimeout(function(){m.updateAll()},this.timeDelay)}else{this.stop()}};this.checkImagesLoaded=function(){var i;for(i=0;i