// *sigh* Mozilla, what are we going to do with you?

window.onload = function() {
    // Fix the reflow bug
    document.getElementById("reflowed").style.display = "none";
    document.getElementById("reflowed").style.display = "block";

    // Find any rel="externals" and make sure they open in new windows
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
            anchor.target = "_blank";
        }
    }

    // Add cam updater
    setInterval('reloadImages()', 60000);
}

function popURL(addr) {
    // Cam window popup
    window.open(addr, '_blank',
                'width=320, height=240,' +
                'scrollbars=no, resizable=no,' +
                'toolbar=no, directories=no,' +
                'location=no, menubar=no,' +
                'status=no');
}

function popMovie(addr, width, height) {
    // Movie window popup
    window.open(addr, '_blank',
                'width=' + (width+20) + ', height=' + (height+120) + ',' +
                'scrollbars=no, resizable=no,' +
                'toolbar=no, directories=no,' +
                'location=no, menubar=no,' +
                'status=no');
}

function reloadImages() {
    document.getElementById('cam').src = '/assets/camimg.php?' + new Date().getTime();
}