
function clear12()
{
	document.getElementById('user_name').value="";
	document.getElementById('user_address').value="";
	document.getElementById('state_name').value="";
	document.getElementById('City_name').value="";  
	document.getElementById('post_code').value="";
	document.getElementById('phone').value="";
	document.getElementById('mobile_num').value="";
	document.getElementById('Email_id').value="";
	document.getElementById('password').value="";
	document.getElementById('con_password').value="";
	return false;
}


		function validate()
		{
			if (document.Form1.user_name.value=="")
			{
				alert("Please enter the user name");
				document.Form1.user_name.focus();
				return false;
			}
			if(document.getElementById('user_name').value.length>50)
			{
				alert("Your name should not greater than 50 characters.");
				document.getElementById('user_name').value="";
				document.getElementById('user_name').focus();
				return false;
			}
		  
			if (document.Form1.mobile_num.value=="")
			{
				alert("Please enter the Mobile Number.");
				document.Form1.mobile_num.focus();
				return false;
			}
			if(document.getElementById('mobile_num').value.length!=10)
			{
				alert("Please enter correct mobile number.");
				document.getElementById('mobile_num').value="";
				document.getElementById('mobile_num').focus();
				return false;
			}
			
			if(document.getElementById('state_name').value.length>50)
			{
				alert("Your state name should not greater than 50 characters. ");
				document.getElementById('state_name').value="";
				document.getElementById('state_name').focus();
				return false;
			}	
				
			if(document.getElementById('City_name').value.length>50)
			{
				alert("Your city name should not greater than 50 characters. ");
				document.getElementById('City_name').value="";
				document.getElementById('City_name').focus();
				return false;
			}	
			 
			if (validatepcode(document.Form1.post_code.value) == false)
			{
			   alert("Please Enter the numarice value at postcode");
			   document.getElementById('post_code').value="";
			   document.Form1.post_code.focus();
			   return false;
			}
			
			 if(document.getElementById('post_code').value.length>8)
			{
				alert("Your postal code should not greater tahn 8 characters.");
				document.getElementById('post_code').value="";
				document.getElementById('post_code').focus();
				return false;
			}	
			
			/*if(document.getElementById('mobile_num').value.length>11)
			{
				alert('Please enter the correct mobile number');
				return false;
			}  */
		 
		  if (document.Form1.Email_id.value=="")
		  {
		   alert("Please enter Email id");
		   document.Form1.Email_id.focus();
		   return false;
		  }
		  else
		  {
			if (isEmail(document.Form1.Email_id.value) == false)
			{
				alert("Please Enter Your E-mail Address Correctly");
				document.Form1.Email_id.value="";
				document.Form1.Email_id.focus();
				return false;
			}
		  }			  
		  if (document.Form1.password.value=="")
		  {
		   alert("Please enter password");
		   document.Form1.password.focus();
		   return false;
		  }
		  obj=document.getElementById('password');
		  pass=obj.value;
		  if(pass.length<6)
		  {
		    alert("Password should be minimum 6 characters")
			document.Form1.password.value="";
		    document.Form1.password.focus();
		    return false;
		  }  
		   if (document.Form1.con_password.value=="")
		  {
		   alert("Please enter re-password");
		   document.Form1.con_password.focus();
		   return false;
		  }
		  
		  if(document.Form1.password.value != document.Form1.con_password.value)
			{
				alert("Your confirm Password not matched with your password.");
				document.getElementById('con_password').value="";
				document.Form1.con_password.focus();
				return false;
			}	
		}
		
		
		function validate1()
		{
			if (document.Form1.user_name.value=="")
			{
				alert("Please enter the user name");
				document.Form1.user_name.focus();
				return false;
			}
			if(document.getElementById('user_name').value.length>50)
			{
				alert("Your name should not greater than 50 characters.");
				document.getElementById('user_name').value="";
				document.getElementById('user_name').focus();
				return false;
			}
		  
			if (document.Form1.mobile_num.value=="")
			{
				alert("Please enter the Mobile Number.");
				document.Form1.mobile_num.focus();
				return false;
			}
			if(document.getElementById('mobile_num').value.length!=10)
			{
				alert("Please enter correct mobile number.");
				document.getElementById('mobile_num').value="";
				document.getElementById('mobile_num').focus();
				return false;
			}
			
			if(document.getElementById('state_name').value.length>50)
			{
				alert("Your state name should not greater than 50 characters. ");
				document.getElementById('state_name').value="";
				document.getElementById('state_name').focus();
				return false;
			}	
				
			if(document.getElementById('City_name').value.length>50)
			{
				alert("Your city name should not greater than 50 characters. ");
				document.getElementById('City_name').value="";
				document.getElementById('City_name').focus();
				return false;
			}	
			 
			if (validatepcode(document.Form1.post_code.value) == false)
			{
			   alert("Please Enter the numarice value at postcode");
			   document.getElementById('post_code').value="";
			   document.Form1.post_code.focus();
			   return false;
			}
			
			 if(document.getElementById('post_code').value.length>8)
			{
				alert("Your postal code should not greater tahn 8 characters.");
				document.getElementById('post_code').value="";
				document.getElementById('post_code').focus();
				return false;
			}	
			
			/*if(document.getElementById('mobile_num').value.length>11)
			{
				alert('Please enter the correct mobile number');
				return false;
			}  */
		 
		  if (document.Form1.Email_id.value=="")
		  {
		   alert("Please enter Email id");
		   document.Form1.Email_id.focus();
		   return false;
		  }
		  else
		  {
			if (isEmail(document.Form1.Email_id.value) == false)
			{
				alert("Please Enter Your E-mail Address Correctly");
				document.Form1.Email_id.value="";
				document.Form1.Email_id.focus();
				return false;
			}
		  }	
		  
		  
		  if(document.getElementById('password').value=="" || document.getElementById('con_password').value== "" || document.getElementById('password').value != document.getElementById('con_password').value)
			{
				alert("Your confirm Password not matched with your password.");
				document.getElementById('con_password').value="";
				document.Form1.con_password.focus();
				return false;
			}	
		}
		

		
		function sixpass()
		{
		/*if(document.getElementById('password').value.length<6)
		  {
		  alert(document.getElementById('password').value);
		    alert("Your Password should be minimum 6 characters")
		    document.getElementById('password').value="";
		    document.Form1.password.focus();
		    return false;
		  } */
		  obj=document.getElementById('password');
		  pass=obj.value;
		  if(pass.length<6)
		  {
		    alert("Your Password should be minimum 6 characters")
		    document.Form1.password.focus();
		     document.getElementById('password').value="";
		    return false;
		  }   
		}
		
		function isEmail(email)
		{
			var x=email.split('@');
			var y=x[1].split('.');
			if(x[0]=="")
			return false;
			if(y[0]=="")
			return false;			
			 if (document.Form1.Email_id.value.indexOf("@") != "-1" &&
			document.Form1.Email_id.value.indexOf(".") != "-1" )
			 return true;
			 else return false;
		}
		function validatepcode(post_code)
		 {
     		if(isNaN(document.Form1.post_code.value))
	    	return false;
	      else 
	      
	      return true;
       }		
	var xmlHttp
