function formValidation(form){
	var msg = '';
	var returnVal = true;
	if(isEmpty(form.fname)){
		msg += 'Required Field: First Name\n';
		returnVal = false;
	}
	if(isEmpty(form.lname)){
		msg += 'Required Field: Last Name\n';
		returnVal = false;
	}
	if(isEmpty(form.add1)){
		msg += 'Required Field: Address\n';
		returnVal = false;
	}	
	if(isEmpty(form.town)){
		msg += 'Required Field: City/Town\n';
		returnVal = false;
	}
	if(isEmpty(form.country)){
		msg += 'Required Field: Country\n';
		returnVal = false;
	}
	if(isEmpty(form.tel)){
		msg += 'Required Field: Phone\n';
		returnVal = false;
	}
	if(isEmpty(form.email)){
		msg += 'Required Field: Email\n';
		returnVal = false;
	}
	else if(invalidEmail(form.email.value)){
		msg += 'Invalid Email Address\n';
		returnVal = false;
	}
	if(form.payment.value == 'None'){
		msg += 'Required Field: Payment\n';
	}
	if(form.price.value == '-1'){
		msg += 'Please select a pricing option\n';
	}
	
	if(returnVal == false){
		alert(msg);
	}
	return returnVal;
}

function isEmpty(elem){
	var str = elem.value;
	if(str.length == 0){
		return true;
	}
	else {
		return false;
	}
}
function invalidEmail(str) {

	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)){
		return false;
	}
	return true;
}


function oldinvalidEmail(strng){
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(strng))) { 
	       return true;
	}

	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (strng.match(illegalChars)) {
	   return true;
	}
	return false;
}


function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
}

function isEmptyDom(form){
	if(form.domainchoice[1].checked == true){
		if(isEmpty(form.tdomain)){
			alert('Please enter a domain to transfer!');
			return false;
		}
	}
	return true;
}

function contactformValidation(form){
	var msg = '';
	var returnVal = true;
	if(isEmpty(form.name)){
		msg += 'Required Field: Name\n';
		returnVal = false;
	}
	
	if(isEmpty(form.tel)){
		msg += 'Required Field: Phone\n';
		returnVal = false;
	}
	if(isEmpty(form.femail)){
		msg += 'Required Field: Email\n';
		returnVal = false;
	}
	else if(invalidEmail(form.femail.value)){
		msg += 'Invalid Email Address\n';
		returnVal = false;
	}
	if(isEmpty(form.message)){
		msg += 'Required Field: Message\n';
		returnVal = false;
	}
	
	if(returnVal == false){
		alert(msg);
	}
	return returnVal;
}