

/*Validate form fields*/

function validateMyForm(){
	var x = document.getElementById('myform').getElementsByTagName("input");
	var ob; //object
	var err = 0;
	
	//Checks weather necessary input fields were left unfilled
	if(x[0].value == '' || x[0].value.length < 2){
		x[0].style.backgroundColor="#ffffd7";
		err++
	}else x[0].style.backgroundColor="#ffffff";
	
	ob = x[1].value;
	var email = ob.match("@");
	if(email == null){
		x[1].style.backgroundColor="#ffffd7";	
		err++;
	}else x[1].style.backgroundColor="#ffffff";	
	
	var select= document.getElementById('myform').getElementsByTagName("select");
	
	if(select[1].value == ''){
		select[1].style.backgroundColor="#ffffd7";
		err++
	}else select[1].style.backgroundColor="#ffffff";
	
	if(err > 0){
		return false;
	}
	else{ return true; }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////

function openWin(page){
	w = 550;
	h = 480;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=1,resizable=0,location=0,status=1,menubar=0,toolbar=1'
	win = window.open(page, "", winprops);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


////////////////////////////////////////////////////////////////////////////////////////////////////////

window.onload = function()
{
	var lis = document.getElementById('menu').getElementsByTagName('li');
	for(i = 0; i < lis.length; i++)
	{
		var li = lis[i];
		if (li.className == 'headlink')
		{
			li.onmouseover = function() { this.getElementsByTagName('div').item(0).style.display = 'block'; }
			li.onmouseout = function() { this.getElementsByTagName('div').item(0).style.display = 'none'; }
		}
	}
}
