// detect browsers
var ns, ns6, ie, ie4, ie5;
bname = navigator.appName;
ver = navigator.appVersion;
int_ver = parseInt(ver);
if (bname.indexOf("Netscape") >= 0 && int_ver == 4) ns = 1;
if (bname.indexOf("Netscape") >= 0 && int_ver == 5) ns6 = 1; 
if (bname.indexOf("Microsoft Internet Explorer") >=0 && int_ver >= 4) ie = 1;
if (navigator.userAgent.indexOf('MSIE 4')>0) ie4 = 1;
if (navigator.userAgent.indexOf('MSIE 5')>0) ie5 = 1;
if (navigator.userAgent.indexOf('MSIE 5.5')>0) ie55 = 1;

var imgActive =""
var loaded=0;
var linestat=0;
var currOpen="";
var lineOpen="";
window.onload=init;


//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT
 

var separator = "<div id=\"space\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td valign=\"top\"><img src=\"../images/onepixel.gif\" width=\"19\" height=\"200\" border=\"0\"></td></tr></table></div>"
var separator2 = "<div id=\"space\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td valign=\"top\"><img src=\"../../images/onepixel.gif\" width=\"19\" height=\"200\" border=\"0\"></td></tr></table></div>"
var separatortop = "<div id=\"space\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td valign=\"top\"><img src=\"images/onepixel.gif\" width=\"19\" height=\"200\" border=\"0\"></td></tr></table></div>"

function init() {
// capture all mouseout events in netscape and assign event to handler
	if (ns) {
		for (var i=0;i<document.layers.length;i++) {
			var thisObj = document.layers[i];
			if (thisObj.id != "space") {
			thisObj.captureEvents(Event.MOUSEOUT);
			thisObj.onmouseout = hideit;
				}
				else {; 
			}
		}
	}
	
loaded = 1;
linestat = 1;
eval(cmd);
pass = true
}

if (ns) {
	winw = window.innerWidth;
	winh = window.innerHeight;
	window.onResize = reloadwin;
}

if (ns6) {
	winw = window.innerWidth;
	winh = window.innerHeight;
	window.onResize = reloadwin;
}
function reloadwin () {
	if ((winw != window.innerWidth) || (winh != window.innerHeight)) {
		document.location.href = document.location.href;
	}
}

//start the page with a quasi random image show in content area
var theImg = "";
var num = Math.random(3)*10;
	if (num <= 3) {
		var	theImg ='\"images/start1.jpg\"';
	}
	if (num >= 6) {
		var	theImg ='\"images/start2.jpg\"';
	}
	if ((num >=3) && (num <= 6)) {
		var	theImg ='\"images/start3.jpg\"';
	}
var startImg = "<img border=\"0\" src="+theImg+">";

var itemOpen = "";

var pass = true;
function menuOn(img1,img2,menu) {
	if (!loaded) return;
		pass = false;
		hideOpen();
		flip(img1,img2);
		imgActive = img1;
		show(menu);
}

function menuoff(img1,img2,menu) {
	if (!loaded) return;
		pass = true;
		hideOpen();
		flip(img2,img1);
		imgActive = img2;
		show(menu);
}
function contOn(img1,img2,menu,line) {
	if (!loaded) return;
		pass = false;
		hideOpen();
		flip(img1,img2);
		imgActive = img1;
		show(menu);
		showline(line);
}

function showline(strObj) {
	if (!linestat) return;
	var thisObj = getObjStyle(strObj);
	thisObj.visibility = (ns)? "show" : "visible";
	lineOpen=strObj;
}

function hideline(strObj) {
	if (!linestat) return;
	var thisObj = getObjStyle(strObj);
	thisObj.visibility = (ns)? "hide" : "hidden";
	lineOpen="";
}

// DynaMenus v.2.0 (c) 2000 DynaMind-LLC
// Show and hide menu system with transparency option
// Programmed By: Stephen Machnowski
// supports nested references for netscape
function getObjStyle(objTree) {
	var objStrArr = objTree.split('.');
	var objStr = objStrArr[objStrArr.length-1];
	var strS = "";
	if (ns) {
		strS += "document.layers[objStrArr[0]]";
		if (objStrArr.length > 1) {
			for (var i=1; i<objStrArr.length; i++) {
				strS += ".document.layers[objStrArr["+i+"]]";
			}
		}
	return (eval(strS));
	}
	else if (ie) {
		return (document.all[objStr].style);
	}
}

// hides any open menu (currOpen)
// shows hidden menu layer
// assigns name of this layer to currOpen
// event handler for netscape onmouseout
function show(strObj) {
	if (!loaded) return;
	var thisObj = getObjStyle(strObj);
	if (ie) {
		thisObj.visibility = "visible";
	}
	if (ns) {
		thisObj.visibility = "show";
	}
	if (ns6) {
	  if (document.getElementById &&
          document.getElementById(strObj) &&
          document.getElementById(strObj).style)
          document.getElementById(strObj).style.visibility="visible";
	}
	if (strObj.indexOf('Menu')>=0) {
	currOpen=strObj;
	}
}

