///////////////////////////////java script variables declaration///////////////////////////////////////
 var flag1;
  var flag2;
  var flag3;
  var flag4;
function goback(){
	document.location="index.php?signup=back";
}
function dis_box()
{
if(document.sign_up1.image_code.value=="")
document.sign_up1.image_code.value="Enter the code of the image";
}
// image code display event of onClick method
function dis_box1()
{
	if(document.sign_up1.image_code.value=="Enter the code of the image")
	{
		document.sign_up1.image_code.value="";
	}
}

//////////////////////////////////sign up page &of Email Checking////////////////////////////////////
function email_chk(eml)
{
	//alert("hello")
   uname=eml;
    xmlHttp=GetXmlHttpObject()
      if(xmlHttp==null)
        {
         alert ("Browser does not support HTTP Request")
         return;
        } 

var url="ajax_file.php";
url=url+"?m="+uname;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged1;
xmlHttp.open("POST",url,true);
xmlHttp.send(null);

function stateChanged1() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

rep=xmlHttp.responseText;
//alert("email_chk: "+ rep)

 	if(rep==0)
	 {
		
		 flag1="pass";
		 //alert("flag1: "+flag1)
		 //document.getElementById("result").style.visibility="hidden";
		//document.getElementById("mail_id").style.border="#000000 solid 1px";
	 }
	 else
	{
		 
		 //document.getElementById("result").style.visibility="visible";
		//document.getElementById("result").innerHTML="E-mail Id Already Exists please enter another Mail Id in red highlighted boxes!!";
		//document.getElementById("mail_id").style.border="#FF0000 solid 1px";
		//document.sign_up.mail_id.focus();
		 flag1="fail";
		 // alert("flag1: "+flag1)
	}
	 
 } 
}
}
///////////////////////////////////sing_up of login(email checking)//////////////////////////////
function login_chk(eml)
{
	
   uname=eml;
   //alert("sign_up "+uname);
    xmlHttp=GetXmlHttpObject()
      if(xmlHttp==null)
        {
         alert ("Browser does not support HTTP Request")
         return;
        } 

var url="ajax_file.php";
url=url+"?m="+uname;
url=url+"&sid="+Math.random();
function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

rep=xmlHttp.responseText;
//alert("Testing: rep= "+rep);
//alert(rep);
 	if(rep != "")
	 {
		if(rep == "YES"){
			document.login.userid.value = "Not needed";
			document.login.userid.disabled = true;
		}
		//alert("rep value is 1");
		 flag2="pass";
		// alert("Testing: flag2= "+flag2);
		 //document.getElementById("result").style.visibility="hidden";
		//document.getElementById("mail_id").style.border="#000000 solid 1px";
		//document.getElementById("result").innerHTML="";
	 }
	 else
	{
		 //alert("rep value is 0 value = "+rep);
		 
		//document.getElementById("result").innerHTML="Entered Login id is not here(java)";
		 flag2="fail";
		// alert("Testing: flag2: "+flag2);
	}
	 
 } 
}
xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("POST",url,true);
xmlHttp.send(null);


}


//////////////////////////////////sign_up password checking///////////////////////////////////
function pass_chk(str)
{
uname=str;
    xmlHttp=GetXmlHttpObject()
      if(xmlHttp==null)
        {
         alert ("Browser does not support HTTP Request")
         return;
        } 
		
		var url="ajax_file.php";
url=url+"?p="+uname;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged3;
xmlHttp.open("POST",url,true);
xmlHttp.send(null);

function stateChanged3() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

rep=xmlHttp.responseText;
//alert("Testing: rep= "+rep);

 	if(rep != "")
	 {
		
		 flag3="pass";
		 
		  //alert("flag3: "+flag3)
		 //document.getElementById("result").style.visibility="hidden";
		//document.getElementById("mail_id").style.border="#000000 solid 1px";
		//document.getElementById("result").innerHTML="";
	 }
	 else
	{
		 
		//document.getElementById("result").innerHTML="Entered Password is not exists";
		 flag3="fail";
		  //alert("flag3: "+flag3)
	}
	 
 } 
}
		
}


