function IsNumber(sText,Label)
	{
	   var ValidChars = "0123456789";
	   var IsNumber=true;
	   var Char;
	   if(sText=="") {alert(Label+ " Should not be Empty");return false}
	   for (i = 0; i < sText.length && IsNumber == true; i++) 
	   { 
		  Char = sText.charAt(i); 
		  if(ValidChars.indexOf(Char) == -1) 
		  {
			 IsNumber = false;
		  }
	   }
	   if(!IsNumber)
		alert(Label+ " Must Be numeric")
	   return IsNumber;
	}
	function ValidateEmail( Email )
	{
		var atCharPresent = false;
		var dotPresent = false;

		for ( var Idx = 0; Idx < Email.length; Idx++ )
		{
			if ( Email.charAt ( Idx ) == '@' )
				atCharPresent = true;
			if ( Email.charAt ( Idx ) == '.' )
				dotPresent = true;
		}
		
		for ( var Idx = 0; Idx < Email.length; Idx++ )
			{
				if ( Email.charAt(Idx) == '	'
					|| Email.charAt(Idx) == ' '
					|| Email.charAt(Idx) == ','
					|| Email.charAt(Idx) == ';' )
				{
					//alert( "No spaces or other invalid characters are not allowed in the email. Please enter only one main email address" );
					document.form1.jsemail.focus( );
					return false;
				}
			}
		
		if ( !atCharPresent || !dotPresent )
			return false;
			
			var last_ar=Email.split(".");
			if (last_ar[last_ar.length-1].length<2)
				return false;

		return true;
	}
           
	function IsAllStrOnlySpace(txtstr) {
		var scnt=0;
		for(i=0; i < txtstr.length;i++) {
			if(txtstr.charAt(i) == " ") {
				scnt = scnt +1;
			}
		}
		if(scnt == txtstr.length) 
			return true;
		else
			return false;
	}
