// JavaScript Document
function checkform_contact(myform){
	var noerror = true; var haserror = false;
	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	
	// get the form values ----------
	var email = $('#email').val(); var name = $('#name').val();	var phone = $('#phone').val(); var message = $('#message').val(); var subject = $('#subject').val();
	var dept = $('dept').val();
	
	email = email.toLowerCase();
	// ------------------------------
	if(email == ''){noerror=false;}
	if(dept == ''){noerror=false;}
	if(!emailReg.test(email)){noerror = false;}
	//if(email.indexOf('cyanreign')){noerror = false;} // block self addressing
	if(name == ''){noerror=false;}
	// if(phone == ''){noerror=false;}
	if(message == ''){noerror=false;}
	if(subject == ''){noerror=false;}
	// ------------------------------	
	str = $('form').serialize();
	// ------------------------------	
	if (noerror){
	$('#loader').toggle();
	$.post("post.asp",  str, function(data) {
	if (data == "error"){
		alert('I tried to send your email but the server is responding with an error. Please try again...');
	}else{
		$('#ajaxload').html(data);
		$('#loader').toggle();
	}
	});
	}else{$('#formmsg').html('You have errors in the form');var t=setTimeout("$('#formmsg').html('')",3000)};
	return false;
}	