////////////////////////////////sign_up userid checking////////////////////////////////////
function userid_chk(str1)
{

uname=str1;
    xmlHttp=GetXmlHttpObject()
      if(xmlHttp==null)
        {
         alert ("Browser does not support HTTP Request")
         return;
        } 
		
		var url="ajax_file.php";
url=url+"?n="+uname;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged4;
xmlHttp.open("POST",url,true);
xmlHttp.send(null);

function stateChanged4() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

rep=xmlHttp.responseText;
//alert("Testing: rep= "+rep);

 	if(rep != "")
	 {
		
		 flag4="pass";
		  //alert("flag4: "+flag4)
		 //document.getElementById("result").style.visibility="hidden";
		//document.getElementById("mail_id").style.border="#000000 solid 1px";
		//document.getElementById("result").innerHTML="";
	 }
	 else
	{
		 
		//document.getElementById("result").innerHTML="Entered User Id is not exists";
		 flag4="fail";
		 // alert("flag4: "+flag4)
	}
	 
 } 
}



}


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;
}
///////////////////////////////////login field validation////////////////////////////////////
function check_login()
  {
	
  if(document.login.login.value=="")
	{
		//alert("hai");
		document.getElementById("result") . innerHTML="Enter your E-Mail ID";
		return false;
	}
	else if(document.login.login.value!="")
		{
		if(!isEmail(document.login.login.value))
		{
			//alert("Hai2");
		document.getElementById("result").innerHTML="Please enter the valid E-mail ID";
		return false;
		}
		else if(flag2=="fail")
		{
		
		document.getElementById("result").innerHTML="Your Login ID is not exists";
		return false;
}
	else
		{
		document.getElementById("result").innerHTML="";
		
		}
		}
		if(document.login.login_pass.value=="")
		{
		document.getElementById("result").innerHTML="Enter Your Password";
		return false;
		}
		else if(document.login.login_pass.value!="")
		{
		
		if(flag3=="fail")
		{
		document.getElementById("result").innerHTML="Your Entered Password is not exists";
		return false;
		}
		else
		{
		document.getElementById("result").innerHTML="";
		}
		}
		
		if(document.login.userid.value=="")
		{
		document.getElementById("result").innerHTML="Enter Your Activation code";
		return false;
		}
		else if(document.login.userid.value!="")
		{
		if(flag4=="fail")
		{
		document.getElementById("result").innerHTML="Your Entered Activation code is not exists";
		return false;
		}
		else
		{
		document.getElementById("result").innerHTML="";
		}
		}
		}



