/* define variables for "if n4 (Netscape 4), if IE (IE 4.x), 
and if n6 (if Netscape 6/W3C-DOM compliant)" */

var n4, ie, n6;

/* detecting browser support for certain key objects/methods and 
assembling a custom document object */


var doc,doc2,doc3,sty;

if (document.layers) 
{
  doc = "document.";
  doc2 = ".document.";
  doc3 = "";
  sty = "";
  n4 = true;
}
else if (document.all) 
{
  doc = "document.all.";
  doc2 = "";
  doc3 = "";
  sty = ".style";
  ie = true;
}

else if (document.getElementById) 
{
  doc = "document.getElementById('";
  doc2 ="')";
  doc3 ="')";
  sty = "').style";
  n6 = "true";
 } 

// the variables for the window dimensions
var win_width,win_height;
var centerhor, centerver;


//Get dimensions of the window
function dimensions() 
{
if(n4 || n6)
	{
	 	win_width=window.innerWidth;
		win_height=window.innerHeight;
	}
else if(ie) 
	{
  		win_width=document.body.clientWidth;
  		win_height=document.body.clientHeight;
	}

	centerhor = win_width/2;
	centerver = win_height/2;
}

//position the element on the page.

function placeIt(elem,leftPos,topPos) 
{
	docObj = eval(doc + elem + sty);
	if (n4 || n6) 
	{
		docObj.left = leftPos;
		docObj.top= topPos;
	}
	if (ie) 
	{
		docObj.pixelLeft = leftPos;
		docObj.pixelTop = topPos;
 	}
}

var loaded = 0;
var navdir = "pics/";

