/* Validation for Contact Form */

function checkform(f){
	if (f.Name.value.length==0) { 
		alert("Please enter your name.");
		f.Name.select();
		return false;
	}

	if (f.Subject.value.length==0) {
		alert("Please enter a subject.");
		f.Subject.focus();
		return false;
	}
	
	if (f.Message.value.length==0) { 
		alert("Please enter your message.");
		f.Message.select();
		return false;
	}
	
	f.chk.value="chk";
	
	return checkmail(f.email);
}

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

/* Email Validator */
function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("Please enter a valid email address.")
e.select()
}
return returnval
}

// Display text input if 'Other' is selected
function changeselect()
{
	var mdiv=document.getElementById('other');
	var cdiv=document.getElementById('Subject');
	if(cdiv.options[cdiv.selectedIndex].value=='Other')
	{
		mdiv.style.display='inline';
		mdiv.focus();
	}
	else
	{
		mdiv.style.display='none';
		mdiv.value='';
	}
	//alert("selected: " + cdiv.options[cdiv.selectedIndex].value);
}
