var fieldalias="Email address field"
function emailcheck(cur)
{
var string1=cur.value
var ePat = /^([\w-\.]+)@([\w-]+)\.([\w-\.]+)$/g;
var matchEmail=string1.match(ePat);
if (matchEmail == null)
{
 return false
}
else
return true
}
function validateprofile(profiletitle,createdby,emailid,firstname,lastname,address,Country,State,City,zipcode,dd,mm,yy,sunsign,maritialstatus,bodytype,height,complextion,residency,Religion,Caste,mother,education,occupation,income,express){

var passed=false

if (profiletitle.value=='')
{
alert("Profile Title is Empty");
profiletitle.focus();
}
else if (document.form1.createdby.selectedIndex==0)
{
alert("Please Select Created by Column");
document.form1.createdby.focus();
 return false;
}
else if(emailid.value=='')
{
alert("Please enter the valid Email ID ");
emailid.focus();
}
else if (!emailcheck(emailid))
{
alert ("Email format is invalid!");
emailid.focus();
}
else if(firstname.value=='')
{
alert("Please enter the First Name ");
firstname.focus();
}
else if(lastname.value=='')
{
alert("Please enter the Last Name ");
lastname.focus();
}
else if(address.value=='')
{
alert("Please enter the Address");
address.focus();
}
else if(document.form1.Country.selectedIndex==0)
{
alert("Please Select the Country");
document.form1.Country.focus();
 return false;
}
else if(document.form1.State.selectedIndex==0)
{
alert("Please Select the State");
document.form1.State.focus();
 return false;
}
else if(document.form1.City.selectedIndex==0)
{
alert("Please Select the City");
document.form1.City.focus();
 return false;
}
else if(zipcode.value=='' || isNaN(zipcode.value))
{
alert("Please enter the correct Zip Code");
zipcode.focus();
}
else if(dd.value=='' || isNaN(dd.value) || dd.value > 31)
{
alert("Please enter the correct date of date of birth");
dd.focus();
}
else if(mm.value=='' || isNaN(mm.value) || mm.value > 12)
{
alert("Please enter the correct month of date of birth");
mm.focus();
}
else if(yy.value=='' || isNaN(yy.value))
{
alert("Please enter the correct Year of date of birth");
yy.focus();
}
else if(document.form1.sunsign.selectedIndex==0)
{
alert("Please select the Sunsign");
document.form1.sunsign.focus();
 return false;
}
else if(document.form1.maritialstatus.selectedIndex==0)
{
alert("Please select Maritial Status");
document.form1.maritialstatus.focus();
 return false;
}
else if(document.form1.bodytype.selectedIndex==0)
{
alert("Please Select Body Type");
document.form1.bodytype.focus();
 return false;
}
else if(document.form1.height.selectedIndex==0)
{
alert("Please select Height");
document.form1.height.focus();
 return false;
}
else if(document.form1.complextion.selectedIndex==0)
{
alert("Please Select Complexion");
document.form1.complextion.focus();
 return false;
}
else if(document.form1.residency.selectedIndex==0)
{
alert("Please Select Residency Status");
document.form1.residency.focus();
}
else if(document.form1.Religion.selectedIndex==0)
{
alert("Please Select the religion");
document.form1.Religion.focus();
 return false;
}
else if(document.form1.Caste.selectedIndex==0)
{
alert("Please Select the caste");
document.form1.Caste.focus();
 return false;
}
else if(document.form1.mother.selectedIndex==0)
{
alert("Please Select the Mother Tongue");
document.form1.mother.focus();
 return false;
}
else if(document.form1.education.selectedIndex==0)
{
alert("Please Select the Education");
document.form1.education.focus();
 return false;
}
else if(document.form1.occupation.selectedIndex==0)
{
alert("Please Select the Occupation");
document.form1.occupation.focus();
 return false;
}
else if(document.form1.income.selectedIndex==0)
{
alert("Please Select income ");
document.form1.income.focus();
 return false;
}
else if(express.value=='')
{
alert("Please enter the About Yourself");
express.focus();
}
else
passed=true
return passed
}

