var Page_OpenWindowVer = "1.7";


function OpenWindowOnLoad() {
    
    if ( !OpenWindowBrowserCapable() ) return;
    if (typeof(Page_OpenWindows) == "undefined") return;


    var i, OpenWindowButton;
    for (i = 0; i < Page_OpenWindows.length; i++) {
        OpenWindowButton = Page_OpenWindows[i];
        if (typeof(OpenWindowButton) == "string") {
            OpenWindowButton = document.getElementById( OpenWindowButton );
        }
        
        if ( typeof(OpenWindowButton.url ) == "undefined" ) {
            if ( typeof( OpenWindowButton.attributes ) != "undefined" ) {
                OpenWindowButton.url = OpenWindowButton.attributes["url"].value;
            } else {
                OpenWindowButton.url = "DialogTemplate.aspx";
            }
        }

        if ( typeof(OpenWindowButton.urlArgument ) == "undefined" ) {
            if ( typeof( OpenWindowButton.attributes ) != "undefined" ) {
                OpenWindowButton.urlArgument = OpenWindowButton.attributes["urlArgument"].value;
            } else {
                OpenWindowButton.urlArgument = "";
            }
        }

        if ( typeof(OpenWindowButton.urlFeature ) == "undefined" ) {
            if ( typeof( OpenWindowButton.attributes ) != "undefined" ) {
                OpenWindowButton.urlFeature = OpenWindowButton.attributes["urlFeature"].value;
            } else {
                OpenWindowButton.urlFeature = "";
            }
        }

        OpenWindowHookupControl(OpenWindowButton);
        
    }
}

function OpenWindowBrowserCapable() {
    if ( typeof( document.getElementById ) == "undefined" ) {
        if( typeof( document.all ) != "undefined" ) {
            document.getElementById = function( elementId ) { return document.all[elementId]; };
            return true;
        }
        return false;
    }
    return true;
}



function OpenWindowHookupControl( OpenWindowButton ) {
    var ev = OpenWindowButton.onclick;
    
    if (typeof(ev) == "function" ) {            
        ev = ev.toString();
        ev = ev.substring(ev.indexOf("{") + 1, ev.lastIndexOf("}"));
    }
    else {
        ev = "";
    }
    var func = new Function("OpenWindowOnClick( this ); return false; " );

    OpenWindowButton.onclick = func;
}

function OpenWindowOnClick( OpenWindowButton ) {
    var win = open( OpenWindowButton.url, "openwindow", OpenWindowButton.urlFeature );
    win.focus();
}




