 // textarea counter on adverts form
  function textCounter(field, countfield) {
      {countfield.value =  field.value.length;}
  }

function Validate_FrmReports() {

  if (document.FrmReports.lstPeriod.selectedIndex == 0)
   {
               alert("Please enter a value for the \"Period\" field.");
               document.FrmReports.lstPeriod.focus();
               return (false);
   }
  if (document.FrmReports.lstYear.selectedIndex == 0)
   {
               alert("Please enter a value for the \"Year\" field.");
               document.FrmReports.lstYear.focus();
               return (false);
   }
   document.FrmReports.hdnyear.value=document.FrmReports.lstYear.value;
   document.FrmReports.hdnperiod.value=document.FrmReports.lstPeriod.value;
  return (true);
 }

 
function Validate_FrmComposeMail(e1, id) {
	
	var elems = document.FrmComposeMail.elements;
    var flag = false;
	for(var i = 0; i < elems.length; i++){
          
		if(elems[i].type == "checkbox" && elems[i].id == id) {
            
				if(elems[i].checked == true){
					flag = true;
				}
          
		}
      
		
	}
	if (flag) {
		return flag;
	}
	else{
		return flag;
	}
}

function Validate_FrmTrash(e1, id) {
	
	var elems = document.FrmEmail.elements;
    var flag = false;
	for(var i = 0; i < elems.length; i++){
          
		if(elems[i].type == "checkbox" && elems[i].id == id) {
            
				if(elems[i].checked == true){
					flag = true;
				}
          
		}
      
		
	}
	if (flag) {
		return flag;
	}
	else{
		return flag;
	}
}


function Validate_FrmScreen() {
	for (var i=0; i < document.FrmScreen.first_name.length; i++){
		if (document.FrmScreen.first_name[i].checked){
			var name_val = document.FrmScreen.first_name[i].value;
		}
	}
   
    if(name_val == '2'){
		if (document.FrmScreen.screen_name.value.length <= 0){
               alert("Please enter a value for the \"Screen name\" field.");
               document.FrmScreen.screen_name.focus();
               return (false);
		}
	}
	
   return (true);
 }
 
 function Validate_FrmPersonal() {  if (document.FrmPersonal.lstPerson1.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Personality\" field.");
                document.FrmPersonal.lstPerson1.focus();
                return (false);
    }  if (document.FrmPersonal.lstPhilos1.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Philosophy\" field.");
                document.FrmPersonal.lstPhilos1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstSocial1.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Social Group\" field.");
                document.FrmPersonal.lstSocial1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstGoal1.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Goals\" field.");
                document.FrmPersonal.lstGoal1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstHobby1.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Hobbies\" field.");
                document.FrmPersonal.lstHobby1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstSport1.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Sports\" field.");
                document.FrmPersonal.lstSport1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstMusic1.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Music\" field.");
                document.FrmPersonal.lstMusic1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstFood1.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Food\" field.");
                document.FrmPersonal.lstFood1.focus();
                return (false);
    }

   return (true);
 }
