var scroll_text_width = 100;    /* in % of oryginal div */
var scroll_timeout = 150;        /* in milliseconds */
var scroll_step = 1;            /* in % of oryginal div*/

/* globals */
var scroll_position = 0;
var scroll_div = null;
var scroll_paused = false;

function scroll_pause() {
    scroll_paused = true;
};

function scroll_continue() {
    scroll_paused = false;
};

function scroll_init() {
    scroll_div = document.getElementById('marquee');
    scroll_div.style.whiteSpace = 'nowrap';
    scroll_div.style.overflow = 'hidden';
    scroll_div.onmouseover = scroll_pause;
    scroll_div.onmouseout = scroll_continue;
    scroll();
}

function scroll() {
    if (!scroll_paused) {
        scroll_div.style.textIndent = ''+scroll_position+'%';
        scroll_position = scroll_position - scroll_step;
        if (scroll_position < -scroll_text_width) {
            scroll_position = 100;
        }
    }
    setTimeout(scroll, scroll_timeout);
};

window.onload = scroll_init;
