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.theform.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 validateform(theform)
{
			var emailId = theform.email.value;
			var apos=emailId.indexOf("@");
			var dotpos=emailId.lastIndexOf(".");
			var lastpos=emailId.length-1;	
		if(theform.profileid.value == "")
			{
				alert("please enter Profile ID");
				theform.profileid.focus();
				return false;
			}
	    
		if(theform.name.value == "")
			{
				alert("please enter your Full Name");
				theform.name.focus();
				return false;
			}
		if (emailId.indexOf(' ')==-1 && 0 < emailId.indexOf('@') && 0 < emailId.indexOf('.') && emailId.indexOf('@')+1 < emailId.length && emailId.length >= 5)
		{
	    }
		else
	    {
	      alert("Please provide a valid email address");
	      theform.email.focus();
	      return false;
		}
			
			
			
		  if(theform.email.value == "")
			{
				alert("Please enter Email");
				theform.email.focus();
				return false;
			}
			
			
			
			else if(theform.retypeemail.value == "")
			{
				alert("Please Re-type Email");
				theform.retypeemail.focus();
				return false;
			}
			
			else if(theform.retypeemail.value != theform.email.value)
			{
				alert("Email Mismatch! Please Re-type correct Email");
				theform.retypeemail.focus();
				theform.retypeemail.select();
				return false;
			}			
			
			else if(theform.password1.value == "")
			{
				alert("Please enter Password");
				theform.password1.focus();
				return false;
			}
	
			else if(theform.password2.value == "")
			{
				alert("Please Retype Password");
				theform.password2.focus();
				return false;
			}
			
			else if(theform.password2.value != theform.password1.value)
			{
				alert("Password Mismatch! Please Retype Correct Password");
				theform.password2.focus();
				theform.password2.select();
				return false;
			}
			
			else if(theform.gender[1].checked == false && theform.gender[0].checked == false)
			{
				alert("Please select gender");
				return false;
			}
			
			else if(theform.day.options[theform.day.selectedIndex].value == "")
			{
				alert("Please select your date of birth");
				theform.day.focus();
				return false;
			}
			
			else if(theform.month.options[theform.month.selectedIndex].value == "")
			{
				alert("Please select your date of birth");
				theform.day.focus();
				return false;
			}
			
			else if(theform.year.options[theform.year.selectedIndex].value == "")
			{
				alert("Please select your date of birth");
				theform.day.focus();
				return false;
			}
	//Area Code Not Null
		var strarea= theform.tarea.value;
		if (theform.tarea.value != "")
		{
			var leng=strarea.length;
			if(leng<3)
			{
				alert("Area Code Cannot be Lesser than (3) Digits");
				theform.tarea.focus();
				return false;
			}
			if(leng>3)
			{
				alert("Area Code Cannot be More than (3) Digits");
				theform.tarea.focus();
				return false;
			}
			oRegarea = new RegExp(/^[0-9]+$/gi);
			if(!oRegarea.test(theform.tarea.value))
			{
				alert ("Area Code must be only Numeric values");
				theform.tarea.focus();
				return false;
			}
		}
		//Phone No. validation
		var strphone= theform.telno.value;
		if (theform.telno.value != "")
		{
			var leng=strphone.length;
			if(leng<6)
			{
				alert("Phone No. Cannot be Lesser than (6) Digits");
				theform.telno.focus();
				return false;
			}
			if(leng>10)
			{
				alert("Phone No. Cannot be More than (10) Digits");
				theform.telno.focus();
				return false;
			}
			oRegphone = new RegExp(/^[0-9]+$/gi);
			if(!oRegphone.test(theform.telno.value))
			{
				alert ("Phone No. must be only Numeric values");
				theform.telno.focus();
				return false;
			}
		}
		
	//mobile Validation
		var strmobile= theform.mobile.value;
		if (theform.mobile.value != "")
		{
			var leng=strmobile.length;
			if(leng<10)
			{
				alert("Mobile No. Cannot be Lesser than (10) Digits");
				theform.mobile.focus();
				return false;
			}
			if(leng>16)
			{
				alert("Mobile No. Cannot be More than (16) Digits");
				theform.mobile.focus();
				return false;
			}
			oRegmobile = new RegExp(/^[0-9]+$/gi);
			if(!oRegmobile.test(theform.mobile.value))
			{
				alert ("Mobile No. must be only Numeric values");
				theform.mobile.focus();
				return false;
			}
		}
		//Telephone and mobile validation
	if(theform.telno.value == "" && theform.mobile.value == "")
			{
				alert("Either Phone No. or Mobile No. Must be Entered");
				theform.telno.focus();
				return false;
			}
	else if(theform.occupation.options[theform.occupation.selectedIndex].value == "")
			{
				alert("Please select your Profession");
				theform.occupation.focus();
				return false;
			}
			
			else if(theform.community.options[theform.community.selectedIndex].value == "")
			{
				alert("Please select your Religion/Community");
				theform.community.focus();
				return false;
			}
			
			else if(theform.countryofresidence.options[theform.countryofresidence.selectedIndex].value == "")
			{
				alert("Please select your Country of Residence");
				theform.countryofresidence.focus();
				return false;
			}
			
			else if(theform.confirm_policy.checked == false)
			{
				alert("You need to be agree with our privacy policy and terms and conditions");
				theform.confirm_policy.focus();
				return false;
			}
			return true;
		}

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");
		}
}

