function InitialiseWidgetRotator(n,t,i,r){var h=parseInt(r),o=parseInt(i),u=jQuery("#"+n),f=jQuery(t,u),s=f.length,e=0;if(s==0)return!1;u.css({overflow:"hidden",position:"relative",height:u.height()});f.each(function(){var n=jQuery(this);n.css({position:"absolute",top:"0px",left:o==RotatorTransitionEffect_Swipe?u.width():0,display:o==RotatorTransitionEffect_FadeOut?"none":"block",width:u.width()});e=n.outerHeight()>e?n.outerHeight():e});f.hide();typeof RotatorOffset!="undefined"&&(e=e+RotatorOffset);u.height(e);RotatorArray.push({ID:n,Canvas:u,WidgetSerialNo:h,Items:f,ItemWidth:jQuery(f[0]).width(),CurrentIndex:f.length>1?Math.floor(Math.random()*(s+1)):1,ItemCount:s,IsUpdating:!1,IsPaused:!1,TransitionEffect:o==undefined?RotatorTransitionEffect_Swipe:o});UpdateRotator(n,!0);RotatorsInitialised||(RotatorsInitialised=!0,SetAutoRotate());jQuery(".PageContainer").hide().show()}function SetAutoRotate(){for(j=0;j<RotatorArray.length;j++)UpdateRotator(RotatorArray[j].ID,!1);setTimeout(SetAutoRotate,1e4)}function UpdateRotator(n,t){var i=GetRotatorIndexByID(n),u,r;RotatorArray[i].Items.length<=1&&!t||RotatorArray[i].IsUpdating||RotatorArray[i].IsPaused||(u=RotatorArray[i].Canvas.width(),r=RotatorArray[i].CurrentIndex,RotatorArray[i].CurrentIndex=RotatorArray[i].CurrentIndex+1>=RotatorArray[i].ItemCount?0:RotatorArray[i].CurrentIndex+1,RotatorArray[i].IsUpdating=!0,RotatorArray[i].TransitionEffect==RotatorTransitionEffect_Swipe?(jQuery(RotatorArray[i].Items[RotatorArray[i].CurrentIndex]).css("left",u).show(),jQuery(RotatorArray[i].Items[r]).animate({left:-RotatorArray[i].ItemWidth},500,function(){jQuery(this).hide()}),jQuery(RotatorArray[i].Items[RotatorArray[i].CurrentIndex]).animate({left:0},500,function(){var n=GetRotatorIndexByID(jQuery(this).parent().attr("ID"));RotatorArray[n].IsUpdating=!1;UpdateOverridingRotatorTitleAndDescription(RotatorArray[n])})):RotatorArray[i].TransitionEffect==RotatorTransitionEffect_FadeOut&&(jQuery(RotatorArray[i].Items[r]).fadeOut(500),jQuery(RotatorArray[i].Items[RotatorArray[i].CurrentIndex]).fadeIn(500,function(){var n=GetRotatorIndexByID(jQuery(this).parent().attr("ID"));RotatorArray[n].IsUpdating=!1;UpdateOverridingRotatorTitleAndDescription(RotatorArray[n])})))}function UpdateOverridingRotatorTitleAndDescription(n){var r=n.Items[n.CurrentIndex],t=jQuery('input[class*="WidgetTitleOverride_"]',r).val(),i=jQuery('input[class*="WidgetDescriptionOverride_"]',r).val();t!=""&&t!=null&&t!=undefined&&jQuery("#WidgetTitle_"+n.WidgetSerialNo).text(t);i!=""&&i!=null&&i!=undefined&&jQuery("#WidgetDescription_"+n.WidgetSerialNo).text(i)}function RotatorPause(n){RotatorArray[GetRotatorIndexByID(n)].IsPaused=!0}function RotatorResume(n){RotatorArray[GetRotatorIndexByID(n)].IsPaused=!1}function GetRotatorIndexByID(n){for(x=0;x<RotatorArray.length;x++)if(RotatorArray[x].ID==n)return x}var RotatorArray=new Array(0),RotatorsInitialised=!1,RotatorTransitionEffect_FadeOut=1,RotatorTransitionEffect_Swipe=2