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 validate()
		{
		
		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;
		}

		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;
		}
		

		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 Date");
			document.form1.StartDateDay.focus();
			return false;
		}
		if (document.form1.StartDateMonth.value == "" || document.form1.StartDateMonth.clicked)
		{
			alert ("Please select Month");
			document.form1.StartDateMonth.focus();
			return false;
		}
		if (document.form1.StartDateYear.value == "" || document.form1.StartDateYear.clicked)
		{
			alert ("Please select 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.stateCity.value == "" || document.form1.stateCity.clicked)
		{
			alert ("Please select State");
			document.form1.stateCity.focus();
			return false;
		}
		
		if (document.form1.residence_area.value == "")
		{
			alert ("Please enter city Code.");
			document.form1.residence_area.focus( );
			return false;
		}
		
		if (document.form1.residence_phoneno.value == "")
		{
			alert ("Please enter your Phone Number.");
			document.form1.residence_phoneno.focus( );
			return false;
		}
		if (document.form1.terms.checked == false)
		{
			alert ("Accept Our Terms and Policies");
			document.form1.terms.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");
		}
	}