var imageRotator=function(){
var dBF=4000,sT=60,hID=250,cCN,llId,ilId,aC,oCR,T=null,R=null,S=null,cO,nO,lL,iL,lA,iA;
function addLoadEvent(f){var o=window.onload;if(typeof window.onload!='function'){window.onload=f;}else{window.onload=function(){if(o){o();}f();};}}
function $id(id){return(document.getElementById(id)?document.getElementById(id):false);}
function setOpacity(id,op){var o=$id(id).style;o.opacity=op/100;o.MozOpacity=op/100;o.KhtmlOpacity=op/100;o.filter="alpha(opacity="+op+")";}
function postFade(fromId,toId){$id(fromId).className=$id(fromId).className.replace(cCN,'');$id(toId).style.zIndex='0';clearTimeout(T);T=null;}
function fadeImageIn(fromObj,toObj){if(fromObj.id===toObj.id){return;}if(T===null){setOpacity(toObj.id,0);toObj.style.zIndex="3";toObj.className=toObj.className+" "+cCN;for (var k=0;k<lA.length;k++){if(lA[k].className.match(toObj.id)){if(!lA[k].className.match(' '+cCN)){lA[k].className=lA[k].className+' '+cCN;}}else{lA[k].className=lA[k].className.replace(' '+cCN,'');}}for (var c=1;c<11;c++){T=setTimeout("imageRotator.setOpacity('"+toObj.id+"',0+"+c*10+")",sT*c);}T=setTimeout("imageRotator.postFade('"+fromObj.id+"','"+toObj.id+"')",(sT*c)+5);}}
function stopAuto(){clearInterval(R);R=null;}
function autoRotate(){if(T===null){var lis=iL.getElementsByTagName('li');if(lis){for (var j=0;j<lis.length;j++){if(lis[j].className.match(cCN)){cO=lis[j];break;}}var next=cO.id.replace('h','');if(next>=lis.length-1){next=0;}else{next++;}var nextId="h"+next;var nO=$id(nextId);fadeImageIn(cO,nO);}}}
function resumeAuto(){clearTimeout(S);if(R===null){R=setInterval(autoRotate,dBF);}}
function changeImage(cn){stopAuto();if(T===null){var lis=iL.getElementsByTagName('li');if(lis){for (var j=0;j<lis.length;j++){if(cn.match(lis[j].id)){nO=lis[j];}if(lis[j].className.match(cCN)){cO=lis[j];}}fadeImageIn(cO,nO);}}}
function hoverIntent(){S=setTimeout("imageRotator.changeImage('"+this.className+"')",hID);}
function linkClicked(){return oCR;}
function init(){aC=arguments[0]?arguments[0]:true;oCR=arguments[1]?arguments[1]:false;ilId=arguments[2]?arguments[2]:"imagesList";llId=arguments[3]?arguments[3]:"linksList";cCN=arguments[4]?arguments[4]:"current";addLoadEvent(function(){lL=$id(llId);iL=$id(ilId);if(lL&&iL){iA=iL.getElementsByTagName('a');lA=lL.getElementsByTagName('a');if(lA&&iA){for (var i=0;i<lA.length;i++){lA[i].onmouseover=hoverIntent;lA[i].onfocus=hoverIntent;lA[i].onmouseout=resumeAuto;lA[i].onblur=resumeAuto;lA[i].onclick=linkClicked;}resumeAuto();for (i=0;i<iA.length;i++){iA[i].onmouseover=stopAuto;iA[i].onmouseout=resumeAuto;iA[i].onfocus=stopAuto;iA[i].onblur=resumeAuto;}}}});}
return{init:init,setOpacity:setOpacity,postFade:postFade,changeImage:changeImage};
}();
imageRotator.init(true,false,"imagesList","linksList","current");
