window.onload = Document_load;

// VARIABLE DECLARATION

var blnSpecialFunction;

var colToolbar = new Array();
var astrUrl = new Array();
var blnDocumentLoaded = false;

function Document_load() {
        blnDocumentLoaded = true;
        Initialize();
        PreloadImages();
        if (blnSpecialFunction) SpecialFunction();
}


function Initialize() {
        astrUrl = unescape(location.href).substr(location.href.indexOf("/", 7)).split("/");
}


function Button(intStatus, intButton) {
        // Don't do anything if the page is still being loaded
        if (blnDocumentLoaded) {
                document.getElementById("toolbar"+intButton).src = colToolbar[intButton][intStatus].src;
        }
}


function ButtonB(intStatus, intButton) {
        // Don't do anything if the page is still being loaded
        if (blnDocumentLoaded) {
                document.getElementById("toolbarB"+intButton).src = colToolbar[intButton][intStatus].src;
        }
}


function PreloadImages() {
        // PRELOAD TOOLBAR IMAGES
        var strMatch;
        var astrToolbar;

        if (astrUrl[1] == "acc") {
                astrToolbar = new Array("archsig", "archcit", "archus", "archreg", "archint", "dougnewby", "homepage_asa");
                strMatch = astrUrl[2];
                if (strMatch == "") strMatch = "homepage_asa";
        } else {
                astrToolbar = new Array("home", "texasmod", "current", "significant", "contact");
                strMatch = astrUrl[1];
        }

        for (i=0;i<astrToolbar.length;i++) {
                colToolbar[i] = new Array();
                colToolbar[i][0] = new Image();
                if (astrToolbar[i]==strMatch) {
                        colToolbar[i][0].src = "/images/toolbarDMH/"+astrToolbar[i]+"_on.gif";
                        Button(0,i);
                        ButtonB(0,i);
                } else {
                        colToolbar[i][0].src = "/images/toolbarDMH/"+astrToolbar[i]+"_off.gif";
                }
                colToolbar[i][1] = new Image();
                colToolbar[i][1].src = "/images/toolbarDMH/"+astrToolbar[i]+"_on.gif";
        }
}


function GoTo(strUrl, strWindow) {
        if (strWindow=="undefined") strWindow = "_blank";
        var intWindowHeight = (screen.height*2)/3;
        var intWindowWidth = screen.width/2;
        var strWindowProperties = "toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes,width="+intWindowWidth+",height="+intWindowHeight+",left="+((screen.width-intWindowWidth)/2)+",top="+((screen.height-intWindowHeight)/2);
        var NewWindow = window.open(strUrl, strWindow, strWindowProperties);
        NewWindow.focus();
}


function ImageViewer(strImage, strRoot) {
        var strUrl = "/ImageViewer.asp?img="+strImage+"&root="+strRoot;
        var intWindowHeight = 790;
        var intWindowWidth = 795;
        var strWindowProperties = "toolbar=no,location=no,status=yes,resizable=yes,scrollbars=yes,width="+intWindowWidth+",height="+intWindowHeight+",left="+((screen.width-intWindowWidth)/2)+",top="+((screen.height-intWindowHeight)/2);
        var NewWindow = window.open(strUrl, "ImageViewer", strWindowProperties);
        NewWindow.focus();
}


function ImageViewer(strImage, strRoot, strTitle) {
        var strUrl = "/ImageViewer.asp?img=" + strImage + "&root=" + strRoot + "&title=" + strTitle;
        var intWindowHeight = 790;
        var intWindowWidth = 795;
        var strWindowProperties = "toolbar=no,location=no,status=yes,resizable=yes,scrollbars=yes,width="+intWindowWidth+",height="+intWindowHeight+",left="+((screen.width-intWindowWidth)/2)+",top="+((screen.height-intWindowHeight)/2);
        var NewWindow = window.open(strUrl, "ImageViewer", strWindowProperties);
        NewWindow.focus();
}

function ImageViewerACC(strImage, strRoot) {
        var strUrl = "/ImageViewerACC.asp?img="+strImage+"&root="+strRoot;
        var intWindowHeight = 790;
        var intWindowWidth = 795;
        var strWindowProperties = "toolbar=no,location=no,status=yes,resizable=yes,scrollbars=yes,width="+intWindowWidth+",height="+intWindowHeight+",left="+((screen.width-intWindowWidth)/2)+",top="+((screen.height-intWindowHeight)/2);
        var NewWindow = window.open(strUrl, "ImageViewer", strWindowProperties);
        NewWindow.focus();
}


function ImageViewerACC(strImage, strRoot, strTitle) {
        var strUrl = "/ImageViewerACC.asp?img=" + strImage + "&root=" + strRoot + "&title=" + strTitle;
        var intWindowHeight = 790;
        var intWindowWidth = 795;
        var strWindowProperties = "toolbar=no,location=no,status=yes,resizable=yes,scrollbars=yes,width="+intWindowWidth+",height="+intWindowHeight+",left="+((screen.width-intWindowWidth)/2)+",top="+((screen.height-intWindowHeight)/2);
        var NewWindow = window.open(strUrl, "ImageViewer", strWindowProperties);
        NewWindow.focus();
}
