/* BOKKING SYSTEM */
function verifyLogin(form){
	var correct = true;
	if (form.username.value=="") {correct = false}
	if (form.password.value=="") {correct = false}
	if(!correct){alert("Please fill in all the fields"); return false;}
}

function verifyBooking(form){
	var correct = true;
	if (form.name.value=="") {correct = false}
	if (form.surname.value=="") {correct = false}
	if (form.email.value=="") {correct = false}
	if(!correct){alert("Please fill in all the fields"); return false;}
	var validemail = echeck(form.email.value);
	if(!validemail){alert("Please enter a valid email address"); return false;}
}

function verifyContactUs(form){
	var correct = true;
	if (form.enquiry.value=="") {correct = false}
	if (form.email.value=="") {correct = false}
	if(!correct){alert("Please fill in all the fields"); return false;}
	var validemail = echeck(form.email.value);
	if(!validemail){alert("Please enter a valid email address"); return false;}
}

function verifyRequestOnsiteTraining(form)
{
	var correct = true;
	if (form.name.value=="") {correct = false}
	if (form.instruments.value=="") {correct = false}
	if (form.email.value=="") {correct = false}
	if (form.enquiry.value=="") {correct = false}
	if(!correct){alert("Please fill in all the fields"); return false;}
	var validemail = echeck(form.email.value);
	if(!validemail){alert("Please enter a valid email address"); return false;}
}

function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   //alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   //alert("Invalid E-mail ID")
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	   // alert("Invalid E-mail ID")
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	   // alert("Invalid E-mail ID")
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	   // alert("Invalid E-mail ID")
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	   // alert("Invalid E-mail ID")
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	   // alert("Invalid E-mail ID")
		return false
	 }

	 return true					
}