dwg_Banner.restartDelay = 500; // delay onmouseout to restart rotation
dwg_Banners={};

function dwg_Banner(id,delay,bMouse)
{   this.id=id;
	this.delay=delay;
	this.items=[];
	this.ctr=0;
	this.timer=null;
	dwg_Banners[this.id]=this;
	this.animString="dwg_Banners."+this.id;if(bMouse)dwg_Banner.setMouseEvents(this.id);
};

dwg_Banner.prototype.addItem=function(sHtml)
{   this.items[this.items.length]=sHtml;
};

dwg_Banner.prototype.rotate=function()
{	
	clearTimeout(this.timer);
	this.timer=null;
	//if(!dwg_Banner.ready){ alert("DGF");	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);
	//}
};
 
dwg_Banner.setMouseEvents=function(id)
{	var el=document.getElementById(id);
 	if(el)	{ el.onmouseover=dwg_Banner.pause; el.onmouseout=dwg_Banner.resume; }
};

dwg_Banner.pause=function()
{ 	var curObj=dwg_Banners[this.id];
	if(curObj){clearTimeout(curObj.timer); curObj.timer=null;}
};

dwg_Banner.resume=function(e)
{	e=e?e:window.event;
	var toEl=e.relatedTarget?e.relatedTarget:e.toElement;
	if(this!=toEl&&!dwg_contained(toEl,this))
	{	var curObj=dwg_Banners[this.id];
		if(curObj) curObj.timer=setTimeout(curObj.animString+".rotate()",dwg_Banner.restartDelay);
	}
};

function dwg_contained(oNode,oCont)
{	if(!oNode) return;
	while(oNode=oNode.parentNode)
	if(oNode==oCont) return true;
	return false;
};
//----------------------------------------------------------------
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;
						}
					}
				  };