function GetXmlHttpObject(handler)
{ 
		var objXmlHttp=null
		
		if (navigator.userAgent.indexOf("Opera")>=0)
		{
		alert("This example doesn't work in Opera") 
		return 
		}
		if (navigator.userAgent.indexOf("MSIE")>=0)
		{ 
			var strName="Msxml2.XMLHTTP"
			if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
			{
				strName="Microsoft.XMLHTTP"
			} 
			try
			{ 
				objXmlHttp=new ActiveXObject(strName)
				objXmlHttp.onreadystatechange=handler 
				return objXmlHttp
			} 
			catch(e)
			{ 
				alert("Error. Scripting for ActiveX might be disabled") 
			return 
			} 
		} 
		if (navigator.userAgent.indexOf("Mozilla")>=0)
			{
			objXmlHttp=new XMLHttpRequest()
			objXmlHttp.onload=handler
			objXmlHttp.onerror=handler 
			return objXmlHttp
			}
} 

function test(val)
{

		var url="ajaxdrop.aspx?val=" + val
		//var url="photo1.php"
		xmlHttp=GetXmlHttpObject(headeMChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
}
function headeMChanged() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 

		document.getElementById("statename").innerHTML = xmlHttp.responseText 
		//alert(xmlHttp.responseText)
		} 
} 
function fillcity(city)
{

		var url="ajaxdrop.aspx?city=" + city
		//var url="photo1.php"
		xmlHttp=GetXmlHttpObject(headeMChangedcity)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
}
function headeMChangedcity() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 

		document.getElementById("cityname").innerHTML = xmlHttp.responseText 
		//alert(xmlHttp.responseText)
		} 
} 
function checkkey1(event)
{
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
if(keyCode>47 && keyCode<58)
{
return true;
}
else
{
	//alert('Please enter any numeric value.');
	event.keyCode=null;
	return false;
}
}