function Validate_FrmSendMail() {
  if (document.FrmSendMail.txtSubject.value.length < 2)
  {
    alert("Please enter at least 2 characters in the  \"Subject\" field.");
    document.FrmSendMail.txtSubject.focus();
    return (false);
  }
 /*if (document.FrmSendMail.txtMessage.value.length < 20)
  {
    alert("Please enter at least 20 characters in the \"Message\" field.");
    document.FrmSendMail.txtMessage.focus();
    return (false);
  }
*/
  return (true);
 }

 function Validate_FrmLogin() {
	
   // user name does not have maxlimit.
/* 	if (document.FrmLogin.txtHandle.value.length < 6)
  {
     alert("Please enter at least 6 characters in the \"Username\" field.");
     document.FrmLogin.txtHandle.focus();
     return (false);
   } 
*/
   if (document.FrmLogin.txtEmail.value.length <= 0)
   {
     alert("Please enter email.");
     document.FrmLogin.txtEmail.focus();
     return (false);
   }

   if (document.FrmLogin.txtPassword.value.length < 5)
   {
     alert("Please enter at least 6 characters in the \"Password\" field.");
     document.FrmLogin.txtPassword.focus();
     return (false);
   }

   if (document.FrmLogin.txtPassword.value.length > 10)
   {
     alert("Please enter at most 10 characters in the \"Password\" field.");
     document.FrmLogin.txtPassword.focus();
     return (false);
   }

   return (true);
 }

 function Validate_FrmRegister(mode) {

   if (mode == 'create') {

           
         /*   if (document.FrmRegister.txtHandle.value.length > 25)
           {
             alert("Please enter no more than 25 characters in the \"Username\" field.");
             document.FrmRegister.txtHandle.focus();
             return (false);
           }
          if (document.FrmRegister.txtHandle.value.length < 6)
           {
             alert("Please enter at least 6 characters in the \"Username\" field.");
             document.FrmRegister.txtHandle.focus();
             return (false);
           }
           var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ1234567890-\t\r\n\f";
           var checkStr = document.FrmRegister.txtHandle.value;
           var allValid = true;
           for (i = 0;  i < checkStr.length;  i++)
           {
             ch = checkStr.charAt(i);
             for (j = 0;  j < checkOK.length;  j++)
               if (ch == checkOK.charAt(j))
                 break;
             if (j == checkOK.length)
             {
               allValid = false;
               break;
             }
           }
           if (!allValid)
           {
             alert("Please enter only letter, numbers and \"-\" characters in the \"Username\" field.");
             document.FrmRegister.txtHandle.focus();
             return (false);
           }*/
   }
   if (document.FrmRegister.txtEmail.value.length < 5){
     alert("Please enter at least 5 characters in the \"Email Address\" field.");
     document.FrmRegister.txtEmail.focus();
     return (false);
   }

   if (document.FrmRegister.txtEmail.value.indexOf("@") < 0 || document.FrmRegister.txtEmail.value.indexOf(".") < 0)
   {
     alert("An invalid \"Email Address\" address has been supplied please re-enter.");
     document.FrmRegister.txtEmail.focus();
     return (false);
   }
   
 if (document.FrmRegister.txtEmail.value.length > 5){
	var tmp =document.FrmRegister;
	var returnval = false;
	str=tmp.txtEmail.value;
	returnvalEmail=emailValidation(str);
	if (returnvalEmail==false) {
	  alert("An invalid \"Email Address\" address has been supplied please re-enter.");
	  tmp.txtEmail.focus();
	 return (false);
	} 
}

   if (document.FrmRegister.txtEmail.value.length > 5 && mode == 'create'){
	   var emailVal= document.FrmRegister.txtEmail.value;
	   var indexDot = (emailVal.indexOf('.')+1);
	   var eduValid = emailVal.substring(indexDot);
	   var totalExt = 10;
	   var isValidEmailExt = 1;	   
	   var validEmailExt = new Array(totalExt);
		validEmailExt[0] = "ac.uk";
		validEmailExt[1] = "edu.au";
		validEmailExt[2] = "edu";
		validEmailExt[3] = "EDU";
		validEmailExt[4] = "eDU";
		validEmailExt[5] = "EDu";
		validEmailExt[6] = "eDu";
		validEmailExt[7] = "EdU";
		validEmailExt[8] = "edU";
		validEmailExt[9] = "EdU";
		for (i=0; i<totalExt;i++) {
				if (validEmailExt[i]==eduValid) {
					isValidEmailExt = 0;
					i = totalExt+1;
				} else {
					isValidEmailExt = 1;
				}
		}
		
	   var indexDot = (emailVal.lastIndexOf('.')+1);
	   var eduValid = emailVal.substring(indexDot);	
		if (isValidEmailExt==1 && eduValid=='edu'){
			isValidEmailExt = 0;
		}

var slId = emailVal.substring(emailVal.lastIndexOf('@')+1,emailVal.length)
// checking for ban email extension	 added on 24-Apr-07  - start
		if (isValidEmailExt==0){
			   var totalExtBan = 7;
			   var banEmailExt = new Array(totalExtBan);
				banEmailExt[0] = "yahoo.edu";
				banEmailExt[1] = "yahoo.com.edu";
				banEmailExt[2] = "schoolname.edu";
				banEmailExt[4] = "collegename.edu";
				banEmailExt[5] = "college.edu";
				banEmailExt[6] = "school.edu";
				
				for (j=0; j<totalExtBan;j++) {
						if (banEmailExt[j]==slId) {
							isValidEmailExt = 1;
							j = totalExtBan+1;
						} else {
							isValidEmailExt = 0;
					}
				}
		}
// checking for ban email extension	   added on 24-Apr-07  - start

	   slId= slId.toUpperCase();
	   if (isValidEmailExt==1 && slId!='STUDENTLOVE.COM'){
			alertMess='You must enter a .EDU email address to register.\n\n example: someone@collegename.edu\n\n*You may change your email address later after you have verified your .EDU address';
			alert(alertMess);
			document.FrmRegister.txtEmail.focus();
			return (false);
		}
   }
   
   
   
   if (document.FrmRegister.txtForename.value.length > 25)
   {
      alert("Please enter no more than 25 characters in the \"First name\" field.");
      document.FrmRegister.txtForename.focus();
      return (false);
   }

   if (document.FrmRegister.txtForename.value.length < 1)
   {
     alert("Please enter at least 1 characters in the \"First name\" field.");
     document.FrmRegister.txtForename.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ- \t\r\n\f";
   var checkStr = document.FrmRegister.txtForename.value;
   var allValid = true;
   for (i = 0;  i < checkStr.length;  i++)
   {
     ch = checkStr.charAt(i);
     for (j = 0;  j < checkOK.length;  j++)
       if (ch == checkOK.charAt(j))
         break;
	 if (j == checkOK.length)
     {
       allValid = false;
       break;
     }
   }
   if (!allValid)
   {
     alert("Please enter only letter, whitespace and \"-\" characters in the \"First name\" field.");
     document.FrmRegister.txtForename.focus();
     return (false);
   }
	
   if (document.FrmRegister.txtSurname.value.length < 1)
   {
     alert("Please enter at least 1 characters in the \"Last name\" field.");
     document.FrmRegister.txtSurname.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ- \t\r\n\f";
   var checkStr = document.FrmRegister.txtSurname.value;
   var allValid = true;
   for (i = 0;  i < checkStr.length;  i++)
   {
     ch = checkStr.charAt(i);
     for (j = 0;  j < checkOK.length;  j++)
       if (ch == checkOK.charAt(j))
         break;
     if (j == checkOK.length)
     {
       allValid = false;
       break;
     }
   }
   if (!allValid)
   {
     alert("Please enter only letter, whitespace and \"-\" characters in the \"Last name\" field.");
     document.FrmRegister.txtSurname.focus();
     return (false);
   }

   if (document.FrmRegister.txtSurname.value.length > 25)
    {
      alert("Please enter no more than 25 characters in the \"Last name\" field.");
      document.FrmRegister.txtSurname.focus();
      return (false);
   }
   if (document.FrmRegister.txtPassword.value.length < 6)
   {
     alert("Please enter between 6-10 characters in the \"Password\" field.");
     document.FrmRegister.txtPassword.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ1234567890";
   var checkStr = document.FrmRegister.txtPassword.value;
   var allValid = true;
   for (i = 0;  i < checkStr.length;  i++)
   {
     ch = checkStr.charAt(i);
     for (j = 0;  j < checkOK.length;  j++)
       if (ch == checkOK.charAt(j))
         break;
     if (j == checkOK.length)
     {
       allValid = false;
       break;
     }
   }
   if (!allValid)
   {
     alert("Please enter only letters and numbers in the \"Password\" field.");
     document.FrmRegister.txtPassword.focus();
     return (false);
   }

   if (document.FrmRegister.txtPassword.value.length > 10)
    {
      alert("Please enter no more than 10 characters in the \"Password\" field.");
      document.FrmRegister.txtPassword.focus();
      return (false);
   }

   if (document.FrmRegister.txtConfirm.value.length < 6)
   {
     alert("Please enter between 6-10 characters in the \"Confirm Password\" field.");
     document.FrmRegister.txtConfirm.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ1234567890";
   var checkStr = document.FrmRegister.txtConfirm.value;
   var allValid = true;
   for (i = 0;  i < checkStr.length;  i++)
   {
     ch = checkStr.charAt(i);
     for (j = 0;  j < checkOK.length;  j++)
       if (ch == checkOK.charAt(j))
         break;
     if (j == checkOK.length)
     {
       allValid = false;
       break;
     }
   }
   if (!allValid)
   {
     alert("Please enter only letters and numbers in the \"Confirm Password\" field.");
     document.FrmRegister.txtConfirm.focus();
     return (false);
   }

   if (document.FrmRegister.txtConfirm.value.length > 10)
    {
      alert("Please enter no more than 10 characters in the \"Confirm Password\" field.");
      document.FrmRegister.txtConfirm.focus();
      return (false);
   }
   if (document.FrmRegister.txtPassword.value != document.FrmRegister.txtConfirm.value)
    {
      alert("Password confirmation does not match password - please re-enter");
      document.FrmRegister.txtPassword.focus();
      return (false);
   }
   
   if (mode=='create' && document.FrmRegister.lstMonth.selectedIndex == 0) {
               alert("Please select your Month of Birth.");
               document.FrmRegister.lstMonth.focus();
               return (false);
   }
   
   if (mode=='create' && document.FrmRegister.lstDay.selectedIndex == 0) {
               alert("Please select your Day of Birth.");
               document.FrmRegister.lstDay.focus();
               return (false);
   }

   if (document.FrmRegister.txtYear.value.length < 2)
     {
       alert("Please enter 2 digits in the \"Year of Birth\" field.");
       document.FrmRegister.txtYear.focus();
       return (false);
     }

     if (document.FrmRegister.txtYear.value.length > 2)
     {
       alert("Please enter at most 2 digits in the \"Year of Birth\" field.");
       document.FrmRegister.txtYear.focus();
       return (false);
     }

     var checkOK = "0123456789";
     var checkStr = document.FrmRegister.txtYear.value;
     var allValid = true;
     for (i = 0;  i < checkStr.length;  i++)
     {
       ch = checkStr.charAt(i);
       for (j = 0;  j < checkOK.length;  j++)
         if (ch == checkOK.charAt(j))
           break;
       if (j == checkOK.length)
       {
         allValid = false;
         break;
       }
     }
     if (!allValid)
     {
       alert("Please enter only digits in the \"Year of Birth\" field.");
       document.FrmRegister.txtYear.focus();
       return (false);
   }


   /*if (mode=='create' && document.FrmRegister.lstSex.selectedIndex == 0) {
             alert("Please select your gender.");
             document.FrmRegister.lstSex.focus();
             return (false);
   }*/
   
   if (document.FrmRegister.lstCountry && document.FrmRegister.lstCountry.value <= 0){
        alert("Please enter a value for the \"Country\" field.");
        document.FrmRegister.lstCountry.focus();
        return (false);
   }

   
   /*
   if (document.FrmRegister.txtLocation)
	   if (document.FrmRegister.txtLocation.value.length < 2 || document.FrmRegister.txtLocation.value.length > 30){
	       alert("Please enter at between 2 and 30 characters in the \"Location\" field.");
	       document.FrmRegister.txtLocation.focus();
	       return (false);
	   }*/
	   
if (mode=='create') {
    /*if (mode=='create' && document.FrmRegister.lstSeeking.selectedIndex == 0) {
                alert("Please enter a value for the \"Seeking\" field.");
                document.FrmRegister.lstSeeking.focus();
                return (false);
   }

   if (mode=='create' && document.FrmRegister.lstBodyType.selectedIndex == 0) {
                alert("Please enter a value for the \"Body Type\" field.");
                document.FrmRegister.lstBodyType.focus();
                return (false);
   }


   if (mode=='create' && document.FrmRegister.lstHeight.selectedIndex == 0) {
                alert("Please enter a value for the \"Height\" field.");
                document.FrmRegister.lstHeight.focus();
                return (false);
   }

   if (mode=='create' && document.FrmRegister.lstChildren.selectedIndex == 0) {
                alert("Please enter a value for the \"Children\" field.");
                document.FrmRegister.lstChildren.focus();
                return (false);
   }


   if (mode=='create' && document.FrmRegister.lstSmoker.selectedIndex == 0) {
                  alert("Please enter a value for the \"Smoker\" field.");
                  document.FrmRegister.lstSmoker.focus();
                  return (false);
     }
   if (mode=='create' && document.FrmRegister.lstReligion.selectedIndex == 0) {
                alert("Please enter a value for the \"Religion\" field.");
                document.FrmRegister.lstReligion.focus();
                return (false);
   }
*/

/*
   if (mode=='create' && document.FrmRegister.lstEthnicity.selectedIndex == 0) {
                alert("Please enter a value for the \"Ethnicity\" field.");
                document.FrmRegister.lstEthnicity.focus();
                return (false);
   }

   if (mode=='create' && document.FrmRegister.lstEducation.selectedIndex == 0) {
                alert("Please enter a value for the \"Education\" field.");
                document.FrmRegister.lstEducation.focus();
                return (false);
   }

   if (mode=='create' && document.FrmRegister.lstEmployment.selectedIndex == 0) {
                alert("Please enter a value for the \"Employment\" field.");
                document.FrmRegister.lstEmployment.focus();
                return (false);
   }
   if (mode=='create' && document.FrmRegister.lstIncome.selectedIndex == 0) {
                alert("Please enter a value for the \"Income\" field.");
                document.FrmRegister.lstIncome.focus();
                return (false);
   } */

   lstGenCount = document.FrmRegister.lstSex.length;
   lstGender='';
   for (i=0; i<lstGenCount; i++) {
	if (document.FrmRegister.lstSex[i].checked==true) {
		lstGender=document.FrmRegister.lstSex[i].value;
	}
   }
  if (lstGender!='F' && lstGender!='M') {
        alert("Please make at least one selection for 'Gender'");
        return (false);
    }
	
  if(document.FrmRegister.lstCountry.value.match("204")){
  
	if (document.FrmRegister.txtZipcode.value.length <= 0){
       alert("Please enter valid zip code.");
	   document.FrmRegister.txtZipcode.focus();
       return (false);
	}
  }
  
 
   if (mode=='create' && document.FrmRegister.lstMarital.selectedIndex == 0) {
                alert("Please enter a value for the \"Relationship Status\" field.");
                document.FrmRegister.lstMarital.focus();
                return (false);
   }
	
  if (!document.FrmRegister.lstMySeekingD.checked &&
		!document.FrmRegister.lstMySeekingF.checked &&
		!document.FrmRegister.lstMySeekingSR.checked &&
		!document.FrmRegister.lstMySeekingMR.checked) {
        alert("Please make at least one selection for 'Interested In'");
        return (false);
    }   
/*   
   if (mode=='create' && document.FrmRegister.lstMySeeking.selectedIndex == 0){
        alert("Please enter a value for the \"Interested In\" field.");
        document.FrmRegister.lstMySeeking.focus();
        return (false);

   }
  */
  
  /* if (document.FrmRegister.chkSeekmen.checked == false && document.FrmRegister.chkSeekwmn.checked == false && document.FrmRegister.chkSeekmenwmn.checked == false)
   {
     alert("Please select the genders you are \"Interested in:\"");
     document.FrmRegister.chkSeekmen.focus();
     return (false);
   }

   if (mode=='create' && (document.FrmRegister.txtTitle.value.length < 5 || document.FrmRegister.txtTitle.value.length > 30))
   {
       alert("Please enter at between 5 and 30 characters in the \"Message Title\" field.");
       document.FrmRegister.txtTitle.focus();
       return (false);
   }*/

   if (document.FrmRegister.chkDisclaimer.checked == false){
			alert("You must read and approve the Terms of Use before registering.");
			document.FrmRegister.chkDisclaimer.focus();
			return (false);
	}
	if (document.FrmRegister.security.value == ""){
             alert("Please enter characters in the \"Security code\" field.");
             document.FrmRegister.security.focus();
             return (false);
    }
  }
   return (true);
 }

 function Validate_FrmRegister2(mode) {

	if (document.FrmRegister.lstMySex.value.length <= 0 || document.FrmRegister.lstMySex.value.match("- Choose -")){
     alert("Please select a value for the \"Like to Meet\"");
     document.FrmRegister.lstMySex.focus();
     return (false);
   }
      
 }
 
 function Validate_FrmAffiliate() {

   if (document.FrmAffiliate.txtUsername.value.length > 25)
   {
     alert("Please enter no more than 25 characters in the \"Username\" field.");
     document.FrmAffiliate.txtUsername.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtUsername.value.length < 6)
   {
     alert("Please enter at least 6 characters in the \"Username\" field.");
     document.FrmAffiliate.txtUsername.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ1234567890-\t\r\n\f";
   var checkStr = document.FrmAffiliate.txtUsername.value;
   var allValid = true;
   for (i = 0;  i < checkStr.length;  i++)
   {
     ch = checkStr.charAt(i);
     for (j = 0;  j < checkOK.length;  j++)
       if (ch == checkOK.charAt(j))
         break;
     if (j == checkOK.length)
     {
       allValid = false;
       break;
     }
   }
   if (!allValid)
   {
     alert("Please enter only letter, numbers and \"-\" characters in the \"Username\" field.");
     document.FrmAffiliate.txtUsername.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtSurname.value.length < 2)
   {
     alert("Please enter at least 2 characters in the \"Last name\" field.");
     document.FrmAffiliate.txtSurname.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ- \t\r\n\f";
   var checkStr = document.FrmAffiliate.txtSurname.value;
   var allValid = true;
   for (i = 0;  i < checkStr.length;  i++)
   {
     ch = checkStr.charAt(i);
     for (j = 0;  j < checkOK.length;  j++)
       if (ch == checkOK.charAt(j))
         break;
     if (j == checkOK.length)
     {
       allValid = false;
       break;
     }
   }
   if (!allValid)
   {
     alert("Please enter only letter, whitespace and \"-\" characters in the \"Last name\" field.");
     document.FrmAffiliate.txtSurname.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtSurname.value.length > 25)
    {
      alert("Please enter no more than 25 characters in the \"Last name\" field.");
      document.FrmAffiliate.txtSurname.focus();
      return (false);
   }

   if (document.FrmAffiliate.txtForename.value.length > 25)
    {
      alert("Please enter no more than 25 characters in the \"First name\" field.");
      document.FrmAffiliate.txtForename.focus();
      return (false);
   }

   if (document.FrmAffiliate.txtForename.value.length < 2)
   {
     alert("Please enter at least 2 characters in the \"First name\" field.");
     document.FrmAffiliate.txtForename.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ- \t\r\n\f";
   var checkStr = document.FrmAffiliate.txtForename.value;
   var allValid = true;
   for (i = 0;  i < checkStr.length;  i++)
   {
     ch = checkStr.charAt(i);
     for (j = 0;  j < checkOK.length;  j++)
       if (ch == checkOK.charAt(j))
         break;
     if (j == checkOK.length)
     {
       allValid = false;
       break;
     }
   }
   if (!allValid)
   {
     alert("Please enter only letter, whitespace and \"-\" characters in the \"First name\" field.");
     document.FrmAffiliate.txtForename.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtBusiness.value == "")
   {
     alert("Please enter a value for the \"Business name\" field.");
     document.FrmAffiliate.txtBusiness.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtAddress.value == "")
   {
     alert("Please enter a value for the \"Address\" field.");
     document.FrmAffiliate.txtAddress.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtStreet.value == "")
   {
     alert("Please enter a value for the \"Street\" field.");
     document.FrmAffiliate.txtStreet.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtTown.value == "")
   {
     alert("Please enter a value for the \"Town\" field.");
     document.FrmAffiliate.txtTown.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtState.value == "")
   {
     alert("Please enter a value for the \"State\" field.");
     document.FrmAffiliate.txtState.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtZip.value == "")
   {
     alert("Please enter a value for the \"Zip\" field.");
     document.FrmAffiliate.txtZip.focus();
     return (false);
   }

   if (document.FrmAffiliate.lstCountry.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Country\" field.");
                document.FrmAffiliate.lstCountry.focus();
                return (false);
    }

   if (document.FrmAffiliate.txtEmail.value.length < 5)
   {
     alert("Please enter at least 5 characters in the \"Email\" field.");
     document.FrmAffiliate.txtEmail.focus();
     return (false);
   }

   if (document.FrmAffiliate.txtEmail.value.indexOf("@") < 0 || document.FrmAffiliate.txtEmail.value.indexOf(".") < 0)
   {
     alert("An invalid \"Email\" address has been supplied please re-enter.");
     document.FrmAffiliate.txtEmail.focus();
     return (false);
   }

    if (document.FrmAffiliate.txtWebsite.value == "http://")
    {
      alert("Please enter a value for the \"Website\" field.");
      document.FrmAffiliate.txtWebsite.focus();
      return (false);
    }


    if (document.FrmAffiliate.txtPayable.value == "")
    {
      alert("Please enter a value for the \"Payable\" field.");
      document.FrmAffiliate.txtPayable.focus();
      return (false);
    }


   return (true);
 }

 function Validate_FrmAdvert(mode) {

   if (document.FrmAdvert.lstCountry &&
       document.FrmAdvert.lstCountry.value <= 0)
    {
        alert("Please enter a value for the \"Country\" field.");
        document.FrmAdvert.lstCountry.focus();
        return (false);
    }

   if (document.FrmAdvert.lstCity &&
       document.FrmAdvert.lstCity.value <= 0)
    {
        alert("Please enter a value for the \"City\" field.");
        document.FrmAdvert.lstCity.focus();
        return (false);
    }
	
	if (!document.FrmAdvert.lstMySeekingD.checked &&
		!document.FrmAdvert.lstMySeekingF.checked &&
		!document.FrmAdvert.lstMySeekingSR.checked &&
		!document.FrmAdvert.lstMySeekingMR.checked	)  {
        alert("Please make at least one selection for 'Interested In'");
        return (false);
    }	
	
   /* if (document.FrmAdvert.lstMySex.value.length <= 0 || document.FrmAdvert.lstMySex.value.match("- Choose -")){
     alert("Please select a value for the \"Like to Meet\"");
     document.FrmAdvert.lstMySex.focus();
     return (false);
   } */
  /* if (document.FrmAdvert.chkSeekmen.checked == false && document.FrmAdvert.chkSeekwmn.checked == false && document.FrmAdvert.chkSeekmenwmn.checked == false)
   {
     alert("Please select the genders you are \"Seeking\".");
     document.FrmAdvert.chkSeekmen.focus();
     return (false);
   }
*/

 /* if (document.FrmAdvert.txtTitle.value.length < 5 || document.FrmAdvert.txtTitle.value.length > 30)
   {
       alert("Please enter at between 5 and 30 characters in the \"Message Title\" field.");
       document.FrmAdvert.txtTitle.focus();
       return (false);
   } */

   return (true);
 }

function delete_alert() {
        if (window.confirm("This will remove you from the system, including any profiles, mail and contacts. Are you sure?")) {
                return true;
        } else {
                return false;
        }
}
function delete_alert2() {
        if (window.confirm("This will remove your profile from the system. Are you sure?")) {
                return true;
        } else {
                return false;
        }
}
function delete_alert3() {
        if (window.confirm("This will remove the profile from the system. Are you sure?")) {
                return true;
        } else {
                return false;
        }
}
function delete_alert4() {
        if (window.confirm("This will remove the member from the system. Are you sure?")) {
                return true;
        } else {
                return false;
        }
}
function skip_alert() {
        if (window.confirm("Are you sure you want to skip this step?")) {
                return true;
        } else {
                return false;
        }
}
function MDM_openWindow(theURL,winName,features) {
//        features += ',location=yes,status=yes,resizeable=yes';
        var _W=window.open(theURL,winName,features);
        _W.focus();
        _W.moveTo(50, 4);
}
function MDM_openWindow2(theURL,winName,features) {
//        features += ',location=yes,status=yes,resizeable=yes';
        var _W=window.open(theURL,winName,features);
        _W.focus();
        _W.moveTo(115, 4);
}
function selected(oRow){ oRow.style.backgroundColor='#FFFFE6'; }
function deselected(oRow){ oRow.style.backgroundColor='#DCE8FC'; }

function cupid_alert() {
        if (window.confirm("Are you sure you wish to run this process? Please check the documentation if unsure.")) {
                return true;
        } else {
                return false;
        }
}

// numeric fields accepts positive numbers only
function checkIt(evt) {
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57)) {
		status = "This field accepts numbers only."
		return false;
	}
	status = ""
	return true;
}

// for ecomments section.
function onsubmit_frmAddComment()
{
	var txtNone = document.frmAddComment.commentDesc.value;
	var txtlen = txtNone.length;
	var returnval = false;
	if (txtNone==""){
			alert ("Oops, looks like you forgot to write your eComment. Please try again.");
			document.frmAddComment.commentDesc.focus();
			returnval = false;
	}
	else if(txtlen>325){
		alert ("Sorry, eComments can't be more than 325 characters.");
		document.frmAddComment.commentDesc.focus();
		returnval = false;
	}
	else{
			returnval = true;
	}
	return returnval;
}	

//validation for prgamendad_basic.php  form name ( Frmamend_basic  )

 function Validate_Frmamend_basic(mode) {
	
	var tmp = document.Frmamend_basic;
	var returnval = false;
   
   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ- \t\r\n\f";
   var checkStr = document.Frmamend_basic.txtForename.value;
   var allValid = true;
   for (i = 0;  i < checkStr.length;  i++)
   {
     ch = checkStr.charAt(i);
     for (j = 0;  j < checkOK.length;  j++)
       if (ch == checkOK.charAt(j))
         break;
	 if (j == checkOK.length)
     {
       allValid = false;
       break;
     }
   }
   if (!allValid)
   {
     alert("Please enter only letter, whitespace and \"-\" characters in the \"First name\" field.");
     document.Frmamend_basic.txtForename.focus();
     return (false);
   }
	
   if (tmp.txtForename.value.length > 25)
   {
      alert("Please enter no more than 25 characters in the \"First name\" field.");
      tmp.txtForename.focus();
      return (false);
   }

   if (tmp.txtForename.value.length < 1)
   {
     alert("Please enter at least 1 characters in the \"First name\" field.");
     tmp.txtForename.focus();
     return (false);
   }
   
   if (tmp.txtSurname.value.length < 1)
   {
     alert("Please enter at least 1 characters in the \"Last name\" field.");
     tmp.txtSurname.focus();
     return (false);
   }   
   
   if (tmp.lstCountry && tmp.lstCountry.value <= 0)
    {
        alert("Please enter a value for the \"Country\" field.");
        tmp.lstCountry.focus();
        return (false);
    }
	
		var lstCountry =  document.getElementById('lstCountry').value;
	  if(tmp.lstCountry.value.match("204")){
		if (tmp.txtZipcode.value.length <= 0){
	       alert("Please enter valid zip code.");
		   tmp.txtZipcode.focus();
	       return (false);
		}
  }

	
	if (!tmp.lstMySeekingD.checked &&
		!tmp.lstMySeekingF.checked &&
		!tmp.lstMySeekingSR.checked &&
		!tmp.lstMySeekingMR.checked	)  {
        alert("Please make at least one selection for 'Interested In'");
        return (false);
    }
	else {
		returnval = true;
	}
	return returnval;
}


//validation for prgamendad_aboutme.php  form name ( Frmamend_aboutme  )

 function Validate_Frmamend_aboutme(mode) {
	var tmp = document.Frmamend_aboutme;
	var returnval = false;
	var maxlength = 4000;
   if (tmp.txtComment.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"About Me\" field.");
      tmp.txtComment.focus();
      return (false);
   }
    if (tmp.txtInterest.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Interest\" field.");
      tmp.txtInterest.focus();
      return (false);
   }
    if (tmp.txtGoals.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Goals\" field.");
      tmp.txtGoals.focus();
      return (false);
   }
    if (tmp.txtMusic.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Music\" field.");
      tmp.txtMusic.focus();
      return (false);
   }
    if (tmp.txtMovies.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Movies\" field.");
      tmp.txtMovies.focus();
      return (false);
   }
    if (tmp.txtTelevision.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Television\" field.");
      tmp.txtTelevision.focus();
      return (false);
   }
       if (tmp.txtBooks.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Books\" field.");
      tmp.txtBooks.focus();
      return (false);
   }
       if (tmp.txtHeroes.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Heroes\" field.");
      tmp.txtHeroes.focus();
      return (false);
   }
	else {
		returnval = true;
	}
	return returnval;
}