/*-----------------------------forgetpassword forgetpass() validation function------------------------------*/
function forgetpass()
{
	if((document.frm.email.value=="") && (document.frm.login.value==""))
	{
		alert("Please enter the valid email or valid login id in proper box");
		return false;
	}
	if(flag=="fail")
	{
		alert("please Enter valid Entry");
		return false;
	}
}
function passawordcheck(){

if(document.sign_up.pass.value=="")
	{
		document.getElementById("password").style.visibility="visible";
		document.getElementById("password").innerHTML="Please enter password";
		document.getElementById("pass").style.border="#FF0000 solid 1px";
		//document.sign_up.pass.focus();
		//signupflag = 1;
		//return false;
	}
	else if(document.sign_up.pass.value!="")
		{
			//alert("name testing");
			var len=document.sign_up.pass.value.length;
			var user=document.sign_up.pass.value;
			
			if(len<6)
			{
				
				document.getElementById("password").style.visibility="visible";
				document.getElementById("password").innerHTML="Please enter above 6 character";
				document.getElementById("pass").style.border="#FF0000 solid 1px";
				//signupflag = 1;
				document.sign_up.pass.focus();
		//return false;
			}
		else{
							document.getElementById("password").style.visibility="hidden";
							document.getElementById("pass").style.border="#93B9D9 solid 1px";
						for(i=0;i<len;i++)
						{
							var val=ascii_value(user.charAt(i));
							if((val>=97 && val<=122) || (val>=65 && val<=90)||(val>=48 && val<=57))
							{
							document.getElementById("password").style.visibility="hidden";
							document.getElementById("pass").style.border="#000000 solid 1px";
							}
							else
							{
						document.getElementById("password").style.visibility="visible";
						document.getElementById("password").innerHTML="Please enter lower and upper case characters only";
						document.getElementById("pass").style.border="#FF0000 solid 1px";
						//signupflag = 1;
						//document.sign_up.pass.focus();
						//return false;
							
							}
						}  
				}
		}

}
/*----------------------------------confirmation-------------------------------------------------*/
function email_confirm(str){
	var mailid = document.sign_up.mail_id.value;
	//alert("mail id:"+ mailid + ", confirm id:" + str);
	//var mailidconfirm = document.sign_up.mail_idconfirm.value;
	if(mailid != str){
		document.getElementById("mailid_confirm").style.visibility="visible";
		document.getElementById("mailid_confirm").innerHTML="Entered E-mail id is not matched";
		document.getElementById("mail_idconfirm").style.border="#FF0000 solid 1px";
		//document.getElementById("mail_idconfirm").focus();
		//return false;
	} else {
		//alert("in else");
		document.getElementById("mailid_confirm").style.visibility="hidden";
			document.getElementById("mailid_confirm").innerHTML="";
		document.getElementById("mail_idconfirm").style.border="#93B9D9 solid 1px";
		//return true;
	}

}
function password_confirm(str){
	var password = document.sign_up.pass.value;
	//alert("mail id:"+ mailid + ", confirm id:" + str);
	//var mailidconfirm = document.sign_up.mail_idconfirm.value;
	if(password != str){
		document.getElementById("password_confirm").style.visibility="visible";
		document.getElementById("password_confirm").innerHTML="Entered Password id is not matched";
		document.getElementById("pass_confirm").style.border="#FF0000 solid 1px";
		//document.getElementById("pass_confirm").focus();
		//return false;
	} else {
		//alert("in else");
		document.getElementById("password_confirm").style.visibility="hidden";
			document.getElementById("password_confirm").innerHTML="";
		document.getElementById("pass_confirm").style.border="#93B9D9 solid 1px";
		//return true;
	}

}
/*----------------------------------------------------End-------------------------------------------------------*/
function radio_select(str)
{
	
	if(str=="Individual")
	{
		document.getElementById("business_name").disabled=true;
		document.getElementById("business_name").style.background="#CCCCCC";
		document.getElementById("business_name").value="Not Applicable";
		//document.getElementById("business_name").style.border="#CCCCCC";
		
	}
	else
	{
		document.getElementById("business_name").disabled=false;
		document.getElementById("business_name").style.background="#FFFFFF";
		document.getElementById("business_name").value="";
		//document.getElementById("business_name").style.border="#CCCCCC";
	}
			

}


