


function YY_Randimg() { //v4.0
//copyright (c)1998,2001 Yaromat.com
  if (document.images){
    var args = YY_Randimg.arguments;
    var yywho=Math.round((args.length-3)*Math.random());
    var myImg = MM_findObj(args[1]);
    if(myImg)myImg.src = args[2+yywho];
    var argStr='YY_Randimg(\"'+args[0];
    for (var i=1;i<args.length;i++){argStr+='\",\"'+args[i]}
    argStr+='\")';
    if (args[0]!="-1"){setTimeout(argStr,args[0]);}
  }
}


//Image Rollover

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



 // 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_FrmPersonal() {

                 if (document.FrmPersonal.lstOralG.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Oral Giving\" field.");
                document.FrmPersonal.lstOralG.focus();
                return (false);
    }
    if (document.FrmPersonal.lstOralR.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Oral Receiving\" field.");
                document.FrmPersonal.lstOralR.focus();
                return (false);
    }

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

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

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

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

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

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

   if (document.FrmPersonal.lstPxe.selectedIndex == 0)
    {
                alert("Please enter a value for the \"Lifestyle Experience\" field.");
                document.FrmPersonal.lstPxe.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() {

   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.txtHandle.value.length > 25)
   {
     alert("Please enter at most 25 characters in the \"Username\" field.");
     document.FrmLogin.txtHandle.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);
 }


 //  Advert Reg Form

 function Validate_FrmRegister(mode) {

   if (mode == 'create') {

           if (document.FrmRegister.txtHandle.value == "")
           {
             alert("Please enter at least 6 characters in the \"Username\" field.");
             document.FrmRegister.txtHandle.focus();
             return (false);
           }
           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.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\" 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\" 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\" 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 (document.FrmRegister.txtSurname.value.length < 2)
   {
     alert("Please enter at least 2 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.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 < 2)
   {
     alert("Please enter at least 2 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 (mode=='create' && document.FrmRegister.lstDay.selectedIndex == 0) {
               alert("Please select your Day of Birth.");
               document.FrmRegister.lstDay.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 (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 (document.FrmRegister.txtEmail.value.length < 5)
   {
     alert("Please enter at least 5 characters in the \"Email\" 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 has been supplied please re-enter.");
     document.FrmRegister.txtEmail.focus();
     return (false);
   }

   if (mode=='create' && document.FrmRegister.chkDisclaimer.checked == false)
   {
      alert("You must read and approve the Disclaimer before registering.");
      document.FrmRegister.chkDisclaimer.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.lstCity &&
       document.FrmRegister.lstCity.value <= 0)
    {
        alert("Please enter a value for the \"State\" or \"City\" field.");
        document.FrmRegister.lstCity.focus();
        return (false);
    }




    if (mode=='create' && document.FrmRegister.lstSeeking) {


    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.lstAssets.selectedIndex == 0) {
                alert("Please enter a value for the \"Assets\" field.");
                document.FrmRegister.lstAssets.focus();
                return (false);
   }

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


   if (mode=='create' && document.FrmRegister.lstSexuality.selectedIndex == 0) {
                alert("Please enter a value for the \"Sexuality\" field.");
                document.FrmRegister.lstSexuality.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.lstSmoker.selectedIndex == 0) {
                  alert("Please enter a value for the \"Smoker\" field.");
                  document.FrmRegister.lstSmoker.focus();
                  return (false);
     }


   if (mode=='create' && document.FrmRegister.lstMarital.selectedIndex == 0) {
                alert("Please enter a value for the \"Marital Status\" field.");
                document.FrmRegister.lstMarital.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.lstDrink.selectedIndex == 0) {
                alert("Please enter a value for the \"Drinking\" field.");
                document.FrmRegister.lstDrink.focus();
                return (false);
   }
         if (mode=='create' && document.FrmRegister.lstEyecolor.selectedIndex == 0) {
                alert("Please enter a value for the \"Eye Color\" field.");
                document.FrmRegister.lstEyecolor.focus();
                return (false);
   }
         if (mode=='create' && document.FrmRegister.lstHaircolor.selectedIndex == 0) {
                alert("Please enter a value for the \"Hair Color\" field.");
                document.FrmRegister.lstHaircolor.focus();
                return (false);
   }



   if (mode=='create' && document.FrmRegister.chkSeekmen.checked == false && document.FrmRegister.chkSeekwmn.checked == false && document.FrmRegister.chkSeekcpl.checked == false)
   {
     alert("Please select the genders you are \"Seeking\".");
     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 \"Profile Title\" field.");
       document.FrmRegister.txtTitle.focus();
       return (false);
   }

   if (mode=='create' && (document.FrmRegister.txtComment.value.length < 120 || document.FrmRegister.txtComment.value.length > 4000))
   {
     alert("Please enter between 120 and 4000 characters in the \"Describe Yourself\" field.");
     document.FrmRegister.txtComment.focus();
     return (false);
   }


   // Start values for partners..
   if (mode=='create' && document.FrmRegister.lstSex.value == 'C' ) {

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

   if (mode=='create' && document.FrmRegister.lstDay1.selectedIndex == 0) {
               alert("Please select your Day of Birth.");
               document.FrmRegister.lstDay1.focus();
               return (false);
   }

    if (mode=='create' && document.FrmRegister.lstMonth1.selectedIndex == 0) {
               alert("Please select your Month of Birth.");
               document.FrmRegister.lstMonth1.focus();
               return (false);
   }

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

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

     var checkOK = "0123456789";
     var checkStr = document.FrmRegister.txtYear1.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.txtYear1.focus();
       return (false);
   }

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

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

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

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


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

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

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

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

         if (mode=='create' && document.FrmRegister.lstDrink1.selectedIndex == 0) {
                alert("Please enter a value for the \"Drinker\" field.");
                document.FrmRegister.lstDrink1.focus();
                return (false);
   }
            if (mode=='create' && document.FrmRegister.lstEyecolor1.selectedIndex == 0) {
                alert("Please enter a value for the \"Eye Color\" field.");
                document.FrmRegister.lstEyecolor1.focus();
                return (false);
   }
         if (mode=='create' && document.FrmRegister.lstHaircolor1.selectedIndex == 0) {
                alert("Please enter a value for the \"Hair Color\" field.");
                document.FrmRegister.lstHaircolor1.focus();
                return (false);
   }

 }

// end partner values


}
   return (true);
 }










 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.chkSeekmen.checked == false && document.FrmAdvert.chkSeekwmn.checked == false && document.FrmAdvert.chkSeekcpl.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);
   }

   if (document.FrmAdvert.txtComment.value.length < 120 || document.FrmAdvert.txtComment.value.length > 4000 )
   {
     alert("Please enter between 120 and 4000 characters in the \"Message\" field.");
     document.FrmAdvert.txtComment.focus();
     return (false);
   }

   return (true);
 }

