﻿//highlight top nav menu item currently active

//not used
function LoadHomeBoxes() {
fadebox("bb0",1000);
fadebox("bb1",2000);
fadebox("bb2",3000);
fadebox("bb3",4000);
}

function fadebox(id,duration) {
    $('#' + id).fadeIn(duration, function () {
        // Animation complete.
    });
}

function ActivateMenu(menutitle) {
var currentid = document.getElementById(menutitle).id;
if (currentid.indexOf("active") == (-1)) {
currentid=currentid + "active";
document.getElementById(menutitle).id=currentid;
}
else {

        currentid = currentid.replace("active", "");
        document.getElementById(menutitle).id = currentid;

}
}

function playDemo() {
    var strHTML = new String();
			
    strHTML += '<object id="player" codeBase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="730" height="490" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">';
    strHTML += '<param name="movie" VALUE="http://www.omsonline.net/OMSPhantom.swf" />';
    strHTML += '<param name="allowFullScreen" VALUE="true">';
    strHTML += '<param name="allowscriptaccess" value="always" />';
    strHTML += '<param name="salign" VALUE="TL">';
    strHTML += '<param name="scale" VALUE="exactFit">';
    strHTML += '<param name="FlashVars" value="videos=il81fls35234/OMSOnline/Videos/OMS_FSI_final&fms=media01.omsonline.net&app=str" />';
    strHTML += '<embed pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" FlashVars="videos=il81fls35234/OMSOnline/Videos/OMS_FSI_final&fms=media01.omsonline.net&app=str" salign="TL" scale="exactFit" allowFullScreen="true" src="http://www.omsonline.net/OMSPhantom.swf" type="application/x-shockwave-flash" width="730" height="490" name="player"></embed>';
    strHTML += '</object>';

    setOverlayCustom(strHTML);
    }

//**************************************************************//
//functions to display / close overlay message throughout the site
//
//displayHTML = HTML of the overlay message
//--------------------------------------------------------------//
var prevHeight = 0;
var prevWidth = 0;
function setOverlayCustom(displayHTML) {
    var overlay = document.getElementById("overlay");
    var overlay_background = document.getElementById("overlay_background");

    if(typeof displayHTML != "undefined") {
        displayHTML = "<div style=\"text-align: right;\"><a href=\"#\" onclick=\"cancelOverlay();\" style=\"font-weight:bold;font-size:14px;color:#000000;\">Close</a>&nbsp;<a href=\"#\" onclick=\"cancelOverlay();\" style=\"background-color:#333333; color:#FFFFFF; padding-left:3px; padding-right:3px; font-weight:bold; font-size:12px; text-decoration:none;\">X</a></div>" + displayHTML;    
        overlay.innerHTML = displayHTML;
    }    

    overlay.style.display = "block";
    overlay_background.style.display = "block";

    var documentHeight = document.documentElement.clientHeight;
    //var divHeight = overlay.offsetHeight;
    var divHeight = 515;

    var documentWidth = document.body.clientWidth;
    //var divWidth = overlay.offsetWidth;
    var divWidth = 720;
    
    //NOTE: Added this because it continued to pad the height and width when repeatedly opened on same page.
    if(prevHeight > 0) {
        divHeight = prevHeight;
    }
    if(prevWidth > 0) {
        divWidth = prevWidth;
    }
    
    var maxHeight = 0;
    if(window.innerHeight) {
        if(window.innerHeight > maxHeight) { maxHeight = window.innerHeight; }
    }
    if(document.documentElement && document.documentElement.clientHeight) {
        if(document.documentElement.clientHeight > maxHeight) { maxHeight = document.documentElement.clientHeight; }
    }
    if(document.body) {
        if(document.body.clientHeight > maxHeight) { maxHeight = document.body.clientHeight; }
    }
    if(document.body.scrollHeight) { 
        if(document.body.scrollHeight > maxHeight) { maxHeight = document.body.scrollHeight; }
    }
    if(overlay.offsetHeight) {
        if(overlay.offsetHeight > maxHeight) { maxHeight = overlay.offsetHeight; }
    }
    
    overlay_background.style.height = maxHeight + "px";
    
    if(document.body.scrollWidth > overlay.offsetWidth) {
        overlay_background.style.width = document.body.scrollWidth + "px";
    }
    else {
        overlay_background.style.width = overlay.offsetWidth + "px";
    }
    
    if(divHeight > 515)  {
        divHeight = 515;
    }
    if(divWidth > 740) {
        divWidth = 740;
    }
    
    prevHeight = divHeight;
    prevWidth = divWidth;
    
    overlay.style.height = divHeight + "px";
    overlay.style.width = divWidth + "px";
    
    var xPos = (documentHeight - divHeight) / 2;
    var yPos = (documentWidth - divWidth) / 2  - 25;
    
    overlay.style.top = xPos + "px";
    overlay.style.left = yPos + "px";
}

function cancelOverlay() {
    var overlay = document.getElementById("overlay");
    var overlay_background = document.getElementById("overlay_background");

    overlay.innerHTML = "&nbsp;";
    overlay.style.display = "none";
    overlay_background.style.display = "none";
}
//**************************************************************//

function clearForm() {
    document.getElementById('aspnetForm').reset();
}

function toggleActiveControl(control) {

    var activeClassName = "input_active";

    if (control.className != activeClassName) {
        control.className = activeClassName;
    }
    else {
        control.className = "";
    }

}

function GetCurrentYear() {
    var d = new Date();
    return d.getFullYear();
    //alert(label.value )
}

$(document).ready(function () {
    // put all your jQuery goodness in here.

    //var padTop;

    //    $(".SuperButton").mousedown(function () {
    //        //alert('Handler for .mousedown() called.');
    //        //alert($(this).css('padding-top'));
    //        $(this).css('padding-top', '+10');
    //        //this.style.paddingTop = '1px';
    //        return false;
    //    });

    //    $(".SuperButton").mousedown(function () {
    //        //alert('Handler for .mouseup() called.');
    //        $(this).css('padding-top', '0');
    //        //this.style.paddingTop = '0px';
    //    });

    $(".SuperButton").mouseenter(function () {
        //debugger;
        //alert(this);
        this.src = this.src.replace('.png', '_hover.png');
    });
    $(".SuperButton").mouseleave(function () {
        //debugger;
        this.src = this.src.replace('_hover.png', '.png');
        //alert(this.src);
    });

});