function numberformat(s) 
{
  if (s.substr(0,1) == '0')
 	return false;
 else if (s.substr(0,2) == '91') 
  	return false;
 else
  	return true;
}

		function validate(form)
		{
		if (document.form1.username.value == "")
		{
			alert ("Please enter your Username.");
			document.form1.username.value="";
			document.form1.username.focus();
			return false;
		}

		var len=document.form1.username.value.length;
		if(len<4)
		{
			alert("Your Username must have atleast 4 characters.");
			document.form1.username.focus();
			return false;
		}
		var len=document.form1.username.value.length;
		if(len>10)
		{
			alert("Your Username must be only 10 characters.");
			document.form1.username.focus();
			return false;
		}

		if (document.form1.password.value == "")
		{
			alert ("Please enter your password.");
			document.form1.password.value="";
			document.form1.password.focus();
			return false;
		}

		var len=document.form1.password.value.length;
		if(len<4)
		{
			alert("Your password must have atleast 4 characters.");
			document.form1.password.focus();
			return false;
		}
		
		oRegX = new RegExp(/^[0-9]+$/gi);
			if(oRegX.test(document.form1.password.value))
			{
				alert ("Password Cannot be Just Numeric Nos.");
				document.form1.password.focus();
				return false;
			}
			
		if (document.form1.confirmPassword.value == "")
		{
			alert ("Please enter your confirm password.");
			document.form1.confirmPassword.focus( );
			return false;
		}
		if(document.form1.confirmPassword.value!=document.form1.password.value)
		{
			alert("Your password and confirm password didn't match.")
			document.form1.confirmPassword.focus( );
			return false;
		}
		if (document.form1.jsemail.value == "")
		{
			alert ("Please enter your E-mail id.");
			document.form1.jsemail.focus();
			return false;
		}

		if ( !ValidateEmail( document.form1.jsemail.value ) )
		{
				alert( "Please enter a valid E-mail id." );
				document.form1.jsemail.focus( );
				return false;
		}	
		var strna= document.form1.name.value;
		if (IsAllStrOnlySpace(document.form1.name.value) == true)
		{
			alert ("Please enter your vaid Name");
			document.form1.name.value="";
			document.form1.name.focus();
			return false;
		}
		var leng=strna.length;
		if(leng<4)
		{
			alert("Your Name must have atleast 4 characters.");
			document.form1.name.focus();
			return false;
		}
		if (document.form1.gender.checked == false)
		{
			alert ("Please select Gender");
			document.form1.gender.focus( );
			return false;
		}
		if (document.form1.StartDateDay.value == "" || document.form1.StartDateDay.clicked)
		{
			alert ("Please select DOB Date");
			document.form1.StartDateDay.focus();
			return false;
		}
		if (document.form1.StartDateMonth.value == "" || document.form1.StartDateMonth.clicked)
		{
			alert ("Please select DOB Month");
			document.form1.StartDateMonth.focus();
			return false;
		}
		if (document.form1.StartDateYear.value == "" || document.form1.StartDateYear.clicked)
		{
			alert ("Please select DOB Year");
			document.form1.StartDateYear.focus();
			return false;
		}
		if (document.form1.country.value == "" || document.form1.country.clicked)
		{
			alert ("Please select Country");
			document.form1.country.focus();
			return false;
		}
		
		if (document.form1.T7.value == "" || document.form1.T7.clicked)
		{
			alert ("Please select State");
			document.form1.T7.focus();
			return false;
		}
		if (document.form1.T8.value == "" || document.form1.T8.clicked)
		{
			alert ("Please select City");
			document.form1.T8.focus();
			return false;
		}
		
		//Area Code Not Null
		var strarea= document.form1.residence_area.value;
		if (document.form1.residence_area.value != "")
		{
			var leng=strarea.length;
			if(leng<3)
			{
				alert("Area Code Cannot be Lesser than (3) Digits");
				document.form1.residence_area.focus();
				return false;
			}
			if(leng>5)
			{
				alert("Area Code Cannot be More than (5) Digits");
				document.form1.residence_area.focus();
				return false;
			}
			oRegarea = new RegExp(/^[0-9]+$/gi);
			if(!oRegarea.test(document.form1.residence_area.value))
			{
				alert ("Area Code must be only Numeric values");
				document.form1.residence_area.focus();
				return false;
			}
		}
		//Phone No. validation
		var strphone= document.form1.residence_phoneno.value;
		if (document.form1.residence_phoneno.value != "")
		{
			var leng=strphone.length;
			if(leng<6)
			{
				alert("Phone No. Cannot be Lesser than (6) Digits");
				document.form1.residence_phoneno.focus();
				return false;
			}
			if(leng>10)
			{
				alert("Phone No. Cannot be More than (10) Digits");
				document.form1.residence_phoneno.focus();
				return false;
			}
			oRegphone = new RegExp(/^[0-9]+$/gi);
			if(!oRegphone.test(document.form1.residence_phoneno.value))
			{
				alert ("Phone No. must be only Numeric values");
				document.form1.residence_phoneno.focus();
				return false;
			}
			//Area Code Validation
			var strarea= document.form1.residence_area.value;
			if (document.form1.residence_area.value == "")
			{
				alert ("Please enter Area Code.");
				document.form1.residence_area.focus( );
				return false;
			}
			var leng=strarea.length;
			if(leng<3)
			{
				alert("Area Code Cannot be Lesser than (3) Digits");
				document.form1.residence_area.focus();
				return false;
			}
			if(leng>5)
			{
				alert("Area Code Cannot be More than (5) Digits");
				document.form1.residence_area.focus();
				return false;
			}
			oRegarea = new RegExp(/^[0-9]+$/gi);
			if(!oRegarea.test(document.form1.residence_area.value))
			{
				alert ("Area Code must be only Numeric values");
				document.form1.residence_area.focus();
				return false;
			}
		}
	//Mobile & Phone Null
	if (document.form1.Mobile.value == "")
		{
			alert ("Mobile No. Must be Entered");
			document.form1.residence_phoneno.focus();
			return false;
		}
		
		//Mobile Validation
		var strmobile= document.form1.Mobile.value;
		if (document.form1.Mobile.value != "")
		{
			var leng=strmobile.length;
			if(leng<10)
			{
				alert("Mobile No. Cannot be Lesser than (10) Digits");
				document.form1.Mobile.focus();
				return false;
			}
			if(leng>16)
			{
				alert("Mobile No. Cannot be More than (16) Digits");
				document.form1.Mobile.focus();
				return false;
			}
			oRegmobile = new RegExp(/^[0-9]+$/gi);
			if(!oRegmobile.test(document.form1.Mobile.value))
			{
				alert ("Mobile No. must be only Numeric values");
				document.form1.Mobile.focus();
				return false;
			}
			if (!numberformat(document.form1.Mobile.value))
			{
				alert ("Mobile number should be in format.");
				document.form1.Mobile.focus();
				return false;
			}
		}

}
		function IsNumeric(obj)
	{
		//alert(obj.value);
		mystring = obj.value;
		if (mystring.match(/^\d+$/ ) ) {
		
			//alert("Valid number");
		}
		else
		{
			obj.value='';
			//alert("Only numeric values are allowed");
		}
	}