function swapImg(elem, img, state) {
    if(document.images) {
        elem.src = swImg[state][img].src;
    }
}

function openPop(url, name, w, h, showScrollBars) {
    w = (w > screen.availWidth) ? (screen.availWidth - 32) : w;
    h = (h > screen.availHeight) ? (screen.availHeight - 64) : h;

    var myX = (screen.availWidth - w) / 2;
    var myY = (screen.availHeight - h) / 2;
    var opt = (openPop.arguments.length == 5 && showScrollBars) ? ",scrollbars=yes" : ",scrollbars=no";
    var win = window.open(url, name, "width=" + w + ",height=" + h + ",left=" + myX + ",top=" + myY + ",resizable=yes" + opt);
    win.focus();
}

function timeLight(from, count, state) {
    for(i = from; i < (from + count); i++) {
        document.getElementById("time" + i).style.backgroundColor = (state == 1) ? "#f99" : "";
    }
}

function mainExternalLinks() {
    var anchors = document.getElementsByTagName("a");
    for(var i = 0; i < anchors.length; i++) {
        var rel = anchors[i].getAttribute("rel");
        if(anchors[i].getAttribute("href") && rel) {
            if(rel == "external") {
                anchors[i].target = "_blank";
            };
        };
    };
};