function delete_alert() {
        if (window.confirm("This will remove you from the system, including any profiles, mail and friendslist. 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("Do you wish to skip this part of the profile?")) {
                return true;
        } else {
                return false;
        }
}
function MDM_openWindow(theURL,winName,features) {
        var _W=window.open(theURL,winName,features);
        _W.focus();
        _W.moveTo(50,50);
}

function MDM2_openWindow(url,w,h,tb,stb,l,mb,sb,rs,x,y){
var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y; //A LITTLE CROSS-BROWSER CODE FOR WINDOW POSITIONING
tb=(tb)?'yes':'no'; stb=(stb)?'yes':'no'; l=(l)?'yes':'no'; mb=(mb)?'yes':'no'; sb=(sb)?'yes':'no'; rs=(rs)?'yes':'no';
var x=window.open(url, 'newWin'+new Date().getTime(), 'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
x.focus();
}


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;
        }
}


// Check All payments

function checkAllFields(ref)
{
var chkAll = document.getElementById('checkAll');
var checks = document.getElementsByName('chkPaid[]');
var removeButton = document.getElementById('removeChecked');
var boxLength = checks.length;
var allChecked = false;
var totalChecked = 0;
    if ( ref == 1 )
    {
        if ( chkAll.checked == true )
        {
            for ( i=0; i < boxLength; i++ )
            checks[i].checked = true;
        }
        else
        {
            for ( i=0; i < boxLength; i++ )
            checks[i].checked = false;
        }
    }
    else
    {
        for ( i=0; i < boxLength; i++ )
        {
            if ( checks[i].checked == true )
            {
            allChecked = true;
            continue;
            }
            else
            {
            allChecked = false;
            break;
            }
        }
        if ( allChecked == true )
        chkAll.checked = true;
        else
        chkAll.checked = false;
    }
    for ( j=0; j < boxLength; j++ )
    {
        if ( checks[j].checked == true )
        totalChecked++;
    }
    removeButton.value = "Remove ["+totalChecked+"] Selected";
}

function myemoticon(id,text) {
    var txtarea = document.getElementById(id);
    text = ' ' + text + ' ';

    if (txtarea.createTextRange && txtarea.caretPos) {
        var caretPos = txtarea.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
        txtarea.focus();
    } else {
        txtarea.value  += text;
        txtarea.focus();
    }
}