var temp1,temp2,str,chr;
function ChkFormOnPage(key){
//if (profile.UserName.value==""){alert("Please choose a username!!");profile.UserName.select();return false;};
//if (profile.UserName.value.length<6){alert("Please choose a username of 6 characters or more!!");profile.UserName.select();profile.UserName.focus();return false;};
if (profile.email.value==""){alert("Please enter your email id!!");profile.email.focus();profile.email.select();return false;};
if (profile.email.value!="")
{str=profile.email.value;
for (i = 0; i < str.length; i++){
chr = str.substring(i, i + 1);
if(chr=="'"){
alert("Invalid Email Id");profile.email.focus();profile.email.select();
return false;}};
//////////////////////////////////

function a(a){alert(a);profile.email.focus();profile.email.select();return false;};
if(profile.email.value!=""){
	
	var str,count=0;
	var countd=0;
	
	str=new String(profile.email.value);
		for(var i=0;i<str.length;++i){
			temp1=str.charAt(i);
			temp2=str.charAt(i);
			
			if(temp1=='@')count=count+1;
			if(temp2=='.')countd=countd+1;
			
			if((i==0)&&(count==1))return a("'@' cann't be at first place in your e-mail id...");
			if(count>1)return a("'@' Sign cann't be more than one in your e-mail id...");
			if((count==0)&&(i==str.length-1))return a("'@' Sign must shuld be in your e-mail id...");
			if((str.charAt(str.length-1)=='@')&&(str.indexOf("@")==str.length-1))return a("Your e-mail id must contain server name after '@' sign...");
			if((countd==0)&&(i==str.length-1))return a("'.' Sign must shuld be in your e-mail id...");
			if((str.charAt(str.length-1)=='.')&&(str.indexOf(".")==str.length-1))return a("Your e-mail id id not valid...");
			
}};};
if (key.email_2.value!=key.email.value){alert("Both email ids should be equal!!");profile.email_2.focus();profile.email_2.select();return false;};
///////////////////////////////////////////CHK EMAIL ID ENDS 

///////////////////////////////////////////CHK PASSWORD		
if (profile.password_1.value==""){alert("Please enter a password!!");profile.password_1.focus();profile.password_1.select();return false;};
if (profile.password_1.value.length<6){alert("Your password is too small!! use >6");profile.password_1.focus();profile.password_1.select();return false;};
if (profile.password_1.value!=profile.password_2.value){alert("Both passwords are not equal!!");profile.password_2.select();profile.password_2.focus();return false;};
///////////////////////////////////////////CHK PASSWORD
		

///////////////////////////////////////////CHK FirstName		
if (profile.FirstName.value==""){alert("Please enter your first name!!");;profile.FirstName.focus();profile.FirstName.select();
		return false;};

if (profile.FirstName.value!=""){
		
		str=profile.FirstName.value;
		for (i = 0; i < str.length; i++)
		{
		chr = str.substring(i, i + 1);
		if(chr=="0" || chr=="1" || chr=="2" || chr=="3" || chr=="4" || chr=="5" || chr=="6" || chr=="7" || chr=="8" || chr=="9" ){
		alert("Numbers not allowed!!");profile.FirstName.focus();profile.FirstName.select();
		return false;}
		};
	
		
};
///////////////////////////////////////////CHK FirstName	

////Middle name
if (profile.MiddleName.value!=""){
		
		str=profile.MiddleName.value;
		for (i = 0; i < str.length; i++)
		{
		chr = str.substring(i, i + 1);
		if(chr=="0" || chr=="1" || chr=="2" || chr=="3" || chr=="4" || chr=="5" || chr=="6" || chr=="7" || chr=="8" || chr=="9" ){
		alert("Numbers not allowed!!");profile.MiddleName.focus();profile.MiddleName.select();
		return false;}
		};
	
		
};

///Last name
if (profile.LastName.value!=""){
		
		str=profile.LastName.value;
		for (i = 0; i < str.length; i++)
		{
		chr = str.substring(i, i + 1);
		if(chr=="0" || chr=="1" || chr=="2" || chr=="3" || chr=="4" || chr=="5" || chr=="6" || chr=="7" || chr=="8" || chr=="9" ){
		alert("Numbers not allowed!!");profile.LastName.focus();profile.LastName.select();
		return false;}
		};
	
		
};
/////Date of Birth
if (key.year.value>1986){alert("You are too young to creat profile!!");profile.year.focus();return false;};

///////Height--height
if (key.height.value==0){alert("Please select your height!!");profile.height.focus();return false;};

//educationlevel
if (key.educationlevel.value==0){alert("Please select your education!!");profile.educationlevel.focus();return false;};

///occupation
if (key.occupation.value==0){alert("Please select your occupation!!");profile.occupation.focus();return false;};
//+++++++++++++++++++
if (key.NumberOfBrothers.value!=""){
		
		str=profile.NumberOfBrothers.value;
		for (i = 0; i < str.length; i++)
		{
		chr = str.substring(i, i + 1);
		if(chr=="0" || chr=="1" || chr=="2" || chr=="3" || chr=="4" || chr=="5" || chr=="6" || chr=="7" || chr=="8" || chr=="9"){
		}else
		{
		alert("Only numbers allowed!!");profile.NumberOfBrothers.focus();profile.NumberOfBrothers.select();
		return false;
		}};
	
};

//NumberOfSisters
if (key.NumberOfSisters.value!=""){
		
		str=profile.NumberOfSisters.value;
		for (i = 0; i < str.length; i++)
		{
		chr = str.substring(i, i + 1);
		if(chr=="0" || chr=="1" || chr=="2" || chr=="3" || chr=="4" || chr=="5" || chr=="6" || chr=="7" || chr=="8" || chr=="9"){
		
		}else
		{
		alert("Only numbers allowed!!");profile.NumberOfSisters.focus();profile.NumberOfSisters.select();
		return false;
		}};
	
};
//aboutyourself
if (key.aboutyourself.value==""){alert("You should enter details about yoyrself!!");profile.aboutyourself.focus();profile.aboutyourself.select();return false;};
if (key.aboutyourself.value.length<100){alert("Details should not be <100 characters!!");profile.aboutyourself.focus();profile.aboutyourself.select();return false;};
if (!key.agree.checked){alert("Please confirm that you have read and agree to its service");return false;};

return true;
///////////////////////////////////
};
	