function validate_email()
{
	t = document.getElementById('email_address').value;
	if( t == "your@company.com" || t == "" || t.indexOf("@") == -1 || t.indexOf(".") == -1 || t.indexOf(" ")!=-1 || t.length < 6 || t.indexOf("xyz.com") > 0 || t.indexOf("abc.com") > 0 || t.indexOf("jagatniwaspalace.com") > 0 ) {
		 document.getElementById('email_status').innerHTML='<img src="images/notavailable.png" height="16" width="16" />';
		return false;
	}
	var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest(); 
  }
catch (e)
  {  // Internet Explorer  
  try
    {    
	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
	}
  catch (e)
    {   
	try
      {     
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	  }
    catch (e)
      {      
	  alert("Your browser does not support AJAX!");      
	  return false;      
	  }    
	  }  
  }
	 
	
	url='available.php?email='+t;
	//alert(url);
	
  xmlHttp.open("GET",url,true);
	xmlHttp.setRequestHeader("Cache-Control", "no-cache");
	xmlHttp.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
 xmlHttp.send(null);
 
  xmlHttp.onreadystatechange=function()
    {
		
    if(xmlHttp.readyState==4)
      {
		  if(xmlHttp.responseText!=""){
		 document.getElementById('email_status').innerHTML='<img src="images/notavailable.png" height="16" width="16" />';
		 document.getElementById('check_id').value='no';
		 document.getElementById('email_address').focus();
		  }
		 else{
			 document.getElementById('check_id').value='yes';
		 document.getElementById('email_status').innerHTML='<img src="images/available.png" height="16" width="16" />';
		 }
		}
      
      }
}


function validate(theForm)
{
	
	//check email
	t = theForm.email_address.value;
	if( t == "your@company.com" || t == "" || t.indexOf("@") == -1 || t.indexOf(".") == -1 || t.indexOf(" ")!=-1 || t.length < 6 || t.indexOf("xyz.com") > 0 || t.indexOf("abc.com") > 0 || t.indexOf("jagatniwaspalace.com") > 0 ) {
		alert("Your Email seems to be invalid!");
		theForm.email_address.focus();
		return (false);
	}
	
	//check password
	
	t1=theForm.password;
	if(t1.value==""){
	alert("Please Enter Password");
	t1.focus();
	return false;
	}
	
	//check re-password
	
	t2=theForm.confirmation;
	if(t2.value==""){
	alert("Please Enter Confirm Password");
	t2.focus();
	return false;
	}
	
	if(t1.value!=t2.value){
	alert("Password And Confirm Password Should Be Same");
	t1.focus();
	return false;
	}
	
	/*t=theForm.secquestion;
	if(t.value==""){
	alert("Please Select Security Question");
	t.focus();
	return false;
	}
	
	t=theForm.sanswer;
	if(t.value==""){
	alert("Please Select Security Answer");
	t.focus();
	return false;
	}*/
	//check gender
	t=document.getElementById('gender-male');
	t1=document.getElementById('gender-female');
	if(t.checked==false && t1.checked==false){
	alert("Please Select Gender");
	t.focus();
	return false;
	}
	
	//check first name
	
	t=theForm.firstname;
	if(t.value==""){
	alert("Please Enter Your First Name");
	t.focus();
	return false;
	}
	
	
	//check last name
	
	t=theForm.lastname;
	if(t.value==""){
	alert("Please Enter Your Last Name");
	t.focus();
	return false;
	}
	
	
	//dob
	t=theForm.dob;
	if(t.value==""){
	alert("Please Select Your Date Of Birth");
	t.focus();
	return false;
	}
	//check Street Address
	
	t=theForm.street_address;
	if(t.value==""){
	alert("Please Enter Your Address");
	t.focus();
	return false;
	}
	
	//check city
	
	t=theForm.city;
	if(t.value==""){
	alert("Please Enter Your City");
	t.focus();
	return false;
	}
	
	//check state
	
	t=theForm.state;
	if(t.value==""){
	alert("Please Enter Your State");
	t.focus();
	return false;
	}
	
	//check state
	
	t=theForm.postcode;
	if(t.value==""){
	alert("Please Enter Your Post/Zip Code");
	t.focus();
	return false;
	}
	
	t=theForm.telephone;
	if(t.value==""){
	alert("Please Select Your Telephone Number");
	t.focus();
	return false;
	}
	
	t=theForm.tos_agreed;
	if(t.checked==false){
	alert("Please Accepts Terms and Conditions.");
	t.focus();
	return false;
	}
	
	t=document.getElementById('check_id').value;
	if(t=='no'){
	alert("This Mail Id Already Taken Please Choose Another Mail Id");
		theForm.email.focus();
		return (false);
	}
	// all's well ends well
}

function checkNumeric(e)
{	//With FireFox Support
	var KeyID = (window.event) ? event.keyCode : e.which;	
	//alert(KeyID);
	if((KeyID >= 48 && KeyID <= 57)  || (KeyID == 43) || (KeyID == 45)|| (KeyID == 8) || (KeyID == 32) || (KeyID == 37) || (KeyID == 39) || (KeyID == 46))
	{				
		return true;			
	}                       
	return false;
}



function sect_tocken()
{
	
	var xmlHttp;
try
  {  // Firefox, Opera 8.0+, Safari  
  xmlHttp=new XMLHttpRequest(); 
  }
catch (e)
  {  // Internet Explorer  
  try
    {    
	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
	}
  catch (e)
    {   
	try
      {     
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	  }
    catch (e)
      {      
	  alert("Your browser does not support AJAX!");      
	  return false;      
	  }    
	}  
  }
	 
	url='cart/index.php?tct=sec_code';
	//alert(url);
	
  xmlHttp.open("GET",url,true);
	xmlHttp.setRequestHeader("Cache-Control", "no-cache");
	xmlHttp.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
 xmlHttp.send(null);
 
  xmlHttp.onreadystatechange=function()
    {
   		if(xmlHttp.readyState==4)
      	{
		 //alert(xmlHttp.responseText);
		 document.getElementById('sct_value').value=xmlHttp.responseText;
		 
		}
      
      }
	  
}