var AlphaView;
var lv;
var LastBanner='b2';
var RotateSpeed=5000;
function HideBanner(what)
{
BannerToHide=document.getElementById(what);
BannerToHide.style.visibility="hidden";
}

function ShowBanner(what)
{
if(LastBanner!=what){
HideBanner(LastBanner);

LastBanner=what;
BannerToShow=document.getElementById(what);


ResetAlpha(10);
BannerToShow.style.visibility="visible";
AlphaView=setInterval("IncAlpha(30)",100)
}
}

function ResetAlpha(degree){
	clearInterval(AlphaView);
	if (typeof BannerToShow.style.MozOpacity=="string")
		BannerToShow.style.MozOpacity=degree/100
	else if (BannerToShow.filters)
		BannerToShow.filters.alpha.opacity=degree; 
}

function IncAlpha(val){
if (typeof BannerToShow.style.MozOpacity=="string" && BannerToShow.style.MozOpacity<1)
	BannerToShow.style.MozOpacity=Math.min(parseFloat(BannerToShow.style.MozOpacity)+val/100, 0.99)
else if (BannerToShow.filters && BannerToShow.filters.alpha.opacity<100)
	BannerToShow.filters.alpha.opacity+=val
else //if not IE or Moz
clearInterval(AlphaView)
}

function StartRotate(goNow)
{
lv=goNow;
clearInterval(SC);
switch (lv) {
case 1: ShowBanner('b1'); break;
case 2: ShowBanner('b2'); break;
case 3: ShowBanner('b3'); break;
default: lv=0;
}
lv++;
if (lv>3){lv=1};
SC=setInterval("StartRotate(lv)",RotateSpeed);
}

window.onload=function BannerRotation()
{
ShowBanner('b1');
SC=setInterval("StartRotate(2)",RotateSpeed)
}
