var LINK_NORMAL_COLOR="#333333";var LINK_NORMAL_BACKGROUND_COLOR="#FFFFFF";var LINK_SHOWING_COLOR="#1A376F";var LINK_SHOWING_BACKGROUND_COLOR="#FF9900";var LINK_HOVER_COLOR="#CC3300";var PLAY_BUTTON_ON="images/play-b-on.gif";var PLAY_BUTTON_OFF="images/play-b-off.gif";var PAUSE_BUTTON_ON="images/pause-b-on.gif";var PAUSE_BUTTON_OFF="images/pause-b-off.gif";var divElements=null;var links=new Array();var currentlyShowing=0;var dummyDiv=null;var tm=null;var timerRunning=false;var delay=7;var playPause=false;function rotateBanners(rb,height,width,dl,pp)
{playPause=pp;delay=dl;var bannerDivIds=new Array();divElements=rb.getElementsByTagName("div");linkDiv=document.createElement("div");for(var j=0;j<divElements.length;j++)
{var currentDiv=divElements[j];var bannerId='banner-'+j;bannerDivIds[j]=bannerId;currentDiv.id=bannerId;currentDiv.style.display='none';var l=document.createElement("a");l.onclick=function(){showBanner(this);};l.id=j;l.appendChild(document.createTextNode(j+1));links[j]=l;l.style.fontSize='14px';l.style.fontWeight='bold';l.style.cursor='pointer';l.style.paddingLeft='2px';l.style.paddingRight='2px';l.onmouseover=function(){changeColor(this,"MOUSE_OVER");};l.onmouseout=function(){changeColor(this,"MOUSE_OUT");};linkDiv.appendChild(l);if((j!=(divElements.length-1))||playPause)
{var sp=document.createElement("span");sp.appendChild(document.createTextNode(" | "));linkDiv.appendChild(sp);}
linkDiv.style.border='1px solid cccccc';}
if(playPause)
{linkDiv.appendChild(createToggleButton());}
linkDiv.style.textAlign='left';linkDiv.style.color=LINK_NORMAL_COLOR;linkDiv.style.paddingLeft='4px';linkDiv.style.paddingTop='0px';linkDiv.style.backgroundColor='#FFFFFF';rbInner=document.createElement("div");rbInner.id="rotational-banner-inner";dummyDiv=document.createElement("div");dummyDiv.style.height=height+'px';dummyDiv.id='banner-dummy';rbInner.appendChild(dummyDiv);for(var m=0;m<bannerDivIds.length;m++)
{rbInner.appendChild($(bannerDivIds[m]))}
height=0-height;divElements1=rbInner.getElementsByTagName("div");for(var z=0;z<divElements1.length;z++)
{if(z!=0)
{var currentDiv=divElements1[z];currentDiv.style.marginTop=height+'px';}}
rb.appendChild(rbInner);rb.appendChild(linkDiv);temp=rbInner.getElementsByTagName("div");divElements=new Array();var ind=0;for(var n=0;n<temp.length;n++)
{if(temp[n].id!=dummyDiv.id)
{divElements[ind]=temp[n];ind=ind+1;}}
Element.toggle($('progress-bar'));Element.toggle(rb);switchBanners();}
function delayer(dl)
{clearTimer();tm=setTimeout(switchBanners,dl*500);timerRunning=true;}
function clearTimer()
{if(timerRunning)
{clearTimeout(tm);timerRunning=false;}}
var first=true;function switchBanners()
{if(first==false)
{Effect.Fade(divElements[currentlyShowing],{from:1.0,to:0});if(currentlyShowing<divElements.length-1)
{currentlyShowing=currentlyShowing+1;}
else
{currentlyShowing=0;}}
first=false;Effect.Appear(divElements[currentlyShowing],{from:0,to:1.0,afterFinish:delayer(delay)});for(var n=0;n<links.length;n++)
{links[n].style.color=LINK_NORMAL_COLOR;links[n].style.backgroundColor=LINK_NORMAL_BACKGROUND_COLOR;}
links[currentlyShowing].style.color=LINK_SHOWING_COLOR;links[currentlyShowing].style.backgroundColor=LINK_SHOWING_BACKGROUND_COLOR;}
function showBanner(lk)
{clearTimer();for(var n=0;n<divElements.length;n++)
{if(divElements[n].id!=dummyDiv.id)
{divElements[n].style.display="none";}}
if(playPause)
{if(Element.visible('play-img'))
{Element.hide($('play-img'));Element.show($('pause-img'));$('pause-img').style.display="inline";}}
first=true;currentlyShowing=parseInt(lk.id);switchBanners();}
function changeColor(l,cmd)
{if(cmd=="MOUSE_OVER")
{l.style.color=LINK_HOVER_COLOR;}
else if(cmd=="MOUSE_OUT")
{l.style.color=LINK_NORMAL_COLOR;links[currentlyShowing].style.color=LINK_SHOWING_COLOR;}}
function createToggleButton()
{var toggleDiv=document.createElement("div");toggleDiv.id="toggle-div";toggleDiv.style.display="inline";var IE4plus=(document.all)?true:false;var pauseImg=document.createElement("img");pauseImg.src=PAUSE_BUTTON_OFF;pauseImg.border="0";pauseImg.onmouseover=function(){changeSrc(this,"MOUSE_OVER","PAUSE_TYPE");};pauseImg.onmouseout=function(){changeSrc(this,"MOUSE_OUT","PAUSE_TYPE");};pauseImg.onclick=function(){changeButton();};pauseImg.id="pause-img";pauseImg.style.display="inline";pauseImg.style.cursor="pointer";if(IE4plus)
{pauseImg.style.paddingBottom="2px";}
else
{pauseImg.style.paddingBottom="5px";}
pauseImg.style.paddingRight="3px";pauseImg.style.verticalAlign="middle";var playImg=document.createElement("img");playImg.src=PLAY_BUTTON_OFF;playImg.border="0";playImg.onmouseover=function(){changeSrc(this,"MOUSE_OVER","PLAY_TYPE");};playImg.onmouseout=function(){changeSrc(this,"MOUSE_OUT","PLAY_TYPE");};playImg.onclick=function(){changeButton();};playImg.id="play-img";playImg.style.display="inline";playImg.style.cursor="pointer";if(IE4plus)
{playImg.style.paddingBottom="2px";}
else
{playImg.style.paddingBottom="5px";}
playImg.style.paddingRight="3px";playImg.style.verticalAlign="middle";Element.hide(playImg);toggleDiv.appendChild(pauseImg);toggleDiv.appendChild(playImg);return toggleDiv;}
function changeSrc(img,cmd,type)
{if(cmd=="MOUSE_OVER")
{if(type=="PAUSE_TYPE")
{img.src=PAUSE_BUTTON_ON;}
else if(type=="PLAY_TYPE")
{img.src=PLAY_BUTTON_ON;}}
else if(cmd=="MOUSE_OUT")
{if(type=="PAUSE_TYPE")
{img.src=PAUSE_BUTTON_OFF;}
else if(type=="PLAY_TYPE")
{img.src=PLAY_BUTTON_OFF;}}}
function changeButton()
{Element.toggle($('play-img'));Element.toggle($('pause-img'));if(Element.visible('play-img'))
{$('play-img').style.display="inline";clearTimer();}
else
{$('pause-img').style.display="inline";delayer(2);}}
function clearLog()
{$('log-area').innerHTML="";}
function writeMessage(m)
{$('log-area').innerHTML=$('log-area').innerHTML+"<br>"+m;}
Event.observe(window,'load',function(){rotateBanners($('rotational-banner'),300,0,15,true);});
