function chk(PE,SDt)
{	

	var ProExist
	var msg;
	var msg1;
	var dateflag;
	var flag;
	var flag1;
	var now;
	ProExist=PE
	msg1="";
	msg="";
	flag1=0
	flag=0;
	
	if(document.frm.txtUserName.value=="")
	{
		msg1= msg1 + "\n" + " User name"
		flag1=1;
	}

	if(document.frm.txtPassword.value=="")
	{
		msg1= msg1 + "\n" + " Password"
		flag1=1;
	}
	if(document.frm.txtConfirmPassword.value=="")
	{
		msg1= msg1 + "\n" + " Confirm Password"
		flag1=1;
	}
	if(document.frm.txtPassword.value!=document.frm.txtConfirmPassword.value)
	{
		msg1= msg1 + "\n" + " Password and Confirm Passowrd do not Match "
		flag1=1;
	}

	if(document.frm.ProFirstName.value=="")
	{
		msg1= msg1 + "\n" + " Frist Name"
		flag1=1;
	}
	if(document.frm.ProLastName.value=="")
	{
		msg1= msg1 + "\n" + " Last Name"
		flag1=1;
	}
	
	if(document.frm.ProFatherName.value=="")
	{
		msg1= msg1 + "\n" + " Father's Name"
		flag1=1;
	}
	if(document.frm.ProMotherName.value=="")
	{
		msg1= msg1 + "\n" + " Mother's Name"
		flag1=1;
	}
	if(document.frm.ProrRAdd1.value=="")
	{
		msg1= msg1 + "\n" + " Residential Address"
		flag1=1;
	}
	if(document.frm.ProrRPincode.value=="")
	{
		msg1= msg1 + "\n" + " Residential Pin Code"
		flag1=1;
	}
	

	if((document.frm.city.options[eval(document.frm.city.selectedIndex)]).text=="-- Choose from list --")
	{
		msg1=msg1 + "\n" + " Residential City";
		flag1=1;
	}
	
	if((document.frm.country.options[eval(document.frm.country.selectedIndex)]).text=="Select Country")
	{
		msg1=msg1 + "\n" + " Residential Country";
		flag1=1;
	}

	if(trim(document.frm.ProrRTel1.value).length == 0 && trim(document.frm.ProrRTel2.value).length == 0)
	{
		msg1=msg1 + "\n" + " Residential Telephone";
		flag1=1;
	}


	if((document.frm.state.options[eval(document.frm.state.selectedIndex)]).text=="Unspecified")
	{
		msg1=msg1 + "\n" + " Residential State";
		flag1=1;
	}
	if(!Validemail(document.frm.vcAdvtEmail.value))
	{
		msg1= msg1 + "\n" + " Email Address"
		flag=1;
	}

	if((document.frm.birth_country.options[eval(document.frm.birth_country.selectedIndex)]).text=="Select Birth Country")
	{
		msg1=msg1 + "\n" + " Birth Country";
		flag1=1;
	}
	if((document.frm.bcity.options[eval(document.frm.bcity.selectedIndex)]).text=="-- Choose from list --")
	{
		msg1=msg1 + "\n" + " Birth City";
		flag1=1;
	}
	if((document.frm.star_sign.options[eval(document.frm.star_sign.selectedIndex)]).text=="Select Star Sign")
	{
		msg1=msg1 + "\n" + " Star Sign";
		flag1=1;
	}
	if((document.frm.cast.options[eval(document.frm.cast.selectedIndex)]).text=="Unspecified")
	{
		msg1=msg1 + "\n" + " Cast";
		flag1=1;
	}
	if((document.frm.occupation.options[eval(document.frm.occupation.selectedIndex)]).text=="Specify Occupation")
	{
		msg1=msg1 + "\n" + " Occupation";
		flag1=1;
	}
	if((document.frm.education.options[eval(document.frm.education.selectedIndex)]).text=="Unspecified")
	{
		msg1=msg1 + "\n" + " Education";
		flag1=1;
	}
	if((document.frm.marital.options[eval(document.frm.marital.selectedIndex)]).text=="Unspecified")
	{
		msg1=msg1 + "\n" + " Marital Status";
		flag1=1;
	}
	if((document.frm.home_lang.options[eval(document.frm.home_lang.selectedIndex)]).text=="")
	{
		msg1=msg1 + "\n" + " Home Language";
		flag1=1;
	}
	if(document.frm.ProIncome.value=="")
	{
		msg1= msg1 + "\n" + " Monthly Income"
		flag1=1;
	}

	if(document.frm.lookinfor.value=="")
	{
		msg1= msg1 + "\n" + " Looking For"
		flag1=1;
	}
	if(flag1==1)
	{
	
		alert("Please Fill the Following Fields " + msg1);
		return false;
	}
	else
	{
		if(document.frm.ChkTermAccept.checked)
		{
			//DO Nothing
		}
		else
		{
			alert('Please Tick (Yes) for the terms and condition');
			document.frm.ChkTermAccept.focus();
			return false;
		}
	}


	if (flag1==0 && flag==0)
	{
		var flag2=0;
		var x;
		msg="";
		x= document.frm.weight.value*1
		if (isNaN(x))
		{
			msg=msg+"\n"+" Weight Should be numeric";
			flag2=1;
		}
		if(isNaN(x)==false)
		{
			if(x<=0)
			{
				msg=msg+"\n"+" Weight Should be greater than zero kgs";
				flag2=1;
			}
		}
		if (flag2==1)
		{
			alert("Error Found in" + msg);
			return false;
		}
		if (flag2==0)
		{
			//alert("Done")
			//document.frm.action="Createuserprofile.asp?SD="+SDt;
			//document.frm.submit();	
			
		}
	}
	
}

function ltrim ( s )
{
	return s.replace( /^\s*/, "" )
}

function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}

function trim ( s )
{
	return rtrim(ltrim(s));
}

function Validemail(stremail)
{
	var strPat = /^(.+)@(.+)\.(.+)$/;
	var matchArray = stremail.match(strPat)
	if (matchArray == null) 
	{
		return false;
	}
	
	return true;
}

