    // Change stations lists if more than 25
var stationsArr = new Array();
var currStationInd=0;

    //To emulate push function in IE 5.0
if (typeof Array.prototype.push == "undefined") {
    Array.prototype.push = Array_push;
}
function Array_push() {
    var A_p = 0;
    for (A_p = 0; A_p < arguments.length; A_p++) {
        this[this.length] = arguments[A_p];
    }
    return this.length;
}

function toggleVisibility(objid, showit) {
    var tobj = document.getElementById(objid);
    if (typeof tobj == "undefined") return;
    if (typeof tobj.style.visibility == "undefined" || tobj.style.visibility == '')
        tobj.style.visibility = "visible";
    //alert("toggleVisibility: "+tobj.style.visibility+" - "+showit);
    if (tobj.style.visibility=="hidden" && (typeof showit == "undefined" || typeof showit == "boolean" && showit))
        tobj.style.visibility = "visible";
    else if (tobj.style.visibility=="visible" && (typeof showit != "undefined" && typeof showit == "boolean" && !showit))
        tobj.style.visibility = "hidden";
}

function toggleDisplay(objid, showit) {
    var tobj = document.getElementById(objid);
    if (typeof tobj == "undefined") return;
    if (typeof tobj.style.display == "undefined" || tobj.style.display == '')
        tobj.style.display = "block";

    if (tobj.style.display=="none" || (typeof showit != "undefined" && typeof showit == "boolean" && showit))
        tobj.style.display = "block";
    else if (tobj.style.display=="block" && (typeof showit == "undefined" || typeof showit == "boolean" && !showit))
        tobj.style.display = "none";
}

function addStation(SName) {
    stationsArr.push(SName);
}

function setCurStationInd(id) {
    currStationInd=id;
}

function gotoPage(page) {
    var tobjnext = document.getElementById('next');
    var tobjprev = document.getElementById('previous');
    if (typeof tobjnext == "undefined" || typeof tobjprev == "undefined") return;

    if (page < stationsArr.length-1)
        tobjnext.style.visibility = "visible";
    else
        tobjnext.style.visibility = "hidden";
    if (page >= 1)
        tobjprev.style.visibility = "visible";
    else
        tobjprev.style.visibility = "hidden";

    var divObjCur = document.getElementById(stationsArr[currStationInd]);
    var divObj2Change = document.getElementById(stationsArr[page]);
    divObjCur.style.display = (divObjCur.style.display == 'none')?'block':'none';
    divObj2Change.style.display = (divObj2Change.style.display == 'none')?'block':'none';
    currStationInd=page;
}

function chgSList(pos) {
    var tobjnext = document.getElementById('next');
    var tobjprev = document.getElementById('previous');
    if (typeof tobjnext == "undefined" || typeof tobjprev == "undefined") return;

    if (currStationInd+pos < stationsArr.length-1)
        tobjnext.style.visibility = "visible";
    else
        tobjnext.style.visibility = "hidden";
    if (currStationInd+pos >= 1)
        tobjprev.style.visibility = "visible";
    else
        tobjprev.style.visibility = "hidden";

    /*if (currStationInd+pos > stationsArr.length-2) toggleVisibility('next', false);
    else if (currStationInd+pos < 1) { toggleVisibility('previous', false); }
    else {
        if (currStationInd+pos+1 == stationsArr.length) toggleVisibility('next', true);
        if (currStationInd+pos >= 1) toggleVisibility('previous', true);
    }*/

    var divObjCur = document.getElementById(stationsArr[currStationInd]);
    var divObj2Change = document.getElementById(stationsArr[currStationInd+pos]);
    divObjCur.style.display = (divObjCur.style.display == 'none')?'block':'none';
    divObj2Change.style.display = (divObj2Change.style.display == 'none')?'block':'none';

    currStationInd=currStationInd+pos;
}