/********* browser detection ***********/
var ie = (document.all)? true:false;
var ns5 = (navigator.appName.indexOf("Netscape") !=-1 && parseInt(navigator.appVersion) >= 5) ?true:false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;	
var IE5upWin = (navigator.appVersion.indexOf("MSIE 5.5") !=-1 || navigator.appVersion.indexOf("MSIE 6.0") !=-1) ?true:false;
var isMac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false; 
var isIEMac = (isMac && isIE) ? true:false;
var isNS6 = ((navigator.appName.indexOf("Netscape") != -1) && (parseInt(navigator.appVersion) > 4)) ? true:false;

/******Fix nav array*********/

if (nav2LayerArray[6] == "inspiredsolutions")
{
	nav2LayerArray[6] = "students";
}

/****************************/

/********* code for flash detection ***********/
var requiredVersion = 7;	

var flash2Installed = false;		
var flash3Installed = false;		
var flash4Installed = false;		
var flash5Installed = false;		
var flash6Installed = false;	
var flash7Installed = false;	
var flash8Installed = false;
var flash9Installed = false;
var maxVersion = 9;					
var actualVersion = 0;				
var hasRightVersion = false;

if(isIE && !isMac){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
	document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
	document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
	document.write('</SCR' + 'IPT\> \n'); 			
}

if (navigator.plugins){								
	if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]){		

		var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

		flash2Installed = (flashVersion == 2)?true:false;		
		flash3Installed = (flashVersion == 3)?true:false;
		flash4Installed = (flashVersion == 4)?true:false;
		flash5Installed = (flashVersion == 5)?true:false;
		flash6Installed = (flashVersion == 6)?true:false;
		flash7Installed = (flashVersion == 7)?true:false;
	}
}

for (var i = 2; i <= maxVersion; i++){	
	if (eval("flash" + i + "Installed") == true) actualVersion = i;
}

if (actualVersion >= requiredVersion){ 				
	hasRightVersion = true;	
} 						

