// Turn off error report
window.onerror = null;

// Set variable to not loaded
var isLoaded = 0;
// Set nav type to default to subnav
var bitSubNav = 1;

// Generic browser checking code
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.mac=(navigator.appVersion.indexOf('Mac') != -1)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
	this.safari=(this.ver.indexOf("Safari/8")>-1)?1:0;
	return this;
}

// Nav rollover code
function headswap(object, action) {
    if (document.getElementById) {
		if (action == 'show') {
        document.getElementById(object).style.background = "#E0E0E0";
        document.getElementById(object+'link').style.color = "#000000";
        document.getElementById(object+'link').style.textDecoration = "underline";
		} else {
        document.getElementById(object).style.background = "#000000";
        document.getElementById(object+'link').style.color = "#FFFFFF";
        document.getElementById(object+'link').style.textDecoration = "none";
		}
    }
}

// Once page is loaded, set variable to allow DHTML menus to be activated
//function pageLoaded() {
//	isLoaded = 1;
//}

// If home page, set nav type to non subnav on load
function isHomePage() {
	bitSubNav = 0;
}

// Check that page is loaded, otherwise do nothing
function homeActivateLayers(div,act) {
	if (isLoaded == 1) {
		homeHideAllLayers();
		homeShowHideLayers(div,act)
	}
}

// DHTML Menu Functions
function homeSetHideTimeout() {
  if (this.hideTimer) { clearTimeout(this.hideTimer); }
  this.hideTimer = setTimeout('homeHideAllLayers()', 1000);
}

function homeClearHideTimeout() {
  if (this.hideTimer) clearTimeout(this.hideTimer);
}

function homeHideAllLayers() {
	// Swap out rollover status
	if (currSection != "Home") headswap('cellHome','hide');
	if (currSection != "Consumer") headswap('cellConsumer','hide');
	if (currSection != "Professional") headswap('cellProfessional','hide');
	if (currSection != "Commercial") headswap('cellCommercial','hide');
	if (currSection != "Support") headswap('cellSupport','hide');
	if (currSection != "Corporate") headswap('cellCorporate','hide');
	if (document.getElementById) {
		if (document.getElementById('divConsumer')) document.getElementById('divConsumer').style.visibility="hidden";
		if (document.getElementById('divProfessional')) document.getElementById('divProfessional').style.visibility="hidden";
		if (document.getElementById('divCommercial')) document.getElementById('divCommercial').style.visibility="hidden";
		if (document.getElementById('divSupport')) document.getElementById('divSupport').style.visibility="hidden";
		if (document.getElementById('divBusiness')) document.getElementById('divBusiness').style.visibility="hidden";
	} else if (navigator.appName == 'Netscape' && document.layers != null) {
		if (document.layers['divConsumer']) document.layers['divConsumer'].visibility = 'hide';
		if (document.layers['divProfessional']) document.layers['divProfessional'].visibility = 'hide';
		if (document.layers['divCommercial']) document.layers['divCommercial'].visibility = 'hide';
		if (document.layers['divSupport']) document.layers['divSupport'].visibility = 'hide';
		if (document.layers['divBusiness']) document.layers['divBusiness'].visibility = 'hide';
    } else if (document.all != null) {
		if (document.all['divConsumer']) document.all['divConsumer'].style.visibility = 'hidden';
		if (document.all['divProfessional']) document.all['divProfessional'].style.visibility = 'hidden';
		if (document.all['divCommercial']) document.all['divCommercial'].style.visibility = 'hidden';
		if (document.all['divSupport']) document.all['divSupport'].style.visibility = 'hidden';
		if (document.all['divBusiness']) document.all['divBusiness'].style.visibility = 'hidden';
	}
	// Show form fields when DHTML deactivated.
	if (document.getElementById) {
		if (document.getElementById('fujiFormFields')) document.getElementById('fujiFormFields').style.visibility="visible";
	} else if (navigator.appName == 'Netscape' && document.layers != null) {
		if (document.all['fujiFormFields']) document.all['fujiFormFields'].style.visibility = 'visible';
    } else if (document.all != null) {
		if (document.layers['fujiFormFields']) document.layers['fujiFormFields'].visibility = 'show';
	}
	// Show form fields when DHTML deactivated.
	if (document.getElementById) {
		if (document.getElementById('fujiFormFields2')) document.getElementById('fujiFormFields2').style.visibility="visible";
	} else if (navigator.appName == 'Netscape' && document.layers != null) {
		if (document.all['fujiFormFields2']) document.all['fujiFormFields2'].style.visibility = 'visible';
    } else if (document.all != null) {
		if (document.layers['fujiFormFields2']) document.layers['fujiFormFields2'].visibility = 'show';
	}
}

