// JavaScript Document

	function doHighLow(e) {
		if (!e) var e = window.event;
		//alert(e.target.id);
		var target; 
		var type; 
		;
		if(e.target) {
			target= e.target.id;
		} else {
			target = e.srcElement.id;	
		}
		var targetObj = document.getElementById(target+'low');
		
		if (e.type == 'mouseover') {
			targetObj.className = 'navhigh';
			//targetObj.width=target.width;
		} else {
			targetObj.className = 'navlow';
			//targetObj.width=target.width;
		}	
	}
	
	function addNavListeners() {
		var home = document.getElementById("home");

		if (home.addEventListener){
			home.addEventListener('mouseover', doHighLow, false);
			home.addEventListener('mouseout', doHighLow, false);
			document.getElementById("homelow").className = 'navlow';
			
			var features = document.getElementById("features");
			features.addEventListener('mouseover', doHighLow, false);
			features.addEventListener('mouseout', doHighLow, false);
			document.getElementById("featureslow").className = 'navlow';
			
			var designs = document.getElementById("designs");
			designs.addEventListener('mouseover', doHighLow, false);
			designs.addEventListener('mouseout', doHighLow, false);
			document.getElementById("designslow").className = 'navlow';
			
			var compare = document.getElementById("compare");
			compare.addEventListener('mouseover', doHighLow, false);
			compare.addEventListener('mouseout', doHighLow, false);
			document.getElementById("comparelow").className = 'navlow';
			
			var pricing = document.getElementById("pricing");
			pricing.addEventListener('mouseover', doHighLow, false);
			pricing.addEventListener('mouseout', doHighLow, false);
			document.getElementById("pricinglow").className = 'navlow';
			
			var freetrial = document.getElementById("freetrial");
			freetrial.addEventListener('mouseover', doHighLow, false);
			freetrial.addEventListener('mouseout', doHighLow, false);
			document.getElementById("freetriallow").className = 'navlow';
			
			var why = document.getElementById("why");
			why.addEventListener('mouseover', doHighLow, false);
			why.addEventListener('mouseout', doHighLow, false);
			document.getElementById("whylow").className = 'navlow';
			
			var support = document.getElementById("support");
			support.addEventListener('mouseover', doHighLow, false);
			support.addEventListener('mouseout', doHighLow, false);
			document.getElementById("supportlow").className = 'navlow';
	
			var contact = document.getElementById("contact");
			contact.addEventListener('mouseover', doHighLow, false);
			contact.addEventListener('mouseout', doHighLow, false);
			document.getElementById("contactlow").className = 'navlow';
		
			var signup = document.getElementById("signup");
			signup.addEventListener('mouseover', doHighLow, false);
			signup.addEventListener('mouseout', doHighLow, false);
			document.getElementById("signuplow").className = 'navlow';
	
			var passform = document.getElementById("passform");
			if(passform != null) {
				passform.addEventListener('keypress', detectKey, false);
			}
		} else if (home.attachEvent){
			/* oh how i love ie! 
			home.attachEvent('onmouseover', doHighLow);
			home.attachEvent('onmouseout', doHighLow);
			
			var features = document.getElementById("features");
			features.attachEvent('onmouseover', doHighLow);
			features.attachEvent('onmouseout', doHighLow);
			
			var designs = document.getElementById("designs");
			designs.attachEvent('onmouseover', doHighLow);
			designs.attachEvent('onmouseout', doHighLow);
			
			var compare = document.getElementById("compare");
			compare.attachEvent('onmouseover', doHighLow);
			compare.attachEvent('onmouseout', doHighLow);
			
			var pricing = document.getElementById("pricing");
			pricing.attachEvent('onmouseover', doHighLow);
			pricing.attachEvent('onmouseout', doHighLow);
			
			var freetrial = document.getElementById("freetrial");
			freetrial.attachEvent('onmouseover', doHighLow);
			freetrial.attachEvent('onmouseout', doHighLow);
			
			var why = document.getElementById("why");
			why.attachEvent('onmouseover', doHighLow);
			why.attachEvent('onmouseout', doHighLow);
			
			var support = document.getElementById("support");
			support.attachEvent('onmouseover', doHighLow);
			support.attachEvent('onmouseout', doHighLow);
	
			var contact = document.getElementById("contact");
			contact.attachEvent('onmouseover', doHighLow);
			contact.attachEvent('onmouseout', doHighLow);
		
			var signup = document.getElementById("signup");
			signup.attachEvent('onmouseover', doHighLow);
			signup.attachEvent('onmouseout', doHighLow);
			*/
			var passform = document.getElementById("passform");
			if(passform) {
				passform.attachEvent('onkeypress', detectKey);
			}
		}
		

	}
	
	function verifyLogin(obj) {
		error = '';
		if(obj.username.value.length == 0 || obj.username.value =='Login:') {
			error += ' - You must enter a username\n';
		}

		if(obj.password.value.length == 0 || obj.password.value == 'Password:') {
			error += ' - You must enter a password\n';
		}
		if(error.length > 0) {
			alert('In order to login, please correct the following:\n'+error);
		} else {
			obj.submit();
		}
	}
	
	function detectKey(e) {
		if (!e) var e = window.event;
		if (e.keyCode == 13) {
			verifyLogin(document.topauth);	
		}
	}