/* javascript scroller 
   @project cellularfactory.com 
*/

var delayS = 40;              //Delay between iterations (fine tuning).
var scrollerDelay = 1000;      //Pause between msg scrolls. 1000 = 1 second. 
var scrollerWidth = '190px';    //Set width, height and bgcolor below.
var scrollerHeight = '170px';
var scrollerBgcolor = '#fff';
var paddingTop = 30;             //Set stopping point, where message pauses.
var iteration = '1';            //Set iteration to the number of pixels to move between each delay.
var scrollerBackground = '';   //Set to your background image 

/* upgrade */
var my_height = (parseInt(scrollerHeight)*1.7)+paddingTop;
var mssg = scroll_mssg;

var dom=document.getElementById;
if (mssg.length > 2) iv = 2;
else iv = 0;

function move(whichdiv){
tdiv=eval(whichdiv);
if (parseInt(tdiv.style.top) > 0 && parseInt(tdiv.style.top) <= iteration){
tdiv.style.top = 0 + "px";
setTimeout("move(tdiv)",scrollerDelay);
setTimeout("move2(second2_obj)",scrollerDelay);
return}
if (parseInt(tdiv.style.top) >= tdiv.offsetHeight * -1){
tdiv.style.top = parseInt(tdiv.style.top) - iteration + "px";
setTimeout("move(tdiv)",delayS);}
else{
tdiv.style.top=parseInt(my_height) + "px";
tdiv.innerHTML = mssg;
}}

function move2(whichdiv){
tdiv2=eval(whichdiv);
if (parseInt(tdiv2.style.top) > 0 && parseInt(tdiv2.style.top) <= iteration){
tdiv2.style.top = 0 + "px";
setTimeout("move2(tdiv2)",scrollerDelay);
setTimeout("move(first2_obj)",scrollerDelay);
return}
if (parseInt(tdiv2.style.top) >= tdiv2.offsetHeight * -1){
tdiv2.style.top = parseInt(tdiv2.style.top) - iteration + "px";
setTimeout("move2(second2_obj)",delayS);}
else{
tdiv2.style.top = parseInt(my_height) + "px";
tdiv2.innerHTML = mssg;
}}

function startScroll(){
first2_obj = document.getElementById("first2");
second2_obj = document.getElementById("second2");
move(first2_obj);
second2_obj.style.top = my_height+'px';
second2_obj.style.visibility = 'visible' }

function pauseScroller(scrSpeed){delayS = scrSpeed}

document.writeln('<div id="main2" style="position:relative;width:'+scrollerWidth+';height:'+scrollerHeight+';overflow:hidden;background-color:'+scrollerBgcolor+' ;background-image:url('+scrollerBackground+');">');
document.writeln('<div style="position:absolute;width:'+scrollerWidth+';height:'+scrollerHeight+';left:0px;top:0px;">');
document.writeln('<div id="first2" style="position:absolute;padding-top:'+paddingTop+';width:'+scrollerWidth+';left:0px;top:1px;text-align: justify;">');
document.write(mssg+'</div>');
document.writeln('<div id="second2" style="position:absolute;padding-top:'+paddingTop+';width:'+scrollerWidth+';left:0px;top:0px;visibility:hidden;text-align: justify;">');
document.write(mssg);
document.writeln('</div></div></div>');

if (window.addEventListener)
window.addEventListener("load", startScroll, false)
else if (window.attachEvent)
window.attachEvent("onload", startScroll)
else if (dom)
window.onload=startScroll