function preload ()
{
	top_home_off = new Image;
	top_home_off.src = navdir + "home_off.gif";
	
	top_home_on = new Image;
	top_home_on.src = navdir + "home_on.gif";
	
	top_mission_off = new Image;
	top_mission_off.src = navdir + "mission_off.gif";
	
	top_mission_on = new Image;
	top_mission_on.src = navdir + "mission_on.gif";

	top_custserv_off = new Image;
	top_custserv_off.src = navdir + "custserv_off.gif";

	top_custserv_on = new Image;
	top_custserv_on.src = navdir + "custserv_on.gif";

	top_locations_off = new Image;
	top_locations_off.src = navdir + "locations_off.gif";

	top_locations_on = new Image;
	top_locations_on.src = navdir + "locations_on.gif";
	
	top_quality_off = new Image;
	top_quality_off.src = navdir + "quality_off.gif";

	top_quality_on = new Image;
	top_quality_on.src = navdir + "quality_on.gif";

	top_products_off = new Image;
	top_products_off.src = navdir + "products_off.gif";

	top_products_on = new Image;
	top_products_on.src = navdir + "products_on.gif";
	
	anniston_off = new Image;
	anniston_off.src = navdir + "anniston_off.gif";

	anniston_on = new Image;
	anniston_on.src = navdir + "anniston_on.gif";
	
	china_off = new Image;
	china_off.src = navdir + "china_off.gif";	

	china_on = new Image;
	china_on.src = navdir + "china_on.gif";

	mexico_off = new Image;
	mexico_off.src = navdir + "mexico_off.gif";

	mexico_on = new Image;
	mexico_on.src = navdir + "mexico_on.gif";
	
	attenuators_off = new Image;
	attenuators_off.src = navdir + "attenuators_off.gif";

	attenuators_on = new Image;
	attenuators_on.src = navdir + "attenuators_on.gif";
	
	powerparts_off = new Image;
	powerparts_off.src = navdir + "powerparts_off.gif";

	powerparts_on = new Image;
	powerparts_on.src = navdir + "powerparts_on.gif";
	
	rfmag_off = new Image;
	rfmag_off.src = navdir + "rfmag_off.gif";

	rfmag_on = new Image;
	rfmag_on.src = navdir + "rfmag_on.gif";
	
	equalizers_off = new Image;
	equalizers_off.src = navdir + "equalizers_off.gif";

	equalizers_on = new Image;
	equalizers_on.src = navdir + "equalizers_on.gif";
	
	jxpatt_off = new Image;
	jxpatt_off.src = navdir + "jxpatt_off.gif";

	jxpatt_on = new Image;
	jxpatt_on.src = navdir + "jxpatt_on.gif";
	
	tcashort_off = new Image;
	tcashort_off.src = navdir + "tcashort_off.gif";

	tcashort_on = new Image;
	tcashort_on.src = navdir + "tcashort_on.gif";
	
	tcatall_off = new Image;
	tcatall_off.src = navdir + "tcatall_off.gif";

	tcatall_on = new Image;
	tcatall_on.src = navdir + "tcatall_on.gif";
	
	sxpatt_off = new Image;
	sxpatt_off.src = navdir + "sxpatt_off.gif";

	sxpatt_on = new Image;
	sxpatt_on.src = navdir + "sxpatt_on.gif";
	
	spbatt_off = new Image;
	spbatt_off.src = navdir + "spbatt_off.gif";

	spbatt_on = new Image;
	spbatt_on.src = navdir + "spbatt_on.gif";	
	
	thermal_off = new Image;
	thermal_off.src = navdir + "thermal_off.gif";

	thermal_on = new Image;
	thermal_on.src = navdir + "thermal_on.gif";
		
	testfix_off = new Image;
	testfix_off.src = navdir + "testfix_off.gif";

	testfix_on = new Image;
	testfix_on.src = navdir + "testfix_on.gif";
		
	bluejxp_off = new Image;
	bluejxp_off.src = navdir + "bluejxp_off.gif";

	bluejxp_on = new Image;
	bluejxp_on.src = navdir + "bluejxp_on.gif";
	
	blackjxp_off = new Image;
	blackjxp_off.src = navdir + "blackjxp_off.gif";

	blackjxp_on = new Image;
	blackjxp_on.src = navdir + "blackjxp_on.gif";
	
	orangejxp_off = new Image;
	orangejxp_off.src = navdir + "orangejxp_off.gif";

	orangejxp_on = new Image;
	orangejxp_on.src = navdir + "orangejxp_on.gif";
		
	testequip_off = new Image;
	testequip_off.src = navdir + "testequip_off.gif";

	testequip_on = new Image;
	testequip_on.src = navdir + "testequip_on.gif";

	lineq_off = new Image;
	lineq_off.src = navdir + "lineq_off.gif";

	lineq_on = new Image;
	lineq_on.src = navdir + "lineq_on.gif";
		
	cabeq_off = new Image;
	cabeq_off.src = navdir + "cabeq_off.gif";

	cabeq_on = new Image;
	cabeq_on.src = navdir + "cabeq_on.gif";
			
	bluesxp_off = new Image;
	bluesxp_off.src = navdir + "bluesxp_off.gif";

	bluesxp_on = new Image;
	bluesxp_on.src = navdir + "bluesxp_on.gif";
	
	redsxp_off = new Image;
	redsxp_off.src = navdir + "redsxp_off.gif";

	redsxp_on = new Image;
	redsxp_on.src = navdir + "redsxp_on.gif";
		
	yellowsxp_off = new Image;
	yellowsxp_off.src = navdir + "yellowsxp_off.gif";

	yellowsxp_on = new Image;
	yellowsxp_on.src = navdir + "yellowsxp_on.gif";
	
	orangeshort_off = new Image;
	orangeshort_off.src = navdir + "orangeshort_off.gif";

	orangeshort_on = new Image;
	orangeshort_on.src = navdir + "orangeshort_on.gif";
		
	orangetall_off = new Image;
	orangetall_off.src = navdir + "orangetall_off.gif";

	orangetall_on = new Image;
	orangetall_on.src = navdir + "orangetall_on.gif";
	
	orangetall2_off = new Image;
	orangetall2_off.src = navdir + "orangetall2_off.gif";

	orangetall2_on = new Image;
	orangetall2_on.src = navdir + "orangetall2_on.gif";
			
	orangextall_off = new Image;
	orangextall_off.src = navdir + "orangextall_off.gif";

	orangextall_on = new Image;
	orangextall_on.src = navdir + "orangextall_on.gif";
	
	splitter_off = new Image;
	splitter_off.src = navdir + "splitter_off.gif";

	splitter_on = new Image;
	splitter_on.src = navdir + "splitter_on.gif";
		
	splitter50_off = new Image;
	splitter50_off.src = navdir + "splitter50_off.gif";

	splitter50_on = new Image;
	splitter50_on.src = navdir + "splitter50_on.gif";
			
	splitter75_off = new Image;
	splitter75_off.src = navdir + "splitter75_off.gif";

	splitter75_on = new Image;
	splitter75_on.src = navdir + "splitter75_on.gif";	
	
	coupler_off = new Image;
	coupler_off.src = navdir + "coupler_off.gif";

	coupler_on = new Image;
	coupler_on.src = navdir + "coupler_on.gif";
	
	thole_off = new Image;
	thole_off.src = navdir + "thole_off.gif";

	thole_on = new Image;
	thole_on.src = navdir + "thole_on.gif";
	
	smount_off = new Image;
	smount_off.src = navdir + "smount_off.gif";

	smount_on = new Image;
	smount_on.src = navdir + "smount_on.gif";

	inductor_off = new Image;
	inductor_off.src = navdir + "inductor_off.gif";

	inductor_on = new Image;
	inductor_on.src = navdir + "inductor_on.gif";
	
	rtp_off = new Image;
	rtp_off.src = navdir + "rtp_off.gif";

	rtp_on = new Image;
	rtp_on.src = navdir + "rtp_on.gif";

	bypass_off = new Image;
	bypass_off.src = navdir + "bypass_off.gif";

	bypass_on = new Image;
	bypass_on.src = navdir + "bypass_on.gif";
	
	eq6blue_off = new Image;
	eq6blue_off.src = navdir + "eq6blue_off.gif";

	eq6blue_on = new Image;
	eq6blue_on.src = navdir + "eq6blue_on.gif";
	
	eq1blue_off = new Image;
	eq1blue_off.src = navdir + "eq1blue_off.gif";

	eq1blue_on = new Image;
	eq1blue_on.src = navdir + "eq1blue_on.gif";
		
	eq1yellow_off = new Image;
	eq1yellow_off.src = navdir + "eq1yellow_off.gif";

	eq1yellow_on = new Image;
	eq1yellow_on.src = navdir + "eq1yellow_on.gif";
			
	eq6yellow_off = new Image;
	eq6yellow_off.src = navdir + "eq6yellow_off.gif";

	eq6yellow_on = new Image;
	eq6yellow_on.src = navdir + "eq6yellow_on.gif";
		
	testprobe_off = new Image;
	testprobe_off.src = navdir + "testprobe_off.gif";

	testprobe_on = new Image;
	testprobe_on.src = navdir + "testprobe_on.gif";	
		
	jxptestprobe_off = new Image;
	jxptestprobe_off.src = navdir + "jxptestprobe_off.gif";

	jxptestprobe_on = new Image;
	jxptestprobe_on.src = navdir + "jxptestprobe_on.gif";	
		
	sxptestprobe_off = new Image;
	sxptestprobe_off.src = navdir + "sxptestprobe_off.gif";

	sxptestprobe_on = new Image;
	sxptestprobe_on.src = navdir + "sxptestprobe_on.gif";
		
	spbtestprobe_off = new Image;
	spbtestprobe_off.src = navdir + "spbtestprobe_off.gif";

	spbtestprobe_on = new Image;
	spbtestprobe_on.src = navdir + "spbtestprobe_on.gif";	
		
	sidebackground = new Image;
	sidebackground = navdir + "testbg.gif";
	loaded = 1;

}

