﻿// Check browser.
var isMac = (navigator.userAgent.indexOf("Mac") != -1);
var isOpera = (navigator.userAgent.toLowerCase().indexOf('opera') > -1 && document.createTextNode);  // Opera 7
var isNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4);
var isNs6 = (document.getElementById) && !document.all ? true : false;
var isIe4 = (document.all) ? true : false;
var isIe5 = false; 
var isIe55 = false; // Added additional variable to identify IE5.5+

// Resize fix for NS4.x to keep track of layer
if (isNs4) 
{
	var oW = window.innerWidth;
	var oH = window.innerHeight;
	window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); }
}

// Microsoft Version Check.
if (isIe4) 
{
	var agent = navigator.userAgent;
	if (/MSIE/.test(agent)) 
	{
		var versNum = parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]);
		if (versNum >= 5){
			isIe5 = true;
			isIe55 = (versNum >= 5.5 && !isOpera) ? true : false;
			if (isNs6) 
			    isNs6 = false;
		}
	}
	if (isNs6) olIe4 = false;
}

// Get an element given it's ID.
function GetElement(id)
{
    if (isNs6)
    {
        return document.getElementById(id);
    }
    else if (isIe4 || isIe5 || isIe55)
    {
        return document.all[id];
    }
    else if (isNs4)
    {
        return document.layers[id];
    } 
}

function NavHoverOver(obj, img, swapimg, leftsepID, leftsepImg, rightsepID, rightsepImg) {
	imageObject = GetElement(img);
	
	if (isIe55) {
		obj.className+=" iehover";
	}
	
	if (imageObject != null) {
		imageObject.src = swapimg;	
	}
	
	if (leftsepID != null) {
	    sepObject = GetElement(leftsepID);
	    sepObject.src = leftsepImg;
	}
	
	if (rightsepID != null) {
	    rightsepObject = GetElement(rightsepID);
	    rightsepObject.src = rightsepImg;
	}

}

function NavHoverOut(obj, img, swapimg, leftsepID, leftsepImg, rightsepID, rightsepImg) {
	imageObject = GetElement(img);
	if (isIe55) {
		obj.className=obj.className.replace(new RegExp(" iehover\\b"), "");
	}

	if (imageObject != null) {
		imageObject.src = swapimg;	
	}
	
	if (leftsepID != null) {
	    sepObject = GetElement(leftsepID);
	    sepObject.src = leftsepImg;
	}
	
	if (rightsepID != null) {
	    rightsepObject = GetElement(rightsepID);
	    rightsepObject.src = rightsepImg;
	}

}