//validation for prgamendad_idealmatch.php  form name ( Frmamend_idealmatch  )

 function Validate_Frmamend_idealmatch(mode) {
	var tmp = document.Frmamend_idealmatch;
	var returnval = false;
	var maxlength = 4000;
   if (tmp.txtMyComment.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Ideal match\" field.");
      tmp.txtMyComment.focus();
      return (false);
   }
	else {
		returnval = true;
	}
	return returnval;
}


//validation for prgamendad_greek_clubs.php  form name ( Frmamend_greekclubs  )

 function Validate_Frmamend_greekclubs(mode) {
	var tmp = document.Frmamend_greekclubs;
	var returnval = false;
	var maxlength = 4000;
	var gcSelectCount=1;
	for (i=1; i<4; i++)
	{
		lstgc="lstgc"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Choose -') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstgc"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					gcSelectCount++;
				}
			}
		}
	}
	
   if (tmp.txtMyComment.value.length > maxlength)
   {
      alert("Please enter no more than 4000 characters in the \"Clubs/Organizations\" field.");
      tmp.txtMyComment.focus();
      return (false);
   }
   if (gcSelectCount>1)
   {
      alert("Please don't select same option.");
      return (false);
  }   
  	else {
		returnval = true;
	}
	return returnval;
}

//validation for prgamendad_lifestyle_prg.php  form name ( Frmamend_lifestyle  )

 function Validate_Frmamend_lifestyle(mode) {
	var tmp = document.Frmamend_lifestyle;
	var returnval = false;
	var lstpstTot=1;
	var lstphiTot=1;
	var lsthbsTot=1;	
	var lstsptTot=1;	
	var lstmscTot=1;	
	var lstfdtTot=1;
	var selectOption=false;
// for personality checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstpst"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstpst"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstpstTot++;
				}
			}
		}
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
	}
	
