﻿var scrolled_pixel = 0;
var max_height = 0;
var displayed_height = 0;
var tickeron = true;

function init_ticker()
{
    if (getCookie('scrolled_pixel'))
        scrolled_pixel = getCookie('scrolled_pixel');
    resize_ticker();
    show_ticker();
}

function unload_ticker()
{
    setCookie('scrolled_pixel', scrolled_pixel);
}


function show_ticker()
{
    if (tickeron)
    {
        document.getElementById('ticker').style.top = (displayed_height - scrolled_pixel) + 'px';
        scrolled_pixel++;
        if(scrolled_pixel > max_height)
            scrolled_pixel = 0;
    }
    window.setTimeout('show_ticker()', 50);
}

function resize_ticker()
{
    displayed_height = document.getElementById('tickercontainer2').offsetHeight;
    max_height = document.getElementById('ticker').offsetHeight + displayed_height;
}

function mouseover_ticker()
{
    tickeron = false;
}

function mouseout_ticker()
{
    tickeron = true;
}

