// start main marquee script
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);
}

/*<![CDATA[*/
// config above script settings
var M1,M2,M3;

function Init(){

M1=new zxcMarquee({
 ID:'tst1',      // the unique ID name of the parent DIV.                            (string)
 Mode:'H',       //(optional) the mode of execution, Horizontal' or 'Vertical'.      (string, default = 'Vertical')
 Speed:2,        //(optional) the speed of execution, 1 = slow, 10 = fast, 0 = stop. (digits, default = -1)
 DelayStart:2000 //(optional) the auto start in milli seconds.                       (digits, default = 10)
});

M2=new zxcMarquee({
 ID:'tst2',
 Mode:'H',
//  ContentArray:[         //(optional) an array defining image srcs, hrefs and titles.        (array, default = the scroll div content)
//    field 0 = the file path and name of the image.   (string)
//    field 1 = (optional) the link href of the image. (string)
//    field 1 = (optional) the image title.            (string)
//   ['http://#/2.gif'],
//   ['http://#/3.gif'],
//   ['http://#/4.gif']
// ],
 Speed:0
});

M3=new zxcMarquee({
 ID:'tst3',
 Speed:-2
});

}

if (window.addEventListener){
 window.addEventListener('load',Init, false);
}
else if (window.attachEvent){
 window.attachEvent('onload',Init);
}

/*]]>*/