// for philosophies checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstphi"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstphi"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstphiTot++;
				}
			}
		}
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
	}

// for hobbies checking	
	for (i=1; i<4; i++)
	{
		lstgc="lsthbs"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lsthbs"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lsthbsTot++;
				}
			}
		}
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
	}

// for sports checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstspt"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstspt"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstsptTot++;
				}
			}
		}
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
	}	

// for music checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstmsc"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstmsc"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstmscTot++;
				}
			}
		}
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
	}

// for food taste checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstfdt"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstfdt"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstfdtTot++;
				}
			}
		}
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
	}
	
	if (document.getElementById("txthometown").value==''){
		alert("Please enter a value for the \"Hometown\".");
		document.Frmamend_lifestyle.txthometown.focus();			
	} else if (document.getElementById("lstsxo").value=='- Select -') {
		alert("Please select \"Sexual Orientation\".");
		document.Frmamend_lifestyle.lstsxo.focus();
	  } else if (document.getElementById("lstrlg").value=='- Select -') {
	  		alert("Please select \"Religion\".");
			document.Frmamend_lifestyle.lstrlg.focus();
	  } else if (document.getElementById("lstchl").value=='- Select -') {
	  		alert("Please select \"Children\".");
			document.Frmamend_lifestyle.lstchl.focus();			
	  } else if (document.getElementById("lstsmoker").value=='- Select -') {
	  		alert("Please select \"Smoker\".");
			document.Frmamend_lifestyle.lstsmoker.focus();			
	  } else if (document.getElementById("lstdrinker").value=='- Select -') {
			alert("Please select \"Drinker\".");  
			document.Frmamend_lifestyle.lstdrinker.focus();			
	  } else if (document.getElementById("lstedu").value=='- Select -') {
			alert("Please select \"Education\".");  
			document.Frmamend_lifestyle.lstedu.focus();			
	  } else if (document.getElementById("lstincome").value=='- Select -') {
			alert("Please select \"Income\".");  
			document.Frmamend_lifestyle.lstincome.focus();			
	  } else if (document.getElementById("lstsog").value=='- Select -') {
			alert("Please select \"Social Group\".");  
			document.Frmamend_lifestyle.lstsog.focus();						
	 } else if (document.getElementById("lstgls").value=='- Select -') {
			alert("Please select \"Goals\"."); 
			document.Frmamend_lifestyle.lstgls.focus();	
	 } else if (selectOption){
			alert("Please select atleast one option");
			return (false);		
	} else if (lstpstTot>1)  {
      alert("Please select another \"Personality\" option.");
      return (false);
	}  else if (lstphiTot>1)  { 
		alert("Please select another \"Philosophies\" option.");
      return (false);
  }	 else if (lsthbsTot>1)  { 
		alert("Please select another \"Hobbies\" option.");
      return (false);
  }  else if (lstsptTot>1)  { 
		alert("Please select another \"Sports\" option.");
      return (false);
  } else if (lstmscTot>1)  { 
		alert("Please select another \"Music\" option.");
      return (false);
  } else if (lstfdtTot>1)  { 
		alert("Please select another \"Food Taste\" option.");
      return (false);
  } else {
			returnval = true;
 }
	return returnval;
}

