/********************************************
 * Timeline Page
 ********************************************/
var minWidth = '960';
var minHeight = '500';

/**
 * initHomeGlobe
 * checks to see if the user has flash
 **/
function initHomeGlobe(siteVersion)
{
    var params = {
        menu: "false",
        scale: "noScale",
        allowFullscreen: "true",
        allowScriptAccess: "always",
        bgcolor: "#FFFFFF"
    };
    var flashvars = {
        path: "/flash/HomeGlobe.swf",
        resize: true
    };
    var attributes = { id:"HomeGlobe" };
    var path = "/flash/Preloader.swf?version=" + siteVersion;
    swfobject.embedSWF(path, "HomeGlobe", "100%", "100%", "9.0.124", "/flash/ExpressInstall.swf", flashvars, params, attributes);
}

/**
 * setHeightFromFlash
 * Sets the height of the flash object
 * This function is called by flash when it loads
 **/
function setHeightFromFlash()
{

    //set props
    var flashHeight = $('#HomeGlobe').height();
    var flashRemoveHeight = $('#top-bar').height() + $('#bottom-bar').height();
    var documentwidth = $(window).width();
    var newFlashWidth = (documentwidth <= minWidth)? minWidth+"px" : "100%";
    var newFlashHeight = flashHeight - flashRemoveHeight;
    if(newFlashHeight <= minHeight) newFlashHeight = minHeight+"px";

    //resize the flash
    $('#HomeGlobe').css({ height: newFlashHeight, width: newFlashWidth });

    //finally, set a listener for future window resizes
    $(window).resize(onResizeFlash);
}


/**
 * onResizeFlash
 * resizes the flash when the browser changes size
 **/
function onResizeFlash()
{
    //set props
    var documentwidth = $(window).width();
    var documentheight = $(window).height();
    var flashRemoveHeight = $('#top-bar').height() + $('#bottom-bar').height();
    var newFlashWidth = (documentwidth <= minWidth)? minWidth+"px" : "100%";
    var newFlashHeight = documentheight - flashRemoveHeight;
    if(newFlashHeight <= minHeight) newFlashHeight = minHeight+"px";

    //resize flash
    $('#HomeGlobe').css({ height: newFlashHeight, width: newFlashWidth });
	
}
