// javascripts for huttsystems.com
// $Id: jscript.js,v 1.8 2009/09/02 01:13:07 mike Exp $


function drawMenu() {
	var siteTitle = document.getElementById('title');
	siteTitle.innerHTML = 
	'<span id="titleLeft"><a href="/index.html"><img src="/images/huttsys3.png" alt="Hutt Systems, Inc."/></a></span>';

	var nav = document.getElementById('navbar');
	nav.innerHTML = 
	'<span>&nbsp;&nbsp;<a id="m1" href="/index.html" onmouseover="lightup(this)" onmouseout="nolight(this)">Home</a>&nbsp;|&nbsp;'+
	'<a id="m2" href="/empop.html" onmouseover="lightup(this)" onmouseout="nolight(this)">Research</a>&nbsp;|&nbsp;'+
	'<a id="m3" href="/products.html" onmouseover="lightup(this)" onmouseout="nolight(this)">Products</a>&nbsp;|&nbsp;'+
	'<a id="m4" href="/nm/nm.html" onmouseover="lightup(this)" onmouseout="nolight(this)">Software</a>&nbsp;|&nbsp;'+
	'<a id="m5" href="/contact.html" onmouseover="lightup(this)" onmouseout="nolight(this)">Contact</a>&nbsp;|&nbsp;'+
	'<a id="m6" href="/about.html" onmouseover="lightup(this)" onmouseout="nolight(this)">About</a></span>';

	var bottom = document.getElementById('bottom');
	bottom.innerHTML = '&copy; 2000-2010 Hutt Systems, Inc. All Rights Reserved.';
}


function lightup(item) {
    var menu_id= document.getElementById(item.id);
    menu_id.style.color="#3366cc";
}


function nolight(item) {
    var menu_id= document.getElementById(item.id);
    menu_id.style.color="#000000";
}


function validateForm(form) {
	var first = form.first.value;
	var last = form.last.value;
	var email = form.email.value;
	var affiliation = form.affiliation.value;

	if (!first) {
		alert ("Please enter your name.");
		return false;
	}

	if (!last) {
		alert ("Please enter your name.");
		return false;
	}

	if (!validateEmail(email)) {
		return false;
	}

	if (!affiliation) {
		alert ("Please enter your affiliation: University, Company, etc.");
		return false;
	}

	return true;
}


function validateEmail(email) {
  var str = email;
  var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
  if (!str.match(re)) {
    alert("Please verify email address.");
    return false;
  }
  else {
    return true;
  }
}
