var marqueeIntervalId;

function displayMarquee(marqueeWidth, marqueeHeight, backgroundColor, marqueeHtml)
{
    document.write('<div id="HiddenMarqueeText" style="position:absolute; left:-10000px; top:-1000px;">' + marqueeHtml + '</div>');

    document.write('<div style="width:' + marqueeWidth + 'px; height:' + marqueeHeight + 'px; background-color:' + backgroundColor + '; overflow:hidden;">');
    document.write('<div id="MarqueeText" style="position:relative; left:' + marqueeWidth + 'px; top:0; white-space:nowrap;" onmouseover="stopMarquee();" onmouseout="startMarquee(' + marqueeWidth + ');">');
    document.write(marqueeHtml);
    document.write('</div>');
    document.write('</div>');
}

function scrollMarquee(marqueeWidth)
{
    marqueeTextWidth = document.getElementById('HiddenMarqueeText').offsetWidth;
    marqueeTextStyle = document.getElementById('MarqueeText').style;
    currentLeft      = parseInt(marqueeTextStyle.left);

    if (currentLeft * -1 > marqueeTextWidth)
    {
        marqueeTextStyle.left = marqueeWidth + 'px';
    }
    else
    {
        marqueeTextStyle.left = currentLeft - 1 + 'px';
    }
}

function startMarquee(marqueeWidth)
{
    marqueeIntervalId = setInterval('scrollMarquee(' + marqueeWidth + ')', 25);
}

function stopMarquee()
{
    clearInterval(marqueeIntervalId);
}