module_banner = function(sModuleName){
	this.sModuleName = sModuleName;
	this.iTotalBanner = 0;
	this.iCurrBannerIndex = 0;
	this.oCurrBanner = null;
	this.timeoutID = null;
	this.iSpeed = 10000;
}
module_banner.prototype.init = function(){
	var oModule = document.getElementById(this.sModuleName);
	var oTemp = oModule.getElementsByTagName("DIV");
	this.iTotalBanner = oTemp.length;
	this.iCurrBannerIndex = Math.round(Math.random()*10) % (this.iTotalBanner);
	this.oCurrBanner = oTemp[this.iCurrBannerIndex];	
	if(this.iCurrBannerIndex != 0){
		Learn.util.removeClass(oTemp[0],"on");
		Learn.util.addClass(this.oCurrBanner,"on");
	}
}
module_banner.prototype.next = function(oSelf){
	var iNextIndex = 0;
	if((oSelf.iCurrBannerIndex+1) == oSelf.iTotalBanner)
		iNextIndex = 0;
	else
		iNextIndex = oSelf.iCurrBannerIndex + 1;
	Learn.util.removeClass(oSelf.oCurrBanner,"on");
	var oTemp = document.getElementById(this.sModuleName).getElementsByTagName("DIV");
	oSelf.oCurrBanner = oTemp[iNextIndex];
	Learn.util.addClass(oSelf.oCurrBanner,"on");
	oSelf.iCurrBannerIndex = iNextIndex;
}
var oBanner;
var intStep;
function doBlur(){
	var oDIV = document.getElementById("banner_div");
	if(document.all)
		intStep = intStep -10;
	else
		intStep = intStep -4;
		
	if(intStep >= 0){
		if(document.all){
			oDIV.style.filter = "progid:DXImageTransform.Microsoft.Alpha( style=1,opacity="+intStep+",finishOpacity="+intStep+")";
		}else{
			var iOpacity = intStep/100;
			oDIV.style.opacity = iOpacity;
		}
	}else if(window.intervalID2){
		clearInterval(intervalID2);
		oBanner.next(oBanner);
		intervalID2 = setInterval("doClear()",20);
	}
}
function doClear(){
	var oDIV = document.getElementById("banner_div");
	if(document.all)
		intStep = intStep +10;
	else
		intStep = intStep +4;
	if(intStep <= 100){
		if(document.all){
			oDIV.style.filter = "progid:DXImageTransform.Microsoft.Alpha( style=1,opacity="+intStep+",finishOpacity="+intStep+")";
		}else{
			var iOpacity = intStep/100;
			oDIV.style.opacity = iOpacity;
		}
	}else if(window.intervalID2){
		clearInterval(intervalID2);
		oBanner.timeoutID = setTimeout("fnInterval()",oBanner.iSpeed);
	}
	
}
function fnInterval(){
	intStep = 100;
	intervalID2 = setInterval("doBlur()",20);
}
function fnBannerInit(){	
	var oModule = document.getElementById("banner_div");
	if(oModule){
	oBanner = new module_banner("banner_div")
	oBanner.init();	
	fAction1 = function(e){
		if(e){
			Learn.util.Event.stopEvent(e);
		}
		clearTimeout(oBanner.timeoutID);
		return false;
	}
	Learn.util.Event.addListener(oModule,"mouseover",fAction1);	
	fAction2 = function(e){
		if(e){
			Learn.util.Event.stopEvent(e);
		}
		clearTimeout(oBanner.timeoutID);	
		oBanner.timeoutID = setTimeout("fnInterval()",oBanner.iSpeed);
		return false;
	}	
	Learn.util.Event.addListener(oModule,"mouseout",fAction2);
	oBanner.timeoutID = setTimeout("fnInterval()",oBanner.iSpeed);
	}
}﻿