function hide(strObj) {
	if (!loaded) return;
	var thisObj = getObjStyle(strObj);
		if (ie){
			var thisDoc = document.all[strObj];
			if (!(thisDoc.contains(window.event.toElement))) {
					thisObj.visibility="hidden";
				if (imgActive != "") {flip(imgActive,imgActive)}
				}
			}
		if (ns) {
				thisObj.visibility = "hide";
				if (imgActive != "") {flip(imgActive,imgActive);}
				}
		if (ns6) {
				  if (document.getElementById &&
          			  document.getElementById(strObj) &&
          			  document.getElementById(strObj).style)
          			  document.getElementById(strObj).style.visibility="hidden";		
				if (imgActive != "") {flip(imgActive,imgActive);}
				}
	currOpen="";
	if (pass) {
		if ((ie) && !(thisDoc.contains(window.event.toElement))) {
		eval(cmd);
		}
		if (ns) {
			eval(cmd);
		}
		if (ns6) {
			eval(cmd);
		}
	}
pass = true
}


function hideit (e) {
	if (!loaded) return;
	if (!linestat) return;
	var layname = e.target.name;
	var tar = e.target+"";
	if ((tar.indexOf('Layer')>=0) && (layname.indexOf('cont')==-1)) {
		hide(layname);
	}
	else {
		routeEvent(e);
	}
}

function hideOpen() {
//	alert (currOpen);
	if (currOpen != "") {
		hide(currOpen);
	}
//	alert (lineOpen);
	if (lineOpen != "") {
		hideline(lineOpen);
	}
}


//user defined variables
var alphaLevel = 100; // any val < 100 = transparency level

function flip() {
	if (document.images) {
		var num_arg = arguments.length-1;
		var layername = "";
		var thisObj;
		
		if ((arguments.length%2) != 0) {
			layername = arguments[num_arg];
		}
		for (var i=0; i<num_arg; i) {
			var j = i+1;
			var imgname = arguments[i];
			var imgsrc = arguments[j];
			if (ns && layername) {
				thisObj = getObjStyle(layername);
				thisObj.document.images[imgname].src = eval(imgsrc+'.src');
			}
			else {
				document.images[imgname].src = eval(imgsrc+'.src');
			}
			i+=2;
		}
	}
}

//jump menu for careers
function infogo() {
	if ((navigator.userAgent && navigator.userAgent.indexOf('Mac') != -1) && (navigator.appVersion && parseInt(navigator.appVersion) < 4) && (navigator.appName && navigator.appName.indexOf('Microsoft') != -1)) return;
	url = document.goform.related.options[document.goform.related.selectedIndex].value;
	if (url == '#' || url == '') return;
	location.href = url;
}

//FLASH DETECT
/* DynaFlashDetect 5.0 (c) 2000 DynaMind-LLC */
var shockver = 0;
var flashcode = "";

// Netscape Detection in JavaScript
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

if (plugin) {
	if ( parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) == 3 ) shockver = 3;
	if ( parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 4 ) shockver = 4;
}

// IE Detection in VBScript
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.userAgent.indexOf("Windows")>=0 && navigator.userAgent.indexOf("3.1")<0)) {
	document.write('\<script language=\"VBScript\"\> \n');
	document.write('Private i, x, MM_FlashControlVersion \n');
    document.write('On Error Resume Next \n');
	document.write('x = null \n');
	document.write('MM_FlashControlVersion = 0 \n');
	document.write('var Flashmode \n');
	document.write('FlashMode = False \n');
	document.write('For i = 5 To 1 Step -1 \n');
	document.write('Set x = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n');
	document.write('MM_FlashControlInstalled = IsObject(x) \n');
	document.write('If MM_FlashControlInstalled Then \n');
	document.write('MM_FlashControlVersion = CStr(i) \n');
	document.write('Exit For \n');
	document.write('End If \n');
	document.write('Next \n');
	document.write('shockver = MM_FlashControlVersion \n');
    document.write('\<\/SCRIPT\> \n');
}

if ( shockver >= 4 ) {
    flashcode = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	flashcode += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=3,0,0,0"';
	flashcode += ' ID=client WIDTH=557 HEIGHT=112>';
	flashcode += '  <PARAM NAME=movie VALUE="images/mainflash.swf"> ';
	flashcode += '  <PARAM NAME=loop VALUE=true> ';
	flashcode += '  <PARAM NAME=quality VALUE=high> ';
	flashcode += '<EMBED SRC="images/mainflash.swf"';
	flashcode += ' swLiveConnect=FALSE WIDTH=557 HEIGHT=112';
	flashcode += ' LOOP=true QUALITY=high';
	flashcode += ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
	flashcode += '</EMBED>';
	flashcode += '</OBJECT>';
}
else {
	flashcode = '<img src="images/flash_static.jpg" width="555" height="112" alt="" border="0">';
}

if ( shockver >= 4 ) {
    flashcode1 = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	flashcode1 += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=3,0,0,0"';
	flashcode1 += ' ID=client WIDTH=549 HEIGHT=122>';
	flashcode1 += '  <PARAM NAME=movie VALUE="images/build13.swf"> ';
	flashcode1 += '  <PARAM NAME=loop VALUE=true> ';
	flashcode1 += '  <PARAM NAME=quality VALUE=high> ';
	flashcode1 += '<EMBED SRC="images/build13.swf"';
	flashcode1 += ' swLiveConnect=FALSE WIDTH=549 HEIGHT=122';
	flashcode1 += ' LOOP=true QUALITY=high';
	flashcode1 += ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
	flashcode1 += '</EMBED>';
	flashcode1 += '</OBJECT>';
}
else {
	flashcode1 = '<img src="images/flash_static.jpg" width="555" height="122" alt="" border="0">';
}

function showprodinfo(strObj) {
	var thisObj = getObjStyle(strObj);
	thisObj.visibility = (ns)? "show" : "visible";
}

function hideprodinfo(strObj) {
	var thisObj = getObjStyle(strObj);
	thisObj.visibility = (ns)? "hide" : "hidden";
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
