function validate_required(field,alerttxt) {
	if (field.value==null||field.value=="")
		{alert(alerttxt);return false}
	else {return true}
}

function testchars(email) {
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
	if (email.match(illegalChars)) 
		{ alert("The email address contains illegal characters.\nPlease Correct");return false } 
	else 
		{ return true }
}

function testfilter(email) {	
var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(email))) 
		{ alert("The email address is invalid\nPlease enter a valid email address."); return false } 
	else 
		{ return true }			
}

function testspace(email) {	
var sp = email.indexOf(" ")
	if (sp != -1) 
		{ alert("The email address contains a space.\nEmail addresses cannot have spaces."); return false } 
	else 
		{ return true }			
}

function testpackage(group,cdkey) {
	for (var i=0; i<group.length; i++) {
		if (group[i].checked) {
			if (i==2||i==3||i==9) {
				if (cdkey.value==null||cdkey.value=="") 					
				{ alert("You must supply your current TUMONZ CD-Key\nso we can assign you new activation keys"); return false } 
			else 
				{ return true; } 
			}
		}
	}	
}


function checkSubmit(thisform) {	
	
	if (validate_required(thisform.name,"Please enter your name\nWho should we delivery TUMONZ to?.")==false)
		{thisform.name.focus();return false}
	if (validate_required(thisform.add1,"Please enter your address\nWe require this to courier TUMONZ to you")==false)
		{thisform.add1.focus();return false}
	if (validate_required(thisform.city,"Please enter your city\nWe require this to courier TUMONZ to you")==false)
		{thisform.city.focus();return false}
	if (validate_required(thisform.email,"Please enter your email\nWe require this if we need to contact you")==false)
		{thisform.email.focus();return false}
	if (testchars(thisform.email.value)==false)
		{thisform.email.focus();return false}
	if (testfilter(thisform.email.value)==false)
		{thisform.email.focus();return false}
	if (testspace(thisform.email.value)==false)
		{thisform.email.focus();return false}
	if (thisform.payment.selectedIndex == 0) {
		alert('Please select how you wish to make payment');
		thisform.payment.focus();return false}	
	if (testpackage(thisform.package,thisform.cdkey)==false) 
		{thisform.cdkey.focus();return false}			
		
}	