//validation for prgamendad_lifestyle_prg.php  form name ( Frmamend_lifestyle  )

 function Validate_Frmamend_lifestyle(mode) {
	var tmp = document.Frmamend_lifestyle;
	var returnval = false;
	var lstpstTot=1;
	var lstphiTot=1;
	var lsthbsTot=1;	
	var lstsptTot=1;	
	var lstmscTot=1;	
	var lstfdtTot=1;
//	var selectOption=false;
// for personality checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstpst"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstpst"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstpstTot++;
				}
			}
		}
/*		
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
*/		

	}
	
// for philosophies checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstphi"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstphi"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstphiTot++;
				}
			}
		}
/*		
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
*/		

	}

// for hobbies checking	
	for (i=1; i<4; i++)
	{
		lstgc="lsthbs"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lsthbs"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lsthbsTot++;
				}
			}
		}
/*		
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
*/		

	}

// for sports checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstspt"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstspt"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstsptTot++;
				}
			}
		}
/*		
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
*/		

	}	

// for music checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstmsc"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstmsc"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstmscTot++;
				}
			}
		}
/*		
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
*/		
	}

// for food taste checking	
	for (i=1; i<4; i++)
	{
		lstgc="lstfdt"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- Select -' && chkChoose!='Not stated') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstfdt"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					lstfdtTot++;
				}
			}
		}
