﻿// ---------------------------------------------------------------------------------------------------------------
// Phoenix Internet Designs - General Utilities - This script has been validated using Internet Explorer
// (Versions 6 & 7), Netscape (Version 8), Firefox (2.0.0.2), Opera (9.10) and Safari (BETA 3.0).
// NEVER MODIFY OR ADD CLIENT / PROJECT SPECIFIC CODE TO THIS SCRIPT
// ---------------------------------------------------------------------------------------------------------------
// DEPENDENCIES:
//      Variable / Constants - The following variables and constants MUST be declared in the project specific
//      script:
//          FADEOUT_DIV - Contains the ID of the DIV that performs the "fade out" effect when a popup is displayed.
//                        Set to '' if no fade out effect.
//          AJAX_TARGET  - The ID of the DIV that is to be used as the AJAX region.
//      Methods - The following methods must exist in the project specific script, even though there is no required
//      processing a stub must exist.
//          onAJAXConnection() - Code to excute after a successful AJAX connection has been made and the target DIV
//                               updated.
//          onAJAXFail()       - Code to execute if the AJAX connection failed to download the requested page.
// ---------------------------------------------------------------------------------------------------------------
// Retrieve the height and width of the client browser window
var gi_winheight = 0;
var gi_winwidth = 0;
var gi_DOM = 0;
try 
{
    gi_winheight = document.clientHeight;            
    gi_winwidth = document.clientWidth;
    if(gi_winheight == null)
    {
        gi_winheight = window.screen.height;            
        gi_winwidth = window.screen.width;
    } else {
        gi_DOM = 1;
    }
} catch(e) {
    gi_winheight = 0;
    gi_winwidth = 0;
}
// This method must be executed if there are Flash components
function isFlashEnabled()
{
    var b_flashenabled;
    var o_plugin;
    try
    {
        o_plugin=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
        if(typeof(o_plugin)=="object")b_flashenabled = true;
    } catch(e) {
        try
        {
            o_plugin=navigator.plugins["Shockwave Flash"];
            if(typeof(oplugin)=="object")b_flashenabled=true;
        } catch(e) {
            b_flashenabled=false;
        }
    }
    return b_flashenabled;
}

// This method "fades" out the background (if the fade out DIV is specified) and displays a popup    
function fade(_swindow, _iwidth, _iheight, _page, _itop, _ajaxtargetor){
    // Apply the fade out effect
    if(FADEOUT_DIV != "")
    {
        var o_coverDiv = document.getElementById(FADEOUT_DIV);
        o_coverDiv.style.height = gi_winheight + 200;
        o_coverDiv.style.width = gi_winwidth;
        o_coverDiv.style.top = 0;
        o_coverDiv.style.left = 0;
        o_coverDiv.style.visibility = "visible";
    }
    
    var scroll_top = window.pageYOffset || document.documentElement.scrollTop;    
    var o_window = document.getElementById(_swindow);
    o_window.style.width = _iwidth;
    o_window.style.height = _iheight;
    var i_top = _itop;
    if(gi_DOM == 0)
    {
        o_window.style.top = eval(scroll_top + 100) + "px";
    } else {
        o_window.style.top = scroll_top + ((gi_winheight - _iheight)/ 4);         
    }
    o_window.style.left = eval((gi_winwidth - _iwidth)/ 2) + "px";
    o_window.style.visibility = "visible"
    document.getElementById("divAjax").style.visibility = "visible";
    AJAX_OVERRIDE = "";
    if(_ajaxtargetor != "")AJAX_OVERRIDE = _ajaxtargetor
    //alert(_page)
    if(_page != "")loadAjax(_page);
}
function closeWin(_swindow)
{
    if(FADEOUT_DIV != "")(document.getElementById(FADEOUT_DIV)).style.visibility = "hidden";
    (document.getElementById(_swindow)).style.visibility = "hidden";
    (document.getElementById("divAjax")).style.visibility = "hidden";
}
if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();


