
	var reg = /^([0-9]{1,3})+\.([0-9]{2})$/; // valid
	var reg2 = /^(.)+\.(mp3)$/; // valid
	var reg3 = /^(.)+\.(jpg)$/; // valid
	var reg4 = /^(.)+\.(gif)$/; // valid
	var reg5 = /^([0-9]{4})+\-([0-9]{2})+\-([0-9]{2})$/; // valid

function ValidateContact(theForm){
	var missing="";
	if(theForm.name.value=="")
		missing+="Your Name\n";
	if(theForm.email.value=="" || !validEmail(theForm.email))
		missing+="Your Email Address\n";
	if(theForm.subject.value=="")
		missing+="The Subject of this email\n";
	if(theForm.bodytxt.value=="")
		missing+="Your Comments\n";

	if (missing != ""){
		alert("You have missed entering these details\n"
		+missing
		+"Please enter these details and resubmit");
		return false;
	} 
	else
		window.alert("Thank you for your Comments");
		return true;
}

function validEmail(email) {
  var str = email.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
  if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
    return true;
  }else{
	window.alert("You have not entered a properly formatted email address!\n"
	+ "You entered: " + str + "\n"
	+ "Example: john.smith@tntmusic.com\nPlease enter a valid email address!");
	return false;
  }
}

function ValidateDetails(theForm){
	var missing="";
	if(theForm.fname.value=="")
		missing+="Your First Name\n";
	if(theForm.sname.value=="")
		missing+="Your Surname\n";
	if(theForm.houseno.value=="")
		missing+="Your House No.or Name\n";
	if(theForm.street.value=="")
		missing+="The street in which you live\n";
	if(theForm.town.value=="")
		missing+="The town in which you live\n";
	if(theForm.county.value=="")
		missing+="The county in which you live\n";
	if(theForm.postcode.value=="")
		missing+="The postcode in which you live\n";
	if(theForm.telephone.value=="" && theForm.mobile.value=="" && theForm.fax.value==""){
		missing+="A Contact No.\n";	
	}
	if(theForm.telephone.value != ""){
		for(var i=0; i<theForm.telephone.value.length; i++){
			if(theForm.telephone.value.charAt(i) < "0" || theForm.telephone.value.charAt(i) > "9") {
				missing+="You have not entered a valid Contact No.\n";
			}
		}
	}
	if(theForm.mobile.value != ""){
		for(var i=0; i<theForm.mobile.value.length; i++){
			if(theForm.mobile.value.charAt(i) < "0" || theForm.mobile.value.charAt(i) > "9") {
				missing+="You have not entered a valid Mobile No.\n";
			}
		}
	}
	if(theForm.fax.value != ""){
		for(var i=0; i<theForm.fax.value.length; i++){
			if(theForm.fax.value.charAt(i) < "0" || theForm.fax.value.charAt(i) > "9") {
				missing+="You have not entered a valid Fax No.\n";
			}
		}
	}
	if(theForm.email.value=="" || !validEmail(theForm.email))
		missing+="Your Email Address\n";
	if (missing != ""){
		alert("You have missed entering these details\n"
		+missing
		+"Please enter these details and resubmit");
		return false;
	} 
	else
		window.alert("Thank you, we will try to contact you as soon as possible");
		return true;
}