function FrontPage_Form1_Validator(theForm)
{

  if (theForm.esmh.value == "")
  {
    alert("الرجاء كتابة اسم المستخدم ");
    theForm.esmh.focus();
    return (false);
  }

  if (theForm.esmh.value.length < 2)
  {
    alert("بجب أن يكون اسم المستخدم أكبر من حرفين");
    theForm.esmh.focus();
    return (false);
  }

  if (theForm.esmh.value.length > 20)
  {
    alert("يجب ألا يتجاوز اسم المستخدم عن العشرين حرفاً");
    theForm.esmh.focus();
    return (false);
  }

  if (theForm.nike.value == "")
  {
    alert("الرجاء كتابة الكنية");
    theForm.nike.focus();
    return (false);
  }

  if (theForm.nike.value.length < 2)
  {
    alert("يجب أن تكون الكنية أطول من حرفين");
    theForm.nike.focus();
    return (false);
  }

  if (theForm.nike.value.length > 20)
  {
    alert("يجب ألا تتجاوز الكنية العشرون حرف");
    theForm.nike.focus();
    return (false);
  }

  if (theForm.UsrName.value == "")
  {
    alert("الرجاء كتابة اسم الأب");
    theForm.UsrName.focus();
    return (false);
  }

  if (theForm.UsrName.value.length < 2)
  {
    alert("يجب أن يكون الاسم أكبر من حرفين");
    theForm.UsrName.focus();
    return (false);
  }

  if (theForm.UsrName.value.length > 20)
  {
    alert("يجب ألا يزيد الاسم عن عشرين حرف");
    theForm.UsrName.focus();
    return (false);
  }

  if (theForm.sex.selectedIndex == 0)
  {
    alert("الرجاء اختيار الجنس");
    theForm.sex.focus();
    return (false);
  }

  if (theForm.countryRES.selectedIndex == 0)
  {
    alert("الرجاء اختيار الدولة");
    theForm.countryRES.focus();
    return (false);
  }


  if (theForm.bridh.value == "")
  {
    alert("الرجاء كتابة البريد الالكتروني");
    theForm.bridh.focus();
    return (false);
  }
  if (theForm.ConfirnCode.value != theForm.txtCode.value)
  {
    alert("الكود العشوائي غير صحيح");
    theForm.txtCode.focus();
    return (false);
  }
  if (theForm.txtCode.value=="")
  {
    alert("الرجاء كتابة كتابة الكود العشوائي");
    theForm.txtCode.focus();
    return (false);
  }
  
  //if (theForm.okk.value == "0")
  //{
  //  alert("البريد الالكتروني مستخدم مسبقاً");
  //  return (false);
 // }

  if (theForm.phone.value == "")
  {
    alert("الرجاء كتابة رقم الهاتف");
    theForm.phone.focus();
    return (false);
  }
  
  if (theForm.birth.value == "")
  {
    alert("الرجاء كتابة تارخ الميلاد");
    theForm.birth.focus();
    return (false);
  }
  var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i		
  var checkOK = "0123456789-.";
  var checkStr = theForm.phone.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  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 (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else
      allNum += ch;
  }
  if (!allValid)
  {
    alert("يرجي كتابة أرقام فقط في رقم الهاتف");
    theForm.phone.focus();
    return (false);
  }

  if (decPoints > 1 || !validGroups)
  {
    alert("الرجاء كتابة رقم هاتف صحيح !");
    theForm.phone.focus();
    return (false);
  }

  var checkOK = "0123456789-.";
  var checkStr = theForm.mobil.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  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 (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else
      allNum += ch;
  }
  if (!allValid)
  {
    alert("يرجي كتابة رقم جوال صحيح");
    theForm.mobil.focus();
    return (false);
  }

  if (decPoints > 1 || !validGroups)
  {
    alert("الرجاء كتابة رقم الجوال");
    theForm.mobil.focus();
    return (false);
  }
  
  if (!filter.test(theForm.bridh.value)) {
 	alert("يجب ادخال بريد الكتروني صالح ؟!!");
 	return (false);
 } 
 
 
   if (theForm.job.selectedIndex == 0)
  {
    alert("الرجاء اختيار مهنة");
    theForm.job.focus();
    return (false);
  }
   if (theForm.how.selectedIndex == 0)
  {
    alert("الرجاء اكتابة المحافظة");
    theForm.how.focus();
    return (false);
  }

 
  return (true);
}