/*		
		if (chkChoose=='- Select -'){
			selectOption = true;
		}
*/		
	}
/*	
	if (selectOption){
			alert("Please select atleast one option");
			return (false);		
	} 
*/	
  if (lstpstTot>1)  {
      alert("Please select another \"Personality\" option.");
      return (false);
	}  else if (lstphiTot>1)  { 
		alert("Please select another \"Philosophies\" option.");
      return (false);
  }	 else if (lsthbsTot>1)  { 
		alert("Please select another \"Hobbies\" option.");
      return (false);
  }  else if (lstsptTot>1)  { 
		alert("Please select another \"Sports\" option.");
      return (false);
  } else if (lstmscTot>1)  { 
		alert("Please select another \"Music\" option.");
      return (false);
  } else if (lstfdtTot>1)  { 
		alert("Please select another \"Food Taste\" option.");
      return (false);
  } else {
			returnval = true;
 }
	return returnval;
}

// end of  prgamendad_lifestyle_prg

//validation for prgamendad_colleges.php  form name ( Frmamend_colleges  )

 function Validate_Frmamend_colleges(mode) {
 	var tmp = document.Frmamend_colleges;
	var returnval = false;
	var gcSelectCount=1;
	for (i=1; i<4; i++)
	{
		lstgc="lstgc"+i;
		chkChoose = document.getElementById(lstgc).value;	
		 if (chkChoose!='- None -') {
			for (j=(i+1); j<4; j++) {
				lstgc12="lstgc"+j;
				chkChoose1 = document.getElementById(lstgc12).value;	
				if (chkChoose==chkChoose1){
					gcSelectCount++;
				}
			}
		}
	}

stateLength = document.getElementById('lstStateAjax').options.length;

 if (tmp.lstCountry1.value<0 && tmp.lstCountry1.length>0) { 
		alert("Please make a selection for \"College Country\"  ");
		tmp.lstCountry1.focus();
      return (false);
  } else if (tmp.lstState1.value==-1 && stateLength>1 || tmp.lstState1.value==false && stateLength>1) { 
		alert("Please make a selection for \"College State\"  ");
		tmp.lstStateAjax.focus();		
      return (false);
  } else if (tmp.unlist.value=="yes" && tmp.txtOtherColleges.value=="" ){
		alert("Please enter the college name");
		tmp.txtOtherColleges.focus();
      return (false);	  
  } else if (tmp.unlist.value!="yes" && tmp.txtAttended.value==-1 || tmp.unlist.value!="yes" && tmp.txtAttended.value=="" ) { 
		alert("Please make a selection for \"College Name\"  ");
		tmp.lstCityAjax.focus();		
      return (false);
  } else if (tmp.lstStatus.value=='- Select -') { 
		alert("Please make a selection for \"Status\"  ");
		tmp.lstStatus.focus();		
      return (false);
  }  else if (tmp.lstYearFrom.value>tmp.lstYearTo.value) { 
		alert("The years attended end date cannot be earlier than the start date");
		tmp.lstYearTo.focus();		
      return (false);
  }  else if (tmp.lstYearFrom.value=='- Select -' &&  tmp.lstYearTo.value!='- Select -') { 
		alert("Please make a selection for \" Years Attended Start Date \"");
		tmp.lstYearFrom.focus();		
      return (false);
  }  //else if (gcSelectCount>1) { 
    //  alert("Please don't select same option for \"Greek\" ");
	//  tmp.lstgc1.focus();			  
   //   return (false);
//  }
	else {
		returnval = true;
	}
	return returnval;
}

