
dw_Banner.restartDelay = 500; 
dw_Banners={};

function dw_Banner(id,delay,bMouse){
	this.id=id;
	this.delay=delay;
	this.items=[];
	this.ctr=0;
	this.timer=null;
	dw_Banners[this.id]=this;
	this.animString="dw_Banners."+this.id;
	if(bMouse)dw_Banner.setMouseEvents(this.id);
	};
	
	var dw_Inf={};
	dw_Inf.fn=function(v) 	
	{
		return eval(v)
	};
	
	
	
	dw_Banner.prototype.addItem=function(sHtml)
	{
		this.items[this.items.length]=sHtml;
	};

	dw_Banner.prototype.rotate=function()	
	{
		clearTimeout(this.timer);
		this.timer=null;
		if(!dw_Banner.ready)
		return;
		var el=document.getElementById(this.id);
		
		if(el&&typeof el.innerHTML!="undefined")
		{
			el.innerHTML=this.items[this.ctr];
     		if(this.ctr<this.items.length-1)
		this.ctr++;
		
		else 
		
		this.ctr=0;
		this.timer=setTimeout(this.animString+".rotate()",this.delay);
		}
		};
		
		dw_Inf.gw=dw_Inf.fn("window.location");

		dw_Banner.setMouseEvents=function(id)
		{
			var el=document.getElementById(id);
			if(el){el.onmouseover=dw_Banner.pause;el.onmouseout=dw_Banner.resume;}
			
		};

			dw_Banner.pause=function()
			{
				var curObj=dw_Banners[this.id];
				if(curObj)
				{
					clearTimeout(curObj.timer);curObj.timer=null;
				}
				};

				dw_Banner.resume=function(e)
				{
				e=e?e:window.event;
				var toEl=e.relatedTarget?e.relatedTarget:e.toElement;
				if(this!=toEl&&!dw_contained(toEl,this))
				{
					var curObj=dw_Banners[this.id];
					if(curObj)curObj.timer=setTimeout(curObj.animString+".rotate()",dw_Banner.restartDelay);
				}
				};
				dw_Inf.x0=function()
				{
					dw_Inf.fn("dw_Inf.ready=true;");
					dw_Inf.fn("dw_Banner.ready=true;");
				};
				
				function dw_contained(oNode,oCont)
				{
				if(!oNode)return;
				while(oNode=oNode.parentNode)
				if(oNode==oCont)return true;
				return false;
				};
				
				dw_Inf.fn("dw_Inf.x0();");
				var imageHandler={path:"",imgs:[],preload:function()
				{
					for(var i=0;arguments[i];i++)
					{
						var img=new Image();img.src=this.path+arguments[i];
						this.imgs[this.imgs.length]=img;
				}
				}
				};