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

function Validate_FrmReports() {

  if (document.FrmReports.lstPeriod.selectedIndex == 0)
   {
               alert("الرجاء اختيار الفتره");
               document.FrmReports.lstPeriod.focus();
               return (false);
   }
  if (document.FrmReports.lstYear.selectedIndex == 0)
   {
               alert("الرجاء اختيار السنة");
               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.lstPerson1.selectedIndex == 0)
    {
                alert("يرجي الاختيار من وصف الشخصية");
                document.FrmPersonal.lstPerson1.focus();
                return (false);
    }  if (document.FrmPersonal.lstPhilos1.selectedIndex == 0)
    {
                alert("يرجى الاختيار من التطلعات");
                document.FrmPersonal.lstPhilos1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstSocial1.selectedIndex == 0)
    {
                alert("يرجى الاختيار من الاهتمامات");
                document.FrmPersonal.lstSocial1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstGoal1.selectedIndex == 0)
    {
                alert("الرجاء الاختيار من الاهداف");
                document.FrmPersonal.lstGoal1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstHobby1.selectedIndex == 0)
    {
                alert("الرجاء اختيار الهوايات");
                document.FrmPersonal.lstHobby1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstSport1.selectedIndex == 0)
    {
                alert("الرجاء اختيار الرياضات");
                document.FrmPersonal.lstSport1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstMusic1.selectedIndex == 0)
    {
                alert("الرجاء اختيار الموسيقى");
                document.FrmPersonal.lstMusic1.focus();
                return (false);
    }

   if (document.FrmPersonal.lstFood1.selectedIndex == 0)
    {
                alert("الرجاء اختيار الطعام المفضل");
                document.FrmPersonal.lstFood1.focus();
                return (false);
    }

   return (true);
 }
function Validate_FrmSendMail() {
  if (document.FrmSendMail.txtSubject.value.length < 2)
  {
    alert("الرجاء ادخال موضوع الرسالة");
    document.FrmSendMail.txtSubject.focus();
    return (false);
  }
  if (document.FrmSendMail.txtMessage.value.length < 20)
  {
    alert("الرجاء ادخال 20 حرف على الاقل في جسد الرسالة");
    document.FrmSendMail.txtMessage.focus();
    return (false);
  }

  return (true);
 }

 function Validate_FrmLogin() {

   if (document.FrmLogin.txtHandle.value.length < 6)
   {
     alert("اسم المستخدم يجب ان يكون 6 احرف على الاقل");
     document.FrmLogin.txtHandle.focus();
     return (false);
   }

   if (document.FrmLogin.txtHandle.value.length > 25)
   {
     alert("اسم المستخدم يجب ان لا يزيد عن 25 حرف");
     document.FrmLogin.txtHandle.focus();
     return (false);
   }

   if (document.FrmLogin.txtPassword.value.length < 5)
   {
     alert("كلمة السر يجب ان لا تقل عن 6 احرف");
     document.FrmLogin.txtPassword.focus();
     return (false);
   }

   if (document.FrmLogin.txtPassword.value.length > 10)
   {
     alert("كلمة السر يجب ان لا تزيد عن 10 احرف");
     document.FrmLogin.txtPassword.focus();
     return (false);
   }

   return (true);
 }

 function Validate_FrmLogin2() {

   if (document.FrmLogin2.txtHandle2.value.length < 6)
   {
     alert("اسم المستخدم يجب ان يكون 6 احرف على الاقل");
     document.FrmLogin2.txtHandle2.focus();
     return (false);
   }

   if (document.FrmLogin2.txtHandle2.value.length > 25)
   {
     alert("اسم المستخدم يجب ان لا يزيد عن 25 حرف");
     document.FrmLogin2.txtHandle2.focus();
     return (false);
   }

   if (document.FrmLogin2.txtPassword.value.length < 5)
   {
     alert("كلمة السر يجب ان لا تقل عن 6 احرف");
     document.FrmLogin2.txtPassword.focus();
     return (false);
   }

   if (document.FrmLogin2.txtPassword.value.length > 10)
   {
     alert("كلمة السر يجب ان لا تزيد عن 10 احرف");
     document.FrmLogin2.txtPassword.focus();
     return (false);
   }

   return (true);
 }
