﻿/********************
 This class provides methods that manage common javascript plumbing tasks
********************/
function Framework() {
}
 
Framework.IncludeJavaScript = function(jsFile) {
/* writes out a javascript include statement */
    document.write("<script type='text/javascript' src='" + jsFile + "'></" + "script>");
}

Framework.AddToOnload = function(func) {
/* appends the passed in function to the list of functions to execute load event */
    var tmpFunc = window.onload;
    window.onload = function() {
        if(tmpFunc != null) {
            tmpFunc();
        }
        func();
    }
}

Framework.AddToOnunload = function(func) {
/* appends the passed in function to the list of functions to execute unload event */
    var tmpFunc = window.onunload;
    window.onunload = function() {
        if(tmpFunc != null) {
            tmpFunc();
        }
        func();
    }
}

Framework.Hide = function(elementName) {
    var elem = document.getElementById(elementName);
    if(elem) {
        elem.style.display = "none";
    }
}

Framework.Show = function(elementName) {
    var elem = document.getElementById(elementName);
    if(elem) {
        elem.style.display = "inline";
    }
}
