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					
	}


function validate_form()
{
var emailID=document.getElementById('g-email')


	if(document.getElementById('fname').value=='')
	{
	alert("Enter first name !");
	document.getElementById('fname').focus();
	return false;
	}
	if(document.getElementById('lname').value=='')
	{
	alert("Enter last name !");
	document.getElementById('lname').focus();
	return false;
	}
	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
	}
	if(document.getElementById('pass1').value=='')
	{
	alert("Enter Password !");
	document.getElementById('pass1').focus();
	return false;
	}
	if(document.getElementById('pass2').value=='')
	{
	alert("Enter Confirm Password !");
	document.getElementById('pass2').focus();
	return false;
	}
	if(document.getElementById('pass1').value != document.getElementById('pass2').value)
	{
	alert("Password not match!");
	document.getElementById('pass2').value='';
	document.getElementById('pass2').focus();
	return false;
	}
	if(document.getElementById('addr1').value=='')
	{
	alert("Enter Address1 !");
	document.getElementById('addr1').focus();
	return false;
	}
	if(document.getElementById('city').value=='')
	{
	alert("Enter city !");
	document.getElementById('city').focus();
	return false;
	}
	if(document.getElementById('country').selectedIndex == 0)
	{
	alert("Select country !");
	document.getElementById('country').focus();
	return false;
	}
	if(document.getElementById('timezone').selectedIndex == 0)
	{
	alert("You must select your Time Zone correctly. This will help you reserve classes correctly. Please Select timezone !");
	document.getElementById('timezone').focus();
	return false;
	}
	if((document.getElementById('areacode').value=='') || isNaN(document.getElementById('areacode').value))
	{
	alert("Enter Area code in ' numeric ' !");
	document.getElementById('areacode').value='';
	document.getElementById('areacode').focus();
	return false;
	}
	
	if((document.getElementById('hphone').value=='') || isNaN(document.getElementById('hphone').value))
	{
	alert("Enter home number in ' numeric ' !");
	document.getElementById('hphone').value='';
	document.getElementById('hphone').focus();
	return false;
	}
	if((document.getElementById('num_child').value=='') || isNaN(document.getElementById('num_child').value))
	{
	alert("Enter number of children in ' numeric ' !");
	document.getElementById('num_child').value='';
	document.getElementById('num_child').focus();
	return false;
	}
	if(document.getElementById('num_child').value > 6)
	{
	alert("Maximum 6 children only !");
	document.getElementById('num_child').value='';
	document.getElementById('num_child').focus();
	return false;
	}
	

	else
	{
	return true;
	}
}








var xmlHttp


function showDiallingCode(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="show_dialling_code.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("txtHint1").innerHTML=xmlHttp.responseText 
 } 
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}














		          																	 
		         
          