/********* write flash movie to home page ***********/
function writeFlash(movie, pic, width, height) {
	if (hasRightVersion) {
		//if(isIE && !isMac){
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="728" height="268" id="harris_home_animation">');
			document.write('<param name="allowScriptAccess" value="sameDomain">');
			document.write('<param name="movie" value="harris_home_animation.swf">'); 
			document.write('<param name="quality" value="high">'); 
			document.write('<param name="bgcolor" value="#333333">');
			document.write('<param name="wmode" value="opaque">');
			//document.write('</object>');
		//} else {
			document.write('<embed src="harris_home_animation.swf" quality="high" wmode="opaque" bgcolor="#333333" width="728" height="268" name="harris_home_animation" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
			document.write('</object>');
	  	//}
	 } else {
		if (pic.indexOf("home_header") > -1) { // write home page backup
			document.write('<img src="_images/'+ pic +'" width='+ width +' height='+ height +' border=0 usemap="#headerMap">');
		} else {
			document.write('<img src="_images/'+ pic +'" width='+ width +' height='+ height +' border=0>');
		}	
	 }
}


/********* code for handling flyout menus ***********/
var layerTimeout=0;
var firstLevelNavButton = null;
//var secondLevelNavButton = null;
var activeMenuLayer = null;

// navPath is used to set the path to the images directory
if (navPath=="home"){
	pathStr = "";
}else{
	pathStr = "../";
}

function showLayer(layerName) {
	activeMenuLayer = layerName;
	for (i=0; i<=nav2LayerArray.length-1; i++) {
		layerVal = nav2LayerArray[i];
		if (ie) {
			//eval('menu'+layerVal).style.visibility = "hidden";
			document.all["level2Menu_"+layerVal].style.visibility = "hidden";
		} else if (ns5) {
			document.getElementById('level2Menu_'+layerVal).style.visibility = "hidden";
		} else {
			document.eval('level2Menu_'+layerVal).visibility = "hidden";
		}
	}
	if (ie) {
		eval(layerName).style.visibility = "visible";
	} else if (ns5) {
		document.getElementById(layerName).style.visibility = "visible";
	} else {
		document.layers[layerName].visibility = "show";
	}
	if (IE5upWin && (/*activeMenuLayer=="level2Menu_legalresources" || activeMenuLayer=="level2Menu_hcseminars" ||*/ activeMenuLayer=="level2Menu_students")){
		document.all["directoryDropdown"].style.visibility = "hidden";
	}
}

function clearTimer() {
	window.clearInterval(layerTimeout);
}

function setTimer() {
	layerTimeout = window.setTimeout('resetAllLayers()',20);
}

function resetAllLayers() {
	for (i=0; i<=nav2LayerArray.length-1; i++) {
		layerVal = nav2LayerArray[i];
		if (ie) {
			document.all["level2Menu_"+layerVal].style.visibility = "hidden";
		} else if (ns5) {
			document.getElementById('level2Menu_'+layerVal).style.visibility = "hidden";	
		} else {
			document.eval('level2Menu_'+layerVal).visibility = "hidden";
		}
	}
	if (firstLevelNavButton != null && (("btn_" + firstLevel)!=firstLevelNavButton)){
		swapImageBack(firstLevelNavButton);
		firstLevelNavButton = null;
	}
	if (IE5upWin && (/*activeMenuLayer=="level2Menu_legalresources" || activeMenuLayer=="level2Menu_hcseminars" ||*/ activeMenuLayer=="level2Menu_students")){
		document.all["directoryDropdown"].style.visibility = "visible";
	}
	activeMenuLayer = null;
}

function cleanupLayers(){
	window.clearInterval(layerTimeout);
	resetAllLayers();
}

function buttonRolloverOn(name){
	window.clearInterval(layerTimeout);
	resetAllLayers();
	var imageSrc = eval('document.images["'+name+'"].src');
	if (imageSrc.indexOf("_off.")!=-1){
		var newImageSrc = imageSrc.replace("_off.","_on.");
		document.images[name].src = newImageSrc;
	}
}

function buttonRolloverOff(name){
	var imageSrc = eval('document.images["'+name+'"].src');
	var newImageSrc = imageSrc.replace("_on.","_off.");
	document.images[name].src = newImageSrc;
}

function swapImage(name) {
	var imageSrc = eval('document.images["'+name+'"].src');
	var newImageSrc = imageSrc.replace("_off.","_on.");
	document.images[name].src = newImageSrc;
}

function swapImageBack(name) {
	var imageSrc = eval('document.images["'+name+'"].src');
	var newImageSrc = imageSrc.replace("_on.","_off.");
	document.images[name].src = newImageSrc;
}

function swap2ndLevelImage(name,layer) {
	if (("level2Menu_" + firstLevel + secondLevel)!=name) {
		if (ie||ns5) {
			var imageSrc = eval('document.images["'+name+'"].src');
			var newImageSrc = imageSrc.replace("_off.","_on.");
			eval('document.images["'+name+'"].src = newImageSrc');
		}else{
			var imageSrc = eval('document.level2Menu_'+layer+'.document.'+name+'.src');
			var newImageSrc = imageSrc.replace("_off.","_on.");
			eval('document.level2Menu_'+layer+'.document.'+name+'.src = newImageSrc');
		}
	}
}

function swap2ndLevelImageBack(name,layer){
	if (("level2Menu_" + firstLevel + secondLevel)!=name) {
		if (ie||ns5) {
			var imageSrc = eval('document.images["'+name+'"].src');
			var newImageSrc = imageSrc.replace("_on.","_off.");
			eval('document.images["'+name+'"].src = newImageSrc');
		}else{
			var imageSrc = eval('document.level2Menu_'+layer+'.document.'+name+'.src');
			var newImageSrc = imageSrc.replace("_on.","_off.");
			eval('document.level2Menu_'+layer+'.document.'+name+'.src = newImageSrc');
		}
	}
}

function swapLeftNavImage(name) {
	if (("lnav_" + firstLevel + secondLevel + thirdLevel).indexOf(name)==-1) {
		var imageSrc = eval('document.images["'+name+'"].src');
		var newImageSrc = imageSrc.replace("_off.","_on.");
		document.images[name].src = newImageSrc;
	}
}

function swapLeftNavImageBack(name) {
	if (("lnav_" + firstLevel + secondLevel + thirdLevel).indexOf(name)==-1) {
		var imageSrc = eval('document.images["'+name+'"].src');
		var newImageSrc = imageSrc.replace("_on.","_off.");
		document.images[name].src = newImageSrc;
	}
}

function swapLawyerImage(name) {
	var imageSrc = eval('document.images["'+name+'"].src');
	var newImageSrc = imageSrc.replace("_off.jpg","_on.gif");
	document.images[name].src = newImageSrc;
}

function swapLawyerImageBack(name) {
	var imageSrc = eval('document.images["'+name+'"].src');
	var newImageSrc = imageSrc.replace("_on.gif","_off.jpg");
	document.images[name].src = newImageSrc;
}

function buttonRollover(thisImgSrc){
	return thisImgSrc.replace("_off.","_on.");
}

function buttonRolloff(thisImgSrc){
	return thisImgSrc.replace("_on.","_off.");
}

/* inherited functions */
function launchLink(URL) {
	window.open(URL,"Link");
}

function NewWindow(mypage,myname,w,h,scroll) {
	var win = null;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
	win = window.open(mypage,myname,settings);
}

function NewWindowNoresize(mypage,myname,w,h,scroll) {
	var win = null;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no';
	win = window.open(mypage,myname,settings);
}

function valid(f){
	var x=f.company.value;
	if (isEmpty(x)){
		alert("please fill in the company");
		f.company.focus();
		return false;
	}
	x=f.email.value;
	if (isEmpty(x)){
		alert("please fill in your email");
		f.email.focus();
		return false;
	}
	if (!emailcheck(x)){
		alert("please fill in valid email address");
		f.email.focus();
		return false;
	}
	return true;
}


