
var isWait=false;
var waitDiv="";

function moveScroll(whichdiv,scrollerheight,scrollerdelay){
    tdiv=eval(whichdiv)

    if(isWait && waitDiv==tdiv.id){
       setTimeout("moveScroll(tdiv,scrollerheight,scrollerdelay)",scrollerdelay)
       return; 
    }

    if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
      tdiv.style.top=parseInt(tdiv.style.top)-1+"px"
    }
    else{
      tdiv.style.top=parseInt(scrollerheight)
    }
    setTimeout("moveScroll(tdiv,scrollerheight,scrollerdelay)",scrollerdelay)
}




//--------------------------------------------------------------------------------------------------------------------

function InitScroll(nameDiv,scrollerheight,scrollerwidth,scrollerbgcolor,scrollerdelay,textScroll){

       document.writeln('<div onmouseOver="waitDiv=\''+nameDiv+'\';isWait=true;" onmouseOut="isWait=false;" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+'">')
       document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';left:0px;top:0px">')
       document.writeln('<div id="'+nameDiv+'" style="position:absolute;width:'+scrollerwidth+';left:0px;top:'+scrollerheight+';">')
       document.write(textScroll)
       document.writeln('</div>')
       document.writeln('</div>')
       document.writeln('</div>')

       moveScroll(document.getElementById(nameDiv),scrollerheight,scrollerdelay)
}


//----------------------------------------- OR -----------------------------------------------------------------------

function InitScrollBegin(nameDiv,scrollerheight,scrollerwidth,scrollerbgcolor){

       document.writeln('<div onmouseOver="waitDiv=\''+nameDiv+'\';isWait=true;" onmouseOut="isWait=false;" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+'">')
       document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';left:0px;top:0px">')
       document.writeln('<div id="'+nameDiv+'" style="position:absolute;width:'+scrollerwidth+';left:0px;top:'+scrollerheight+';">')
}

//moveScroll(document.getElementById(nameDiv),scrollerheight,scrollerdelay)

function InitScrollEnd(nameDiv,scrollerheight,scrollerdelay){

       document.writeln('</div>')
       document.writeln('</div>')
       document.writeln('</div>')

       moveScroll(document.getElementById(nameDiv),scrollerheight,scrollerdelay)
}