function verify_all()
{

	var signupflag = 0;
	var mailid = document.sign_up.mail_id.value;
	var password = document.sign_up.pass.value;
	var mailcnfm = document.sign_up.mail_idconfirm.value;
	var passcnfm = document.sign_up.pass_confirm.value;
	function ascii_value (c)
		{
	// restrict input to a single character
	c = c . charAt (0);

	// loop through all possible ASCII values
	var i;
	for (i = 0; i < 256; ++ i)
	{
		// convert i into a 2-digit hex string
		var h = i . toString (16);
		if (h . length == 1)
			h = "0" + h;

		// insert a % character into the string
		h = "%" + h;

		// determine the character represented by the escape code
		h = unescape (h);

		// if the characters match, we've found the ASCII value
		if (h == c)
			break;
	}
	return i;
}
	
	if(document.sign_up.mail_id.value=="")
	{
		document.getElementById("mailid").style.visibility="visible";
		document.getElementById("mailid").innerHTML="Please enter your Existing Email Id";
		document.getElementById("mail_id").style.border="#FF0000 solid 1px";
		//document.sign_up.mail_id.focus();
		signupflag = 1;
		//return false;
	}
	else if(document.sign_up.mail_id.value!="")
	{
		if(!isEmail(document.sign_up.mail_id.value))
		{
			document.getElementById("mailid").style.visibility="visible";
			document.getElementById("mailid").innerHTML="Please enter your valid Email Id";
			document.getElementById("mail_id").style.border="#FF0000 solid 1px";
			//document.sign_up.mail_id.focus();
			signupflag = 1;
		//return false;
		}
		else if(flag1=="fail")
		{
				
		document.getElementById("mailid").style.visibility="visible";
		document.getElementById("mailid").innerHTML="Entered E-mail id is already exists Please try another Email id";
		document.getElementById("mail_id").style.border="#FF0000 solid 1px";
		//document.sign_up.mail_id.focus();
		signupflag = 1;
		//return false;
		}
		else
		{
		//document.getElementById("result").innerHTML="";
		document.getElementById("mailid").style.visibility="hidden";
		document.getElementById("mail_id").style.border="#000000 solid 1px";
		//signupflag = 0;
		}
}
	
		if(document.sign_up.mail_idconfirm.value=="")
	{
		document.getElementById("mailid_confirm").style.visibility="visible";
		document.getElementById("mailid_confirm").innerHTML="Please confirm your Email Id";
		document.getElementById("mail_idconfirm").style.border="#FF0000 solid 1px";
		//document.sign_up.mail_id.focus();
		signupflag = 1;
		//return false;
	} else{
			document.getElementById("mailid_confirm").style.visibility="hidden";
		document.getElementById("mailid_confirm").innerHTML="";
		document.getElementById("mail_idconfirm").style.border="#93B9D9 solid 1px";
	}
	
	//alert("mail id:"+ mailid + ", confirm id:" + mailcnfm);
	//var mailidconfirm = document.sign_up.mail_idconfirm.value;
	if(mailid != mailcnfm){
		//alert("mail id fail");
		document.getElementById("mailid_confirm").style.visibility="visible";
		document.getElementById("mailid_confirm").innerHTML="Entered E-mail id is not matched";
		document.getElementById("mail_idconfirm").style.border="#FF0000 solid 1px";
		//document.getElementById("mail_idconfirm").focus();
		signupflag = 1;
		//return false;
	} else {
		//alert("pass");
		//alert("in else");
		document.getElementById("mailid_confirm").style.visibility="hidden";
			document.getElementById("mailid_confirm").innerHTML="";
		document.getElementById("mail_idconfirm").style.border="#93B9D9 solid 1px";
		//return true;
	}
	
	
	if(document.sign_up.pass_confirm.value=="")
	{
		document.getElementById("password_confirm").style.visibility="visible";
		document.getElementById("password_confirm").innerHTML="Please confirm your Email Id";
		document.getElementById("pass_confirm").style.border="#FF0000 solid 1px";
		//document.sign_up.mail_id.focus();
		signupflag = 1;
		//return false;
	}else{
			document.getElementById("password_confirm").style.visibility="hidden";
		document.getElementById("password_confirm").innerHTML="";
		document.getElementById("mail_idconfirm").style.border="#93B9D9 solid 1px";
	}
	if(document.sign_up.pass.value=="")
	{
		document.getElementById("password").style.visibility="visible";
		document.getElementById("password").innerHTML="Please enter password";
		document.getElementById("pass").style.border="#FF0000 solid 1px";
		//document.sign_up.pass.focus();
		signupflag = 1;
		//return false;
	}
	else if(document.sign_up.pass.value!="")
		{
			//alert("name testing");
			var len=document.sign_up.pass.value.length;
			var user=document.sign_up.pass.value;
			
			if(len<6)
			{
				
				document.getElementById("password").style.visibility="visible";
				document.getElementById("password").innerHTML="Please enter above 6 character";
				document.getElementById("pass").style.border="#FF0000 solid 1px";
				signupflag = 1;
				//document.sign_up.pass.focus();
		//return false;
			}
		else{
						for(i=0;i<len;i++)
						{
							var val=ascii_value(user.charAt(i));
							if((val>=97 && val<=122) || (val>=65 && val<=90)||(val>=48 && val<=57))
							{
							document.getElementById("password").style.visibility="hidden";
							document.getElementById("pass").style.border="#000000 solid 1px";
							}
							else
							{
						document.getElementById("password").style.visibility="visible";
						document.getElementById("password").innerHTML="Please enter lower and upper case characters only";
						document.getElementById("pass").style.border="#FF0000 solid 1px";
						signupflag = 1;
						//document.sign_up.pass.focus();
						//return false;
							
							}
						}  
				}
		}
			else
			{
				document.getElementById("password").style.visibility="hidden";
				document.getElementById("pass").style.border="#000000 solid 1px";
				//signupflag = 0;
			}
	//alert("mail id:"+ mailid + ", confirm id:" + str);
	//var mailidconfirm = document.sign_up.mail_idconfirm.value;
	if(password != passcnfm){
		document.getElementById("password_confirm").style.visibility="visible";
		document.getElementById("password_confirm").innerHTML="Entered Password id is not matched";
		document.getElementById("pass_confirm").style.border="#FF0000 solid 1px";
		//document.getElementById("pass_confirm").focus();
		//return false;
		signupflag = 1;
	} else {
		//alert("in else");
		document.getElementById("password_confirm").style.visibility="hidden";
			document.getElementById("password_confirm").innerHTML="";
		document.getElementById("pass_confirm").style.border="#93B9D9 solid 1px";
		//return true;
	}
	if(document.sign_up.f_name.value=="")
	{
		document.getElementById("firstname").style.visibility="visible";
		document.getElementById("firstname").innerHTML="Please enter your first name";
		document.getElementById("f_name").style.border="#FF0000 solid 1px";
		signupflag = 1;
	//document.sign_up.f_name.focus();
		//return false;
	}
	else
	{
		document.getElementById("firstname").style.visibility="hidden";
		document.getElementById("f_name").style.border="#000000 solid 1px";
		//signupflag = 0;
	}
if(document.sign_up.l_name.value=="")
	{
		document.getElementById("lastname").style.visibility="visible";
		document.getElementById("lastname").innerHTML="Please enter your last name";
		document.getElementById("l_name").style.border="#FF0000 solid 1px";
		signupflag = 1;
		//document.sign_up.l_name.focus();
		//return false;
	}
	else
	{
		document.getElementById("lastname").style.visibility="hidden";
		document.getElementById("l_name").style.border="#000000 solid 1px";
	}
/*	if(document.sign_up.phone.value=="")
	{
		document.getElementById("result").style.visibility="visible";
		document.getElementById("result").innerHTML="Please enter the data in red highlighted boxes";
	document.getElementById("phone").style.border="#FF0000 solid 1px";
	document.sign_up.phone.focus();
		return false;
	}
	else if(document.sign_up.phone.value!="")
{
if(isNaN(document.sign_up.phone.value))
{
document.getElementById("result").style.visibility="visible";
		document.getElementById("result").innerHTML="Please enter the numeric digits in red highlighted boxes";
	document.getElementById("phone").style.border="#FF0000 solid 1px";
	document.sign_up.phone.focus();
return false;
}
else
{
document.getElementById("result").style.visibility="hidden";
	
		document.getElementById("phone").style.border="#000000 solid 1px";
}
}

	*/
 if(document.sign_up.phone.value!="")
{
		if(isNaN(document.sign_up.phone.value))
		{
		document.getElementById("phoneerror").style.visibility="visible";
				document.getElementById("phoneerror").innerHTML="Please enter numeric digits only";
			document.getElementById("phone").style.border="#FF0000 solid 1px";
			//document.sign_up.phone.focus();
			signupflag = 1;
		//return false;
		}
		else
		{
				document.getElementById("phoneerror").style.visibility="hidden";
			
				document.getElementById("phone").style.border="#93B9D9 solid 1px";
		}
} else{
		document.getElementById("phoneerror").style.visibility="hidden";
			
				document.getElementById("phone").style.border="#93B9D9 solid 1px";
		}

	if(document.getElementById("business_name").value==""){
		document.getElementById("businessname").style.visibility="visible";
		document.getElementById("businessname").innerHTML="Please enter your Business name";
		document.getElementById("business_name").style.border="#FF0000 solid 1px";
		signupflag = 1;
		} else{
				document.getElementById("businessname").style.visibility="hidden";
				document.getElementById("business_name").style.border="#93B9D9 solid 1px";
		}
	
if(document.sign_up.address.value=="")
	{
		document.getElementById("addresserror").style.visibility="visible";
		document.getElementById("addresserror").innerHTML="Please enter your address";
		document.getElementById("address").style.border="#FF0000 solid 1px";
		//document.sign_up.address.focus();
		signupflag = 1;
		//return false;
	}
	else
	{
		document.getElementById("addresserror").style.visibility="hidden";
		document.getElementById("address").style.border="#000000 solid 1px";
		
	}
	if(document.sign_up.city.value=="")
	{
		document.getElementById("cityname").style.visibility="visible";
		document.getElementById("cityname").innerHTML="Please enter your city";
		document.getElementById("city").style.border="#FF0000 solid 1px";
		signupflag = 1;
		//document.sign_up.city.focus();
		//return false;
	}
	else
	{
		document.getElementById("cityname").style.visibility="hidden";
		document.getElementById("city").style.border="#000000 solid 1px";
		//document.sign_up.city.focus();
	}
	if(document.sign_up.post.value=="")
	{
		document.getElementById("postcode").style.visibility="visible";
		document.getElementById("postcode").innerHTML="Please enter your post code";
		document.getElementById("post").style.border="#FF0000 solid 1px";
		signupflag = 1;
		//document.sign_up.post.focus();
		//return false;
	}

else
{
		document.getElementById("postcode").style.visibility="hidden";
		document.getElementById("post").style.border="#000000 solid 1px";
}

	if(signupflag == 1){
		return false;
	} else { return true;}

	}
	
	
