/*   dw_banners.js   version date: May 2005  */

/*************************************************************************
  This code is from Dynamic Web Coding at dyn-web.com
  Copyright 2001-5 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

/*  Readable code available for licensed users */

dw_Banner.restartDelay = 500; // delay onmouseout to restart rotation
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);};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_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);}};function dw_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;}}};