// getting sreen width and putting on login form for further user in Blog
function onloadGetScreenWidth() {
	document.FrmLogin.ScreenWidth.value=screen.width;
}

function onsubmitFrmComment(){
	var tmp =document.FrmComment;
	var returnval = false;
	var commentval=tmp.comment.value;
	str=tmp.email.value;

	returnvalEmail=emailValidation(str);
	
	if (tmp.author.value.length<=4) {
	  alert("Please enter atleast 5 character in  \"Name\"");
	  tmp.author.focus();
	 return (false);
	} else if (returnvalEmail==false) {
	  alert("Please enter valid email address \"Email\"");
	  tmp.email.focus();
	 return (false);
	} else if (commentval.length<20) {
	  alert("Please enter at least 20 character in \"Comment\"");
	  tmp.comment.focus();
	 return (false);
	} else {
		returnval = true;
	}
	return returnval;
}


// email validation
function emailValidation(str)
{
	var returnvalEmail=false;
	// Email - validation
	//var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
	//var re=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i	
	var re=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i	
	// Email
	if (str.length>0) {
		if (!str.match(re)){
		return false;
		}	
		else {
		returnvalEmail = true;
		}
	}
return returnvalEmail;
}

// blank validation
function blankValidation(str)
{
	var returnvalBlank=false;
	if (str.length<0 || str=="") {
		return false;
		}	
		else {
		returnvalBlank = true;
		}
	return returnvalBlank;
}

