var Productbling_toScroll=new Array()
var ie=document.all
var dom=document.getElementById
var Productbling_firstNews_obj;
var Productbling_secondNews_obj;

function ProductblingScroll(name){
  var Productbling_c=this; Productbling_c.name=name; Productbling_c.mc=0; Productbling_c.i=2;
  return this;
}

ProductblingScroll.prototype.addItem = function(text,link,font,fontSize,fontStyle){
  var Productbling_c = this;
  if (link !=''){
    if (font != '')
      Productbling_toScroll[Productbling_c.mc]="<a href='"+link+"'><font face='"+font+"' size='"+fontSize+"' Class='"+fontStyle+"'>"+text+"</font></a>";
    else
      Productbling_toScroll[Productbling_c.mc]="<a href='"+link+"'><font Class='"+fontStyle+"'>"+text+"</font></a>";
  }
  else { 
    if (font != '')
      Productbling_toScroll[Productbling_c.mc]="<font face='"+font+"' size='"+fontSize+"' Class='"+fontStyle+"'>"+text+"</font>";
    else
      Productbling_toScroll[Productbling_c.mc]="<font Class='"+fontStyle+"'>"+text+"</font>";
  }
  Productbling_c.mc++;
}

ProductblingScroll.prototype.construct = function(){
  var Productbling_c = this; theWidth = Productbling_c.scrollerwidth; theHeight=Productbling_c.scrollerheight; thebgColor = Productbling_c.scrollerbgcolor; theBackground =Productbling_c.scrollerbackground; theDelay=Productbling_c.scrollerdelay;
  Productbling_scroll_obj=eval(Productbling_c.name);        
  if (ie||dom){
    document.writeln('<div id="Productbling_main2" style="position:relative;width:'+theWidth+';height:'+theHeight+';overflow:hidden;background-color:'+thebgColor+' ;background-image:url('+theBackground+')">')
    document.writeln('<div style="position:absolute;width:'+theWidth+';height:'+theHeight+';clip:rect(0 '+theWidth+' '+theHeight+' 0);left:0;top:0">')
    document.writeln('<div id="Productbling_firstNews" style="position:absolute;width:'+theWidth+';left:0;top:1">')
    document.write(Productbling_toScroll[0])
    document.writeln('</div>')
    document.writeln('<div id="Productbling_secondNews" style="position:absolute;width:'+theWidth+';left:0;top:0;visibility:hidden">')
    document.write(Productbling_toScroll[dyndetermine=(Productbling_toScroll.length==1)? 0 : 1])
    document.writeln('</div>')
    document.writeln('</div>')
    document.writeln('</div>')
  }
}

ProductblingScroll.prototype.move = function(whichdiv){
  var Productbling_c = this; theDelay = Productbling_c.scrollerdelay; theHeight = Productbling_c.scrollerheight; 
  Productbling_scroll_obj=eval(Productbling_c.name);
  Productbling_tdiv=eval(whichdiv)

  if (parseInt(Productbling_tdiv.style.top)>0&&parseInt(Productbling_tdiv.style.top)<=5){
    Productbling_tdiv.style.top=0+"px"
    setTimeout("Productbling_scroll_obj.move(Productbling_tdiv)",theDelay)
    setTimeout("Productbling_scroll_obj.move2(Productbling_secondNews_obj)",theDelay)
    //document.write('Got Milk?')
  return
  }
  if (parseInt(Productbling_tdiv.style.top)>=Productbling_tdiv.offsetHeight*-1){
    Productbling_tdiv.style.top=parseInt(Productbling_tdiv.style.top)-5+"px"
    setTimeout("Productbling_scroll_obj.move(Productbling_tdiv)",50)
  }
  else {
    Productbling_tdiv.style.top=parseInt(theHeight)+"px"
    Productbling_tdiv.innerHTML=Productbling_toScroll[Productbling_c.i]
    if (Productbling_c.i==Productbling_toScroll.length-1)
      Productbling_c.i=0
    else
      Productbling_c.i++
  }
}

ProductblingScroll.prototype.move2 = function(whichdiv){
  var Productbling_c = this; theDelay = Productbling_c.scrollerdelay; theHeight= Productbling_c.scrollerheight;
  Productbling_scroll_obj=eval(Productbling_c.name);
  Productbling_tdiv2=eval(whichdiv)

  if (parseInt(Productbling_tdiv2.style.top)>0&&parseInt(Productbling_tdiv2.style.top)<=5){
    Productbling_tdiv2.style.top=0+"px"
    setTimeout("Productbling_scroll_obj.move2(Productbling_tdiv2)",theDelay)
    setTimeout("Productbling_scroll_obj.move(Productbling_firstNews_obj)",theDelay)
    return
  }
  if (parseInt(Productbling_tdiv2.style.top)>=Productbling_tdiv2.offsetHeight*-1){
    Productbling_tdiv2.style.top=parseInt(Productbling_tdiv2.style.top)-5+"px"
    setTimeout("Productbling_scroll_obj.move2(Productbling_secondNews_obj)",50)
  }
  else {
    Productbling_tdiv2.style.top=parseInt(theHeight)+"px"
    Productbling_tdiv2.innerHTML=Productbling_toScroll[Productbling_c.i]
    if (Productbling_c.i==Productbling_toScroll.length-1)
      Productbling_c.i=0
    else
      Productbling_c.i++
  }
}

ProductblingScroll.prototype.startScroll = function(){
  var Productbling_c = this;
  Productbling_scroll_obj=eval(Productbling_c.name);        
  
  if (Productbling_toScroll.length >2)
    Productbling_c.i = 2;
  else
    Productbling_c.i = 0;
  
  Productbling_firstNews_obj=ie? Productbling_firstNews : document.getElementById("Productbling_firstNews")
  Productbling_secondNews_obj=ie? Productbling_secondNews : document.getElementById("Productbling_secondNews")
  setTimeout("Productbling_scroll_obj.move(Productbling_firstNews_obj)",Productbling_c.scrollerDelay);
  Productbling_secondNews_obj.style.top=theHeight;
  Productbling_secondNews_obj.style.visibility='visible'
}