
function chkname()
{
if (document.getElementById("txt_name").value=="" || document.getElementById("txt_name").value==null)
{
alert("Please enter Your name")
return false
}
else
{
return true
}
}


function chkphone()
{
if (document.getElementById("txt_phone").value=="" || document.getElementById("txt_phone").value==null)
{
alert("Please enter Your Phone Number")
return false
}
else
{
return true
}
}

function chkcountry()
{
if (document.getElementById("txt_country").value=="" || document.getElementById("txt_country").value==null)
{
alert("Please enter your Country")
return false
}
else
{
return true
}
}


function chktraveldate()
{
if (document.getElementById("txt_traveldate").value=="" || document.getElementById("txt_traveldate").value==null)
{
alert("Please enter date of travel")
return false
}
else
{
return true
}
}


function chkrequirments()
{
if (document.getElementById("txt_requirments").value=="" || document.getElementById("txt_requirments").value==null)
{
alert("Dont you have any requirments")
return false
}
else
{
return true
}
}



/*    The ffunction for validating the email                   */
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("please enter a valid email")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("please enter a valid email")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("please enter a valid email")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("please enter a valid email")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("please enter a valid email")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("please enter a valid email")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("please enter a valid email")
		    return false
		 }

 		 return true					
	}

function Validateemail(){
	var emailID=document.getElementById("txt_email")
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("please enter a valid email");
		
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		
		return false
	}
	return true
}





function validateform()
{
if (chkname()==false || chkphone()==false || chkcountry()==false || chktraveldate()==false || chkrequirments()==false || Validateemail()==false )
{
return false
}
else
{
return true
}
}


