<!-- -*-java-*- -->

google_ad_client = 'pub-5511497868554211';
google_alternate_ad_url = 'http://therail.com/html/adsense.html';
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = '728x90_as';
google_ad_type = 'text_image';
google_ad_channel ='8389860862';
google_color_border = '333333';
google_color_bg = '333333';
google_color_link = 'aaffaa';
google_color_url = 'aaaa77';
google_color_text = 'eeeeee';

var since = 0;
var actDelay = 15000;

function adjustWin()
{
    var margins=0;
    var minHeight=900;
    var newHeight=xClientHeight()-margins;
    if (newHeight<minHeight)
        newHeight=minHeight;
    xHeight('page',newHeight);
    createCookie('page',newHeight,77);
}

window.onload=function()
{
    adjustWin();
    xAddEventListener(window,'resize',adjustWin,false);
    setTimeout('updateAge()', 60000);
    setTimeout('actUp()', 5000);
    getBanner();
}

function getBanner() {
    new Ajax.Updater('bannerHolder', '/cgi/get_banner?station', 
    {asynchronous:true, evalScripts:true});
}

function updateAge()
{
    new Ajax.Updater('railAge', '/cgi/get_age', 
    {asynchronous:true, evalScripts:true, onComplete:function(request) {setTimeout('updateAge()', 60000)}});
}

function prepAct()
{
    setTimeout('actUp()', actDelay);
}

function afterActUp()
{
    new Ajax.Updater('actBlock', '/cgi/get_act', 
    {asynchronous:true, evalScripts:true, onComplete:function(request) {prepAct()}});
}

function onActUp(request)
{
    if (request.responseText != '0')
    {
	since = request.responseText;
	afterActUp();
    }
    else
    {
	setTimeout('actUp()', actDelay);
    }
}

function actUp()
{
    new Ajax.Request('/cgi/act_updated?' + since,
    {asynchronous:true, onComplete:function(request) {onActUp(request)}})
}