/*LOGIN FORGOT*/       

function Check()
{ 

	if (Form1.username.value=="")
	{
		alert("Please enter the username");
		Form1.username.focus();
		return false;
	}
	if (Form1.userpwd.value=="")
	{
		alert("Please enter the Password");
		Form1.userpwd.focus();
		return false;
	}

	if (Form1.remember_me.checked==true)
	{
		username=Form1.username.value 
		usernamepwd=Form1.userpwd.value
		if (username!=null && username!="" && usernamepwd!=null && usernamepwd!="" )
		{
		setCookie('username',username, 'usernamepwd',usernamepwd,365)
		}
	}
	if (Form1.username.value!="" && Form1.userpwd.value!="")
	{
		newUser();
		return false;
	}
}



/**
* Function Name : ValidateNumeric
* Purpose : This function is used to check numeric value
* Date of Creation: 24-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function ValidateNumeric(e)
{
	var keyCode="";
	if(navigator.appName.indexOf("Microsoft") != -1)//for ie
	{
	keyCode = e.keyCode;
	}
	else
	{
	keyCode = e.which;
	}
	if(keyCode!=0)
	{
	if ((keyCode > 57 || keyCode < 48) && (keyCode!=8))
	return false;
	}
} 

function getCookie(c_name)
{
if (document.cookie.length>0)
{ 
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
{ 
c_start=c_start + c_name.length+1 
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
} 
}
return ""
}

function setCookie(c_name,value,c_namepwd,valuew,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "==" +escape(value)+ "==" +c_namepwd+ "==" +escape(valuew)+ 
((expiredays==null) ? "" : "; expires="+exdate.toGMTString())
}

function checkCookie()
{
username=getCookie('username')
bdat=username.split("==");

user=bdat[0]
if (bdat[0]!="")
{
user=user.replace('=','');
Form1.username.value=user
Form1.userpwd.value=bdat[2]
}

}
function passforget()
{
	window.open("Forgetpassword.aspx","ForgetPassword","toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=20,left=50,width=539,height=200,titlebar=yes");
}
/**
* Function Name : checkSpace
* Purpose : This function is used to check white space
* Date of Creation: 25-March-2010
* Created By : 4C Plus Int co.
* Last Date of Modification:
* Modified By :
* Summary of Modifications :
*/
function checkSpace(e){

    var keyCode="";
    if(navigator.appName.indexOf("Microsoft") != -1)//for ie
    {
        keyCode = e.keyCode; 	
    }
    else
    {
        keyCode = e.which; 
    }
    if (keyCode == 32 || keyCode == 39) 
    return false;
}



/**/
function newUser()
	{
		
		var txtml=document.getElementById('username').value;
		var txtnm=document.getElementById('userpwd').value;
		xmlHttp=GetXmlHttpObject_1()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="insert_u.aspx";
		url=url+"?q=newuser&txtuname="+txtml+"&txtupass="+txtnm;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=valuechanged_1 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	
		function valuechanged_1() 
	{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" )
	 { 
	 	//alert(xmlHttp.responseText);
		var responseText = xmlHttp.responseText; //is shown blank in firefox.
		if(responseText=="Success")
		{
		alert("Reply received! Server is up.");
		returncode=false;
		}
		else if(responseText=="Failure")
		{
		alert("Error in connection.");	
		returncode=false;
		} 
	  
	 if(xmlHttp.responseText=="false")
	 {
		document.getElementById('closeUsrD').style.display="block";
	 }
	 else
	 {
		window.location.href="epapermain.aspx";
	 }
	 
	 } 
	}
	
	function GetXmlHttpObject_1()
	{
	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;
	} 
	