function homeShowHideLayers() {
  homeHideAllLayers();
  homeClearHideTimeout()

  	// Hide form fields when DHTML activated.
  	if (document.getElementById) {
		if (document.getElementById('fujiFormFields')) document.getElementById('fujiFormFields').style.visibility="hidden";
	} else if (navigator.appName == 'Netscape' && document.layers != null) {
		if (document.all['fujiFormFields']) document.all['fujiFormFields'].style.visibility = 'hidden';
	} else if (document.all != null) {
		if (document.layers['fujiFormFields']) document.layers['fujiFormFields'].visibility = 'hidden';
	}

	// Hide form fields when DHTML activated.
  	if (document.getElementById) {
		if (document.getElementById('fujiFormFields2')) document.getElementById('fujiFormFields2').style.visibility="hidden";
	} else if (navigator.appName == 'Netscape' && document.layers != null) {
		if (document.all['fujiFormFields2']) document.all['fujiFormFields2'].style.visibility = 'hidden';
	} else if (document.all != null) {
		if (document.layers['fujiFormFields2']) document.layers['fujiFormFields2'].visibility = 'hidden';
	}

  var i, visStr, args, theObj;
  args = homeShowHideLayers.arguments;
  for (i=0; i<(args.length-1); i+=2) {
	// Swap in appropriate rollover status
	if ((args[i] == 'None') && (currSection != "Home")) headswap('cellHome','show');
	if ((args[i] == 'divConsumer') && (currSection != "Consumer")) headswap('cellConsumer','show');
	if ((args[i] == 'divProfessional') && (currSection != "Professional")) headswap('cellProfessional','show');
	if ((args[i] == 'divCommercial') && (currSection != "Commercial")) headswap('cellCommercial','show');
	if ((args[i] == 'divSupport') && (currSection != "Support")) headswap('cellSupport','show');
	if ((args[i] == 'divBusiness') && (currSection != "Corporate")) headswap('cellCorporate','show');
    visStr   = args[i+1];
	if (document.getElementById) {
       if (visStr == 'show') visStr = 'visible';
       if (visStr == 'hide') visStr = 'hidden';
 	   document.getElementById(args[i]).style.visibility=visStr;
    } else if (navigator.appName == 'Netscape' && document.layers != null) {
       document.layers[args[i]].visibility = visStr;
    } else if (document.all != null) {
       if (visStr == 'show') visStr = 'visible';
       if (visStr == 'hide') visStr = 'hidden';
       document.all[args[i]].style.visibility = visStr;
  	}
  }
}

// Change appearance of DHTML menu table cells on rollover
function homeRolloverbg(cellId,status) {
	// Off status settings
	if (status == 0) {
		var opac = 70;
		var textColor = '#000000';
		var bgc = '';
	 	var bgImage = 'url(/home/images/trans_bg.png)';
	 	var subbgImage = 'url(/home/images/sub_bg.gif)';
	// On status settings
	} else {
		var opac = 100;
		var textColor = '#2CB701';
		var bgc = '#FFFFFF';
	 	var bgImage = 'url(/home/images/solid_bg.png)';
	 	var subbgImage = 'url(/home/images/solid_bg.png)';
	}

	if (bitSubNav == 0) {
		if ((navigator.appVersion.indexOf("MSIE")>-1) && (document.getElementById)) document.getElementById(cellId).filters.alpha.opacity = opac;
		else {
			if (document.getElementById)  document.getElementById(cellId).style.backgroundImage = bgImage;
			if (document.all) eval(cellId).style.background = bgc;
		}
	} else {
		if ((navigator.appVersion.indexOf("MSIE")>-1) && (document.getElementById)) document.getElementById(cellId).style.background = bgc;
		else if (document.getElementById) { document.getElementById(cellId).style.backgroundImage = subbgImage; }
		else if (document.all) eval(cellId).style.background = bgc;
	}

	if (document.getElementById) document.getElementById(cellId+'text').style.color= textColor;
}

// Simple rollover for arrows in DHTML menus
function arrowRoll(imgName,imgStatus) {
	if (imgStatus == 1) arrowImg = '/home/images/arrow_on.gif';
	else arrowImg = '/home/images/arrow_off.gif';

	if (!document.layers) document.images[imgName].src=arrowImg;
}

// Background rollover for search button 
function changeBG(element,color) {
	document.getElementById(element).style.backgroundColor = color;
}

var objBrowser=new checkBrowser();