function serch(mtongue,agemin,agemax){
var passed=false
if(document.form1.mtongue.selectedIndex==0)
    {
    alert("Please select Language");
    document.form1.mtongue.focus();
    return false;
    }	
else
if(agemin.value>agemax.value)
	  {
	  alert("Invalid Age Range")	  
	  }
else
  passed=true
return passed
}

function verify(newpass,confirmpass)
{
var passed=false
   	if(newpass.value=='')
	{
	 alert("Please enter your Password")
	 newpass.focus()
	}	
   else
   if(confirmpass.value=='')
	{
	 alert("Please enter your Confirm Password to Confirm")
	 confirmpass.focus()
	}
   else
   if(newpass.value!=confirmpass.value)
	  {
	  alert("Your Password Did not match")
	   confirmpass.focus()
	  }	
  else
	  passed=true
	  return passed
}

function contact(name, subject, email, comments)
{
var passed = false
		if (name.value=='')
			{
			alert("Please enter Your name")
			name.focus()
			}
		else
		if (subject.value=='')
			{
				alert("Please enter Your Subject")
				subject.focus()
			}
		else
		if (!emailcheck(email))
   			{
		    alert("Email format is invalid")
		    email.focus()
  			}
		else
		if (comments.value=='')
			{
			alert("Please enter your comments")
			comments.focus()
			}
		else
  			passed=true
			return passed
}

function forgot(useremail)
{
var passed=false
  if (!emailcheck(useremail))
   	{
	    alert("Email format is incorrect")
		useremail.focus()
  	}
 else
	  passed=true
	  return passed
}

function popup(FILE, FEATURES) {
        CONTENT = "<HTML> <HEAD><TITLE>Profile Image</TITLE></HEAD>" + "<BODY><CENTER ><P><IMG SRC='" + FILE + "' BORDER=0>" + "</CENTER>"+ " <FORM><center><a href = '#' onclick='window.close()'> Close  </a>" + "</center></table></DIV></FORM></BODY></HTML>";	
		pop = window.open("","",FEATURES);
		pop.document.open();
        pop.focus();
		pop.document.write(CONTENT);
		pop.document.oncontextmenu=new Function("return false");
        pop.document.close();
		return false;
} 

function refer(respemail)
{
var passed=false
if (!emailcheck(respemail))
{
alert("Recipient's Email format is incorrect")
respemail.focus()
}
else
passed=true
return passed
}

function serch1(agemin,agemax){
var passed=false
if(agemin.value>agemax.value)
	  {
	  alert("Invalid Age Range")	  
	  }
else
  passed=true
return passed
}

function configure(adminid,adminpass)
{
var passed=false
if(adminid.value=='')
{
	alert("Please enter the Admin Login ID")
	adminid.focus()
}
else
if(adminpass.value=='')
{
	alert("Please enter the Admin Password")
	adminpass.focus()
}	
else
passed=true
return passed
}

function template(types,tempname,title,subject,content){
var passed=false
if(document.form2.types.selectedIndex==0)
    {
    alert("Please select the Content Type of the Template");
    document.form2.types.focus();
    return false;
    }
 else
if (tempname.value=='')
 {
  alert("Please enter the Template Name ")
  tempname.focus()
 }
 else
if (title.value=='')
 {
  alert("Please enter the Title of the Template")
  title.focus()
 }
 else
if (subject.value=='')
 {
  alert("Please enter the Subject of the Template")
  subject.focus()
 }
 else
if (content.value=='')
 {
  alert("Please enter the Body of the Template")
  content.focus()
 }
 else
  passed=true
return passed
}

function valid(grpname,amount,duration){
var passed=false
if (grpname.value=='')
 {
  alert("Please enter the Group Name ")
  grpname.focus()
 }
else
if (amount.value=='')
 {
  alert("Please enter the Amount ")
  amount.focus()
 }
else
if (isNaN(duration.value) || duration.value=='')
 {
  alert("Please enter the Valid Group Duration ")
  duration.focus()
 }
else
  passed=true
return passed
}