<!--
///
function check_username()
{
index=1
fld_length=spaceStripper(document.form1.user.value," ","");
		if((fld_length.length==0) || (document.form1.user.value =="") || (fld_length.length<=4) ||  (fld_length.length>=11)) 
		{
		   alert("Please enter/select the user name. Enter 5-8 chars only");		   
		   index=0
		   document.form1.user.focus();
	    }
	    
     if(fld_length.length!=0)
        {
			if (!isAlpNum(document.form1.user))
			{
			index=0			
			document.form1.user.focus();
			}
			 else
			 {			
			var firstCharectar = document.form1.user.value;
			if ( (firstCharectar.substr(0,1)=="0") || (firstCharectar.substr(0,1)=="1") || (firstCharectar.substr(0,1)=="2") || (firstCharectar.substr(0,1)=="3") || (firstCharectar.substr(0,1)=="4") || (firstCharectar.substr(0,1)=="5") || (firstCharectar.substr(0,1)=="6") || (firstCharectar.substr(0,1)=="7") || (firstCharectar.substr(0,1)=="8") || (firstCharectar.substr(0,1)=="9") )
					{
					index=0
				alert("User name should not start with a number");
				//document.form1.user.value="";
				document.form1.user.focus();				
					}
			  }
		}	  
	   	   
	   if (index==1) 
	   {  
	   	document.form1.method="post";
		document.form1.action="check_user.asp";
		document.form1.submit();
		}
	
}


///


function spaceStripper(incomingText,str1,str2)
	{
		workString=incomingText;
		while (workString.indexOf(str1)!=-1)
		{
			workString=workString.substring(0,workString.indexOf(str1))+str2+workString.substring(workString.indexOf(str1)+str1.length,workString.length);
		}
		return workString;
	}

//Function to check whether the input is of alphanumeric type 
	var isAlphabetNum=0;
	function isAlpNum(incomingText)
	{
		isAlphabetNum=0;
		alphastr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
		Name=incomingText.name;
		textvalue=incomingText.value;
			for (counter=0;counter<textvalue.length;counter++)
			{
				find=textvalue.charAt(counter);
				if(alphastr.indexOf(find)==-1)
				{
					isAlphabetNum=1;
				}
			}
			if(isAlphabetNum==1)
			{
				alert("Please enter alphabets & numbers only for username & Password");
				incomingText.value="";
				incomingText.focus();
				return false;
			}
			else 
			{
				return true;
			}
	}
	
///
var testresults
function checkemail()
{
var str=spaceStripper(document.form1.email.value," ","");
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true;
else{
alert("Please input a valid email address!")
testresults=false;
}
return (testresults)
}

function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}	

///

function submit_values()
	{

//Validation of the User Name field
		fld_length1=spaceStripper(document.form1.user.value," ","");
		if((fld_length1.length==0) || (document.form1.user.value =="") || (fld_length1.length<=4) ||  (fld_length1.length>=11)) 
		{
		    alert("Please enter/select the user name. Enter 5-8 chars only");
		   document.form1.user.focus();
	       return false; 
        }
        if(fld_length1.length!=0)
        {
			if (!isAlpNum(document.form1.user))
			{
				return false;
			}
			var firstCharectar = document.form1.user.value;
			if ( (firstCharectar.substr(0,1)=="0") || (firstCharectar.substr(0,1)=="1") || (firstCharectar.substr(0,1)=="2") || (firstCharectar.substr(0,1)=="3") || (firstCharectar.substr(0,1)=="4") || (firstCharectar.substr(0,1)=="5") || (firstCharectar.substr(0,1)=="6") || (firstCharectar.substr(0,1)=="7") || (firstCharectar.substr(0,1)=="8") || (firstCharectar.substr(0,1)=="9") )
			{
				alert("User name should not start with a number");
				document.form1.user.value="";
				document.form1.user.focus();
				return false;
			}
			
		}
//Validation of the password field
		fld_length=spaceStripper(document.form1.pwd.value," ","");
		if((fld_length.length==0) || (document.form1.pwd.value =="") || (fld_length.length<=4) ||  (fld_length.length>=11)) 
		{
		   alert("Please enter the password 5-8 chars.");
		   document.form1.pwd.focus();
		   return false; 
		}
			
			if (!isAlpNum(document.form1.pwd))
		{
			return false;
		}	 


	
	if ((document.form1.user.value=="") || (document.form1.pwd.value=="") || (document.form1.custname.value=="") || (document.form1.add1.value=="") || (document.form1.pin.value=="") || (document.form1.country.value=="") || (document.form1.city.value=="") || (document.form1.phone.value=="") || (document.form1.email.value==""))

	{
	 alert("Please fill all details marked as * Required ");
	return false;
	}
	

	//validation for email		
	email_length=spaceStripper(document.form1.email.value," ","");
	if((email_length.length >0) && (!checkbae())) 
		{	
	return false;
		}

			
	
}

///
function submit_values2()
	{
		
//Validation of the User Name field
		
//Validation of the password field
		//fld_length=spaceStripper(document.form1.pwd.value," ","");
	//	if ((fld_length.length==0) || (fld_length.length<=4) || (fld_length.length>=11))  
		//{
		 //  alert("Please enter/change password to 5-10 chars");
		 //  document.form1.pwd.focus();
		  // return false; 
	//	}
			
			//if (!isAlpNum(document.form1.pwd))
	//	{
			//return false;
	//	}	 

	
	if ((document.form1.user.value=="") || (document.form1.pwd.value=="") || (document.form1.custname.value=="") || (document.form1.add1.value=="") || (document.form1.pin.value=="") || (document.form1.country.value=="") || (document.form1.city.value=="") || (document.form1.phone.value=="") || (document.form1.email.value==""))

	{
	 alert("Please fill all details marked as * Required ");
	return false;
}
	
//validation for email		
	//email_length=spaceStripper(document.form1.email.value," ","");
	//if((email_length.length >0) && (!checkbae())) 
		//{	
	//return false;
	//	}


document.form1.mode.value="Modify"
//alert(document.form1.mode.value);
	document.form1.method="post"
	document.form1.action="account.asp"
	document.form1.submit()	

		
	
	
}



//-->