//Code added by vaishali for validating age -->
function chk_age(){
var f= document.FrmSearch.txtFromAge.value;
var t= document.FrmSearch.txtToAge.value;
if (f > t){
	alert('Please select proper Age range.');
	document.FrmSearch.txtFromAge.focus();
	return false;
}
	return true;
}//function


function confirm_msg(btn_label){
	var res;
	if (btn_label== 'Visible') {
	res=confirm("Are you sure you want to hide your profile from user search results?");
	if (res)
		document.frmMyinfo.adchangevalue.value="Y";
	else
		document.frmMyinfo.adchangevalue.value="N";
	}//if outer
		
	return true;
}

function onclickCheckbox(idyes){
		 document.getElementById(idyes).checked=true;
}

function onclickRadio(idallow){
	document.getElementById(idallow).checked=false;
}

function onsubmitFrmSearchEmail() {
	var tmp =document.FrmSearch;
	var returnval = false;
	str=tmp.email.value;
	returnvalEmail=emailValidation(str);
	if (returnvalEmail==false) {
	  alert("Please enter valid email address \"Email\"");
	  tmp.email.focus();
	 return (false);
	} else {
		returnval = true;
	}
	return returnval;	
}

function onsubmitFrmSearchName() {
	var tmp=document.FrmSearch;
	var returnval = false;
	str=tmp.firstname.value;
	valfirstName=blankValidation(str);
	
	str=tmp.lastname.value;
	vallastName=blankValidation(str);	
	if (valfirstName==false && vallastName==false) {
	  alert("First name or Last name should not be blank");
	  tmp.firstname.focus();
	 return (false);
	} else {
		returnval = true;
	}
	return returnval;	
}


function onsubmitFrmSearchAlias() {
	var tmp=document.FrmSearch;
	var returnval = false;
	str=tmp.alias.value;
	valaliasName=blankValidation(str);

	if (valaliasName==false) {
	  alert("Alias name should not be blank");
	  tmp.alias.focus();
	 return (false);
	} else {
		returnval = true;
	}
	return returnval;	
}

//
var flagSelection=true;
function selectAll(el, id){
   var elems = el.form.elements;
   for(var i = 0; i < elems.length; i++){
	  if(elems[i].type == "checkbox" && elems[i].id == id) {
		elems[i].checked = flagSelection;
	  }
   }
   if (flagSelection) {
	   document.getElementById("selectAllNone1").innerHTML= "Unselect All";
	   document.getElementById("selectAllNone2").innerHTML= "Unselect All";
   } else {
	   document.getElementById("selectAllNone1").innerHTML = "Select All";
	   document.getElementById("selectAllNone2").innerHTML = "Select All";
   }
	flagSelection=!flagSelection;
}