// Resizer - resizes div to give html scroll for flash content
var windowHeight = 768;
var agt = navigator.userAgent.toLowerCase();
var isIE = (agt.indexOf("msie") != -1);
var runOnce = false;

window.onresize = function() {
    checkFlashSize();
}

window.onload = function() {
    checkOS();
}

function checkOS() {
    var OSName = "Unknown OS";
    if (navigator.appVersion.indexOf("Win") != -1) OSName = "Windows";
    if (navigator.appVersion.indexOf("Mac") != -1) OSName = "MacOS";
    if (navigator.appVersion.indexOf("X11") != -1) OSName = "UNIX";
    if (navigator.appVersion.indexOf("Linux") != -1) OSName = "Linux";

    if (OSName == "MacOS") {
        var controlDiv = document.getElementById("scrollBox");
        controlDiv.style.display = "none";
    }
}

function checkFlashSize() {
    var flashContent = document.getElementById("container");
    var controlDiv = document.getElementById("scrollBox");
    if (flashContent != null) {

        // HEIGHT
        flashContent.height = document.body.clientHeight;
        if (flashContent.clientHeight < document.body.clientHeight) {
            flashContent.height = document.body.clientHeight;
        }
        else if (flashContent.clientHeight < controlDiv.clientHeight) {
            flashContent.height = controlDiv.clientHeight;
        }
        else if (flashContent.clientHeight > controlDiv.clientHeight && controlDiv.clientHeight > document.body.clientHeight) {
            flashContent.height = controlDiv.clientHeight;
        }

        // WIDTH
        flashContent.width = document.body.clientWidth;
        if (flashContent.clientWidth < document.body.clientWidth) {
            flashContent.width = document.body.clientWidth;
        }
        else if (flashContent.clientWidth < controlDiv.clientWidth) {
            flashContent.width = controlDiv.clientWidth;
        }
        else if (flashContent.clientWidth > controlDiv.clientWidth && controlDiv.clientWidth > document.body.clientWidth) {
            flashContent.width = controlDiv.clientWidth;
        }
    }
}

function resizeDiv(w, h) {
    var div = document.getElementById("scrollBox");
    if ((windowHeight != h) && (div != null)) {
        div.style.width = w + "px";
        div.style.height = h + "px";
        checkFlashSize();
    }
    windowHeight = h;
}