/******************************** *********************************  start      register       form     *********************************************************/
/******************************** *********************************  start      register       form     *********************************************************/
 function Validate_FrmRegister(mode) {

   if (mode == 'create') {
        
 
   if (document.FrmRegister.txtHandle.value.length < 1)
           {
             alert("الرجاء إدخال اسم مستخدم");
             document.FrmRegister.txtHandle.focus();
             return (false);
           }       		   
           
   
   if (document.FrmRegister.txtPassword.value.length < 1)
   {
     alert("الرجاء إدخال كلمة سر");
     document.FrmRegister.txtPassword.focus();
     return (false);
   }

   if (document.FrmRegister.txtPassword.value != document.FrmRegister.txtConfirm.value)
    {
      alert("كلمة سر التأكيد غير مطابقة");
      document.FrmRegister.txtPassword.focus();
      return (false);
   }
   if (document.FrmRegister.txtSurname.value.length < 1)
   {
     alert("الرجاء إدخال اسم العائلة");
     document.FrmRegister.txtSurname.focus();
     return (false);
   }

   if (document.FrmRegister.txtForename.value.length < 1)
   {
     alert("الرجاء إدخال الاسم");
     document.FrmRegister.txtForename.focus();
     return (false);
   }
if (document.FrmRegister.txtEmail.value.length < 5)
   {
     alert("الرجاء إدخال البريد الالكتروني");
     document.FrmRegister.txtEmail.focus();
     return (false);
   }

   if (document.FrmRegister.txtEmail.value.indexOf("@") < 0 || document.FrmRegister.txtEmail.value.indexOf(".") < 0)
   {
     alert("عنوان البريد الالكتروني المستخدم غير صحيح يرجي التأكد مره اخرى");
     document.FrmRegister.txtEmail.focus();
     return (false);
   }
     if (document.FrmRegister.Country.value =="N")
    {
        alert("الرجاء اختيار الدولة");
        document.FrmRegister.Country.focus();
        return (false);
    }
	
}
   return (true);
 }
/******************************** ********************************* end      register       form     *********************************************************/
/******************************** ********************************* end      register       form     *********************************************************/




 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("اسم المستخدم يجب ان يكون 6 احرف على الاقل");
     document.FrmAffiliate.txtUsername.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";
   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("يسمح فقط باستخدام احرف و ارقام و \"-\" في حقل اسم المستخدم");
     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ƒٹŒژڑœ‍ںہءآأؤإئابةتثجحخدذرزسشصضطظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِّùْûü‎‏ے1234567890- \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("يرجى ادخال الاسم حرفين على الاقل");
     document.FrmAffiliate.txtForename.focus();
     return (false);
   }

   var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒٹŒژڑœ‍ںہءآأؤإئابةتثجحخدذرزسشصضطظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِّùْûü‎‏ے1234567890- \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("الرجاء ادخال عنوان البريد الالكتروني 5 احرف على الاقل");
     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("يرجى اختيار الدولة");
        document.FrmAdvert.lstCountry.focus();
        return (false);
    }

   if (document.FrmAdvert.lstCity &&
       document.FrmAdvert.lstCity.value <= 0)
    {
        alert("برجي اختيار المدينة");
        document.FrmAdvert.lstCity.focus();
        return (false);
    }

   if (document.FrmAdvert.chkSeekmen.checked == false && document.FrmAdvert.chkSeekwmn.checked == false && document.FrmAdvert.chkSeekcpl.checked == false)
   {
     alert("يرجي اختيار الهدف من التسجيل - زواج او صداقة");
     document.FrmAdvert.chkSeekmen.focus();
     return (false);
   }


   if (document.FrmAdvert.txtTitle.value.length < 5 || document.FrmAdvert.txtTitle.value.length > 30)
   {
       alert("الرجاء ادخال 5 - 30 حرف في عنوان النبذه");
       document.FrmAdvert.txtTitle.focus();
       return (false);
   }

   if (document.FrmAdvert.txtComment.value.length < 120 || document.FrmAdvert.txtComment.value.length > 4000 )
   {
     alert("الرجاء ادخال اكثر من 120 حرف عن نفسك");
     document.FrmAdvert.txtComment.focus();
     return (false);
   }

   return (true);
 }

function delete_alert() {
        if (window.confirm("سيتم حذف حسابك و كافة بياناتك من الموقع - هل انت متأكد من ذلك ؟")) {
                return true;
        } else {
                return false;
        }
}
function delete_alert2() {
        if (window.confirm("هل انت متأكد من حذف النبذه من الموقع ؟")) {
                return true;
        } else {
                return false;
        }
}
function delete_alert3() {
        if (window.confirm("هل انت متأكد من حذف النبذه من الموقع ؟")) {
                return true;
        } else {
                return false;
        }
}
function delete_alert4() {
        if (window.confirm("سيتم ازالة المشترك من الموقع - هل انت متأكد ؟")) {
                return true;
        } else {
                return false;
        }
}
function skip_alert() {
        if (window.confirm("هل ترغب بتخطي هذا الجزء من معلومات النبذه ؟")) {
                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 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;
        }
}