// img src swap function
function onoff (elemparent,elem,state) 
{
	if (loaded) 
	{
		newstate = eval(elem+"_"+state);
		if (n4) 
		{
			menuObj = eval (doc + elemparent + doc2 + elem);
		}
		else if (ie || n6) 	
		{
			menuObj = eval (doc + elem + doc2);
		}
		menuObj.src = newstate.src;
	 }
}

var oncolor = "#99ccff";
var offcolor = "#6699cc";

function changecolor(divname, colorname)
{
	stopall();
	if (!n4)
	{
		menuObj = eval(doc + divname + sty);
		menuObj.backgroundColor = colorname;
	}
}

function showhide (elem, state)
{
	docObj = eval(doc + elem + sty);
	docObj.visibility = state;
}


// variables that hold the value of the currently active (open) menu
var active_submenu1 = null;
var active_submenu2 = null;
var active_submenu3 = null;
var active_submenu4 = null;
var active_menuelem = null;
var active_topelem = null;

// function closes all active menus and turns back to 'off' state
function closeallmenus() 
{
	if(active_submenu1 != null) 
	{
  		showhide(active_submenu1,'hidden');
  	}
	if(active_submenu2 != null) 
	{
		showhide(active_submenu2,'hidden');
 	}
	if(active_submenu3 != null) 
	{
		onoff(eval(active_topelem + '.' + active_menuelem), active_submenu3, 'off');
 	}
	if(active_submenu4 != null) 
	{
		showhide(active_submenu4,'hidden');
 	}
	if(active_menuelem != null) 
	{
  		onoff(active_topelem, active_menuelem,'off');
	}
	if(active_topelem != null) 
	{
  		onoff('casidemenu',active_topelem,'off');
  	}
}
// the menu close timeout variable
var menu_close_timeout = 0;