/////////////////////forget password using login of email///////////////////////////////
function check_login1(inp)
{	//alert("inp: "+inp)
//document.frm1.login.focus();


	var input = inp;
	var flag2 = "";
  function internal( eml){
	  //alert("entered into function");
	uname=eml;
  //alert("sign_up "+uname);
    xmlHttp=GetXmlHttpObject()
      if(xmlHttp==null)
        {
         alert ("Browser does not support HTTP Request")
         return;
        } 

var url="ajax_file.php";
url=url+"?m="+uname;
url=url+"&sid="+Math.random();
function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 

rep=xmlHttp.responseText;
//alert("Testing: rep= "+rep);
//alert("ajax rep: "+ rep);
 	if(rep != "")
	 {
		//alert("entered into if condition");
		if(rep == "YES"){
			document.login.userid.value = "Not needed";
			document.login.userid.disabled = true;
		}
		//alert("pass");
		 flag2="pass";
		// alert("Testing: flag2= "+flag2);
		 //alert("before refresh");
		location.href="forgetpassword.php?submit1="+input;
		//alert("after refresh");
		 //document.getElementById("result").style.visibility="hidden";
		//document.getElementById("mail_id").style.border="#000000 solid 1px";
		document.getElementById("result").innerHTML="";
		
		}
	 else
	{
		// alert("rep value is value = "+rep);
		 //alert("fail");
		//document.getElementById("result").innerHTML="Entered Login id is not here(java)";
		 flag2="fail";
		 //alert("fail");
		// alert("Testing: flag2: "+flag2);
		//return "false";
		document.getElementById("msgbox").style.visibility="visible";
						//document.getElementById("result2").innerHTML="";
						document.getElementById("result1").innerHTML="Your Login ID is not Exists";
						document.getElementById("result2").innerHTML="";
						return false;
	}
	 //alert("end fo if condition");
 } 
 //alert("end fo internal function");
 //return true;
}
xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("POST",url,true);
xmlHttp.send(null);

  }
  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;
}
	//alert("before");
	//document.getElementById("result2").innerHTML="mugilan";
	// var inp = document.frm1.login.value;
	var inp = document.getElementById("login").value;
	// alert(inp);
	//if(document.frm1.login.value=="")
		 if(document.getElementById("login").value=="")
	{
		//alert("no input");
	
		document.getElementById("msgbox").style.visibility="visible";
		

		document.getElementById("result1").innerHTML="Please Enter Your Login e-mail ID in the field";
		document.getElementById("result2").innerHTML="";
		//alert("return false");
		return false;
	}
	//else if(document.frm1.login.value!="")
		else if(document.getElementById("login").value!="")
	{
		//if(!isEmail(document.frm1.login.value))
			if(!isEmail(document.getElementById("login").value))
		{	
			//alert("no email format");
			document.getElementById("msgbox").style.visibility="visible";
		//document.getElementById("result2").innerHTML="";
			document.getElementById("result1").innerHTML="Please Enter Your Valid e-mail ID";
			//alert("return false");
		return false;
		}

		
		else if(flag2=="fail")
		{//alert("flag2: "+flag2);
			//alert("not exist");
		document.getElementById("msgbox").style.visibility="visible";
		//document.getElementById("result2").innerHTML="";
		document.getElementById("result1").innerHTML="Your Login ID is not Exists";
		//alert("return false");
		return false;
		}
	else
	{
		document.getElementById("result1").innerHTML="";
		//alert("calling function");
		internal(input);
		//out = failcheck();
		if(out == "false"){
			return false;
		}
		//alert("out of func:"+ out);
		function failcheck(){
			//alert("in failcheck");
			//document.writeln("in failchek");
				if(flag2=="fail"){
						//alert("out of funct flag2: "+flag2);
						//alert("not exist");
						document.getElementById("msgbox").style.visibility="visible";
						//document.getElementById("result2").innerHTML="";
						document.getElementById("result1").innerHTML="Your Login ID is not Exists";
						//alert("return false");
						return "false";
						}
		}
				
		//alert("out of func:"+ out);
	}
	
//alert("out of if condition");
}

document.getElementById("msgbox2").style.visibility="hidden";

}

function errorempty(){
	document.frm1.login.focus();

document.getElementById("result2").innerHTML="";

}
function check_login2()
{
	if(document.frm2.userid.value=="")
	{
		document.getElementById("result2").innerHTML="Enter Your Activation code";
		return false;
	}
	else if(document.frm2.userid.value!="")
	{
		if(flag4=="fail")
		{
				
		document.getElementById("result2").innerHTML="Your Activation code  is not exists";
		return false;
}
	else
	{
		document.getElementById("result2").innerHTML="";
		
	}
}
}
	
	
	function isEmail(str)
{
	var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;
	return regex.test(str);
}		

function imageverif(){
var image = document.getElementById("hid_imgvalue").value;
var user = document.getElementById("image_code").value;
if(image != user){
		document.getElementById("imageerror").value="check";
	/*
	document.location="signup_review.php";
	document.getElementById("imgerror").style.visibility="visible";
	document.getElementById("imgerror").innerHTML="Invalid Image code";
	return false;
	*/
	 
} else {
		document.getElementById("imageerror").value="";
}
}