var notify="Please enter a correct form of email 'sample@sample.com'"

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(notify)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		    alert(notify)
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		     alert(notify)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		  alert(notify)
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(notify)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		 alert(notify)
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		     alert(notify)
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
//if(document.eform.varEmail.value==""){alert("Please enter Name")}

	var emailID=document.eform.varEmail
	var ename=document.eform.varName
	var esubject=document.eform.varSubj
	var emsg=document.eform.varMsg
	
		if ((ename.value==null)||(ename.value=="")){
		   alert("Please enter your name!")
		ename.focus()
		return false
	}
	
		if (echeck(emailID.value)==false){
		//emailID.value=""
		 // alert(notify)
		emailID.focus()
		return false
	}
	/*
	if ((emailID.value==null)||(emailID.value=="")){
		   alert(notify)
		emailID.focus()
		return false
	}*/
	
			if ((esubject.value==null)||(esubject.value=="")){
		   alert("Please enter subject!")
		esubject.focus()
		return false
	}
	

			if ((emsg.value==null)||(emsg.value=="")){
		   alert("Please drop some lines in message box!")
		emsg.focus()
		return false
	}
	
	

	return true
 }



function ValidateREGForm(){

//if(document.eform.varEmail.value==""){alert("Please enter Name")}
var aa=0
var aa2=0
	/*var emailID=document.eform.varEmail
	var ename=document.eform.varName
	var esubject=document.eform.varSubj
	var emsg=document.eform.varMsg*/
	
		if ((eform.firstname.value==null)||(eform.firstname.value=="")){
		   alert("Please enter your name!")
		eform.firstname.focus()
		return false
	}
	
		if ((eform.lastname.value==null)||(eform.lastname.value=="")){
		   alert("Please enter your last name!")
		eform.lastname.focus()
		return false
	}
	
if (eform.gender[0].checked==true){aa=1}
if (eform.gender[1].checked==true){aa2=1}
if (aa+aa2==0){
 alert("Please enter your gender!")
		return false
}


		if ((eform.birthdate.value==null)||(eform.birthdate.value=="")){
		   alert("Please enter your birthdate!")
		eform.birthdate.focus()
		return false
	}
	
		if ((eform.age.value==null)||(eform.age.value=="")){
		   alert("Please enter your age!")
		eform.age.focus()
		return false
	}
	
		if ((eform.city.value==null)||(eform.city.value=="")){
		   alert("Please enter your city!")
		eform.city.focus()
		return false
	}
	
		if ((eform.country.value==null)||(eform.country.value=="")){
		   alert("Please enter your country!")
		eform.country.focus()
		return false
	}
	
		if (echeck(eform.email.value)==false){
		//emailID.value=""
		 // alert(notify)
		eform.email.focus()
		return false
	}
	
			if ((eform.hphone.value==null)||(eform.hphone.value=="")){
		   alert("Please enter your Home Phone!")
		eform.hphone.focus()
		return false
	}
			if ((eform.cphone.value==null)||(eform.cphone.value=="")){
		   alert("Please enter your Cell Phone!")
		eform.cphone.focus()
		return false
	}
			if ((eform.cperson.value==null)||(eform.cperson.value=="")){
		   alert("Please enter Contact Person in case of Emergency!")
		eform.cperson.focus()
		return false
	}
	
				if ((eform.cpersonrel.value==null)||(eform.cpersonrel.value=="")){
		   alert("Please enter Relationship to applicant!")
		eform.cpersonrel.focus()
		return false
	}
	
				if ((eform.cpersonphone.value==null)||(eform.cpersonphone.value=="")){
		   alert("Please enter Contact Person's Phone number")
		eform.cpersonphone.focus()
		return false
	}
	
	aa=0
	aa2=0
	if (eform.medical[0].checked==true){aa=1}
if (eform.medical[1].checked==true){aa2=1}
if (aa+aa2==0){
 alert("Please enter medical insurance for Europe!")
		return false
}

	aa=0
	aa2=0
	if (eform.disabilty[0].checked==true){aa=1}
if (eform.disabilty[1].checked==true){aa2=1}
if (aa+aa2==0){
 alert("Please enter disability/medication!")
		return false
}
	
	if (eform.disabilty[0].checked==true){	
	if ((eform.disreason.value==null)||(eform.disreason.value=="")){
		   alert("Please enter a reason")
		eform.disreason.focus()
		return false
		}
	}
	
		if ((eform.trainat.value==null)||(eform.trainat.value=="")){
		   alert("Please enter Presently training at")
		eform.trainat.focus()
		return false
	}

	/*aa=0
	aa2=0
	if (eform.hotel[0].checked==true){aa=1}
if (eform.hotel[1].checked==true){aa2=1}
if (aa+aa2==0){
 alert("Please enter if need hotel room")
		return false
}*/

	
	
	
		aabb=0
	aa2=0
	
	if (eform.feesradio[0].checked==true){aabb=1}
if (eform.feesradio[1].checked==true){aabb=1}
if (eform.feesradio[2].checked==true){aabb=1}
if (eform.feesradio[3].checked==true){aabb=1}
if (eform.feesradio[4].checked==true){aabb=1}
if (eform.feesradio[5].checked==true){aabb=1}
if (eform.feesradio[6].checked==true){aabb=1}
if (eform.feesradio[7].checked==true){aabb=1}
if (aabb==0){
 alert("Please select course")
		return false
}
	
	
	

	return true
 }

