﻿/* Hide an element and fill the space it took up */
function hide(elementId) {
    changeClass(elementId, 'off');
}

function show(elementId) {
    changeClass(elementId, 'on');
}

/*************************
* UTILITY FUNCTIONS    	 *
**************************/
/*************************
* changeClass          	 *
***************************************************
* Switches the className value of an element      *
* Parameters:          							  *
*   - elementId: The id of the element to switch  *
*   - className: The class to set the element to  *
* Results:             							  *
*   - The element will be set to the given class  *
***************************************************/
function changeClass(elementId, className) {
    //alert('Setting ' + elementId + ' to ' + className);
    // Get a reference to the element
    element = document.getElementById(elementId);
    // Make sure the element was on the page
    if (element) {
        // Update the element's className property
        element.className = className;
    } else {
        //  alert(elementId + ' not found.');
    }
}

var imageUrls = ["/style%20library/Images/BtnNavAboutOff.png",
    "/style%20library/Images/BtnNavTreatmentOff.png",
    "/style%20library/Images/BtnNavCaregiversOff.png",
    "/style%20library/Images/BtnNavCommunityOff.png",
    "/style%20library/Images/BtnNavGetInvolvedOff.png",
    "/style%20library/Images/BtnNavAboutOn.png",
    "/style%20library/Images/BtnNavTreatmentOn.png",
    "/style%20library/Images/BtnNavCaregiversOn.png",
    "/style%20library/Images/BtnNavCommunityOn.png",
    "/style%20library/Images/BtnNavGetInvolvedOn.png",
    "/Style%20Library/Images/NavDrop1BG.png",
    "/Style%20Library/Images/NavDrop1BGHover.png",
    "/Style%20Library/Images/NavDrop2ItemBG.png",
    "/Style%20Library/Images/NavDrop2ItemBGHover.png"];
var images = [];

for (var i = 0; i < imageUrls.length; i++) {
    var image = new Image();
    image.src = imageUrls[i];
    images.push(image);
}

// Please leave this comment in place
// Created by: Randy Drisgill (The Mossman)
// August 17, 2007
//
// THIS OVERRIDES THE OOTB SHAREPOINT FUNCTION WHICH CAUSES ACTIVEX INSTALL ISSUES
//
// Essentially it overrides the ootb sharepoint function which calls the activex object
// See http://support.microsoft.com/default.aspx/kb/931509 for info on the issue
//
// To use in masterpage use this syntax in the <head>:
//  	<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>
//   	<script type="text/javascript" src="/_catalogs/masterpage/custom_activex_override.js"></script>
function ProcessDefaultOnLoad(onLoadFunctionNames) {
    //** Uncomment this to see when this runs
    //alert('Fixing the Issue');

    ProcessPNGImages();
    UpdateAccessibilityUI();

    //** We comment out the offending ootb function
    //** and leave the rest of the functions as they were
    //ProcessImn();
    for (var i = 0; i < onLoadFunctionNames.length; i++) {
        var expr = "if(typeof(" + onLoadFunctionNames[i] + ")=='function'){" + onLoadFunctionNames[i] + "();}";
        eval(expr);
    }
    if (typeof (_spUseDefaultFocus) != "undefined")
        DefaultFocus();
}
