// JavaScript Document

/**
 *
 *pos : to store the current scroll position.
 */
var pos = 600;
var objScroll;
var strLenght = 0;
var divWidth = 0;
var timeOutId = -1;
window.onload = function () {
    objId = 'scrolltextlayer';
    objText = 'scrollText';
    //get the id of the scrolling text box.
    objScroll=document.getElementById(objId);
    divWidth = objScroll.offsetWidth;
    pos = 300;
    strLength = document.getElementById(objText).offsetWidth;
    /*alert(strLength);*/
    scrollText();
}

function scrollText(){
    //subtract 1 from pos and check pos value using offsetHeight, which retrieves the height of the object relative to the layout.
    pos -=2;//edit for spped of scrolling
    if(pos < 0 - strLength) {
        pos = 600;
    }
    //set a new height value using JavaScript style object.
    objScroll.style.left=pos+'px';
    //finally the function calls itself using a timeout..
    timeOutId = window.setTimeout( "scrollText();" ,30);
}

/**
             * Comment
             */
function stopScroll() {
    window.clearTimeout(timeOutId);
}

