// Simple Marquee (25-October-2010)
// by Vic Phillips http://www.vicsjavascripts.org.uk/

function zxcMarquee(o){
 this.mde=typeof(o.Mode)=='string'&&o.Mode.charAt(0)=='H'?'left':'top';
 var p=document.getElementById(o.ID),oop=this,os=this.mde=='top'?'Height':'Width',dly=typeof(o.DelayStart)=='number'?o.DelayStart:10,pos=0,div;
 p.style.overflow='hidden';
 this.divs=[p.getElementsByTagName('DIV')[0]];
 var ary=o.ContentArray||[];
 for (var a,img,z0=0;z0<ary.length;z0++){
  a=document.createElement('A');
  img=document.createElement('IMG');
  img.src=ary[z0][0];
  if (ary[z0][1]){
   a.href=ary[z0][1];
  }
  if (ary[z0][2]){
   img.title=ary[z0][2];
  }
  a.appendChild(img);
  this.divs[0].appendChild(a);
 }
 this.divs[0].style.position='absolute';
 this.sz=this.divs[0]['offset'+os];
 this.divs[0].style[this.mde]=-this.sz+'px';
 while (pos<p['offset'+os]+this.sz){
  div=this.divs[0].cloneNode(true);
  p.appendChild(div);
  div.style[this.mde]=(pos)+'px';
  this.divs.push(div);
  pos+=this.sz;
 }
 this.nu=this.divs.length;
 this.Speed=typeof(o.Speed)=='number'?o.Speed:-1;
 setTimeout(function(){ oop.scroll(); },dly);
}

zxcMarquee.prototype.scroll=function(){
 for (var oop=this,pos,z0=0;z0<this.nu;z0++){
  pos=parseInt(this.divs[z0].style[this.mde]);
  if ((this.Speed<0&&pos<-this.sz)||(this.Speed>0&&pos>this.sz*(this.nu-2))){
   pos+=this.sz*this.nu*(this.Speed<0?1:-1);
  }
  this.divs[z0].style[this.mde]=pos+this.Speed+'px';
 }
 setTimeout(function(){ oop.scroll(); },50);
}