// delay in miliseconds until the open menus are closed
var delay = 500;

// function calls the closeallmenus() function after a delay
function closeall() 
{
	menu_close_timeout = setTimeout('closeallmenus()',delay);
}

// stop all timeout functions (stops menus from closing)
function stopall() 
{
	clearTimeout(menu_close_timeout);
}

// function controls submenus 
function controlsubmenu(submenu1,submenu2,submenu3,submenu4,menuelem,topelem) 
{
	stopall();
	closeallmenus();
	if (submenu1 != null) 
	{
  		showhide(submenu1,'visible');
		active_submenu1 = submenu1;
	}
	if (submenu2 != null) 
	{
		showhide(submenu2,'visible');
		active_submenu2 = submenu2;
	}
	if (submenu3 != null) 
	{
		onoff(eval(topelem +'.'+ menuelem),submenu3, 'on');
		active_submenu3 = submenu3;
	}
	if (submenu4 != null) 
	{
		showhide(submenu4,'visible');
		active_submenu4 = submenu4;
	}
	if (menuelem != null) 
	{
		onoff(topelem, menuelem,'on');
		active_menuelem = menuelem;
	}
	if (topelem != null) 
	{
		onoff('casidemenu',topelem,'on');
		active_topelem = topelem;
	}
}

function initialize()
{
	preload();
	closeallmenus();
	stopall();
	dimensions();
	placeIt("products", 169,132);
	placeIt("locations",169, 275);
	placeIt("jxpattmenu", 315, 132);
	placeIt("orangemenu", 460,185);
	placeIt("tcaattmenu", 315, 159);
	placeIt("sxpattmenu", 315, 185);
	placeIt("rfmenu", 315, 209);
	placeIt("splittermenu", 460, 209);
	placeIt("couplermenu", 460, 235);
	placeIt("eqbluemenu", 315, 260);
	placeIt("eqyellowmenu", 315, 235);
	placeIt("testequipmenu", 315, 287);
	placeIt("testprobesmenu", 460, 315);
}
