/* Trim Function */
function trim(value)
 {
  temp=value;
  return temp.replace(/^\s*(\b.*\b|)\s*$/, "$1");
 }

/* validContactForm Function */
function validContactForm(form_id)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);

  // Beginning of Regular Expressions Creating
  regular_phones=/^([0-9\-\+]{9,})$/;
  regular_email_address=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  // End of Regular Expressions Creating

  // Beginning of Full Name Checking
  temp=trim(passForm.full_name.value);
  passForm.full_name.value=temp;
  if (temp=="")
     {
      alert("אנא מלאו את שמכם המלא.");
      passForm.full_name.focus();
      return false;
     }
  // End of Full Name Checking

  // Beginning of Phone Number Checking
  temp=trim(passForm.phone_number.value);
  passForm.phone_number.value=temp;
  if (!(regular_phones.test(temp)))
     {
      alert("אנא מלאו את מספר הטלפון שלכם בספרות, קווים מפרידים וסימני + בלבד.");
      passForm.phone_number.focus();
      return false;
     }
  // End of Phone Number Checking

  // Beginning of E-mail Address Checking
  temp=trim(passForm.email_address.value);
  passForm.email_address.value=temp;
  if (!(regular_email_address.test(temp)))
     {
      alert("אנא מלאו כתובת דואר אלקטרוני תקינה.");
      passForm.email_address.focus();
      return false;
     }
  // End of E-mail Address Checking

  // Beginning of Remarks Checking
  temp=trim(passForm.remarks.value);
  passForm.remarks.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו את תוכן הפנייה.");
      passForm.remarks.focus();
      return false;
     }
  // End of Remarks Checking
  return true;
 }

/* validQAForm Function */
function validQAForm(form_id)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);

  // Beginning of Remarks Checking
  temp=trim(passForm.remarks.value);
  passForm.remarks.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו את מהות הבעיה.");
      passForm.remarks.focus();
      return false;
     }
  // End of Remarks Checking
  return true;
 }

/* validTellYourFriendForm Function */
function validTellYourFriendForm(form_id)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);

  // Beginning of Regular Expressions Creating
  regular_email_address=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  // End of Regular Expressions Creating

  // Beginning of My Name Checking
  temp=trim(passForm.my_name.value);
  passForm.my_name.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו את שמכם המלא.");
      passForm.my_name.focus();
      return false;
     }
  // End of My Name Checking

  // Beginning of My E-mail Address Checking
  temp=trim(passForm.my_email_address.value);
  passForm.my_email_address.value=temp;
  if (!(regular_email_address.test(temp)))
     {
      alert("אנא רשמו כתובת הדואר האלקטרוני שלכם בצורה תקינה.");
      passForm.my_email_address.focus();
      return false;
     }
  // End of My E-mail Address Checking

  // Beginning of Friend's Name Checking
  temp=trim(passForm.friend_name.value);
  passForm.friend_name.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו את שמו המלא של חברכם.");
      passForm.friend_name.focus();
      return false;
     }
  // End of Friend's Name Checking

  // Beginning of Friend's E-mail Address Checking
  temp=trim(passForm.friend_email_address.value);
  passForm.friend_email_address.value=temp;
  if (!(regular_email_address.test(temp)))
     {
      alert("אנא רשמו כתובת הדואר האלקטרוני של חברכם בצורה תקינה.");
      passForm.friend_email_address.focus();
      return false;
     }
  // End of Friend's E-mail Address Checking
  return true;
 }

/* validPasswordRestoreForm Function */
function validPasswordRestoreForm(form_id)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);

  // Beginning of Regular Expressions Creating
  regular_email_address=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  // End of Regular Expressions Creating

  // Beginning of Email Address Checking
  temp=trim(passForm.email_address.value);
  passForm.email_address.value=temp;
  if (!(regular_email_address.test(temp)))
     {
      alert("אנא ציינו את כתובת הדואר האלקטרוני שלכם בתבנית תקינה.");
      passForm.email_address.focus();
      return false;
     }
  // End of Email Address Checking
  return true;
 }

/* validSubscriptionWithTermsForm Function */
function validSubscriptionWithTermsForm(form_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   // Beginning of Regular Expressions Creating
   regular_hebrew=/^([^a-zA-Z0-9_]{1,})$/;
   regular_english=/^([a-zA-Z0-9]{1,})$/;
   regular_phones=/^([0-9\-\+]{9,})$/;
   regular_email_address=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
   // End of Regular Expressions Creating

   // ----------------------------------------------------------------------------------------------------

   // Beginning of First Name Checking
   temp=trim(passForm.first_name.value);
   passForm.first_name.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את השם הפרטי.\nרב תודות.");
	passForm.first_name.focus();
	return false;
      }

   exp ="Set_Cookie('subscription_form[first_name]', '"+escape(temp)+"', 30, '/');";
   eval(exp);
   // End of First Name Checking

   // Beginning of Last Name Checking
   temp=trim(passForm.last_name.value);
   passForm.last_name.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את שם המשפחה.\nרב תודות.");
	passForm.last_name.focus();
	return false;
      }

   exp ="Set_Cookie('subscription_form[last_name]', '"+escape(temp)+"', 30, '/');";
   eval(exp);
   // End of Last Name Checking

   // Beginning of Nickname Checking
   temp=trim(passForm.nickname.value);
   passForm.nickname.value=temp;
   if (temp=="")
      {
	alert("אנא בחרו כינוי לשימוש בפורום.\nרב תודות.");
	passForm.nickname.focus();
	return false;
      }

   exp ="Set_Cookie('subscription_form[nickname]', '"+escape(temp)+"', 30, '/');";
   eval(exp);
   // End of Nickname Checking

   // Beginning of Phone Number Checking
   temp=trim(passForm.phone_number.value);
   passForm.phone_number.value=temp;
   if (!(regular_phones.test(temp)))
      {
	alert("אנא מלאו את מספר הטלפון שלכם בספרות, קווים מפרידים וסימני + בלבד.");
	passForm.phone_number.focus();
	return false;
      }
      
   exp ="Set_Cookie('subscription_form[phone_number]', '"+escape(temp)+"', 30, '/');";
   eval(exp);
   // End of Phone Number Checking

   // Beginning of E-mail Address Checking
   temp=trim(passForm.email_address.value);
   passForm.email_address.value=temp;
   if (!(regular_email_address.test(temp)))
      {
	alert("אנא רשמו את כתובת הדואר האלקטרוני בתבנית תקינה.");
	passForm.email_address.focus();
	return false;
      }

   exp ="Set_Cookie('subscription_form[email_address]', '"+temp+"', 30, '/');";
   eval(exp);
   // End of E-mail Address Checking
   
   // Beginning of Exam Date Checking
   temp=trim(passForm.exam_date.value);
   passForm.exam_date.value=temp;
   if (temp=="")
      {
	alert("אנא בחרו במועד שבו אתם ניגשים לבחינה.");
	passForm.exam_date.focus();
	return false;
      }

   exp ="Set_Cookie('subscription_form[exam_date]', '"+temp+"', 30, '/');";
   eval(exp);
   // End of Exam Date Checking

   // Beginning of Studying Place Checking
   temp=trim(passForm.studying_place.value);
   passForm.studying_place.value=temp;
   if (temp=="")
      {
	alert("אנא בחרו איפה אתם לומדים לבחינה הפסיכומטרית.");
	passForm.studying_place.focus();
	return false;
      }

   exp ="Set_Cookie('subscription_form[studying_place]', '"+temp+"', 30, '/');";
   eval(exp);
   // End of Studying Place Checking
   
   // Beginning of City Checking
   temp=trim(passForm.city.value);
   passForm.city.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו אזור מגורים.");
	passForm.city.focus();
	return false;
      }
      
   exp ="Set_Cookie('subscription_form[city]', '"+escape(temp)+"', 30, '/');";
   eval(exp);
   // End of City Checking
   
   // Beginning of Captcha Checking
   temp=trim(passForm.captcha_code.value);
   passForm.captcha_code.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את רצף התווים המופיע בתמונה.");
	passForm.captcha_code.focus();
	return false;
      }
   // End of Captcha Checking

   // Beginning of Terms of Use Checking
   temp=document.getElementById('terms').checked;
   if (!temp)
      {
	alert("אנא אשרו את תנאי השימוש.");
	return false;
      }
   // End of Terms of Use Checking
   return true;
  }

/* validLoginForm Function */
function validLoginForm(form_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   // Beginning of Regular Expressions Creating
   regular_email_address=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
   regular_english=/^([a-zA-Z0-9_]{1,})$/;
   // End of Regular Expressions Creating

   // Beginning of Email Address Checking
   temp=trim(passForm.email_address.value);
   passForm.email_address.value=temp;
   if (!(regular_email_address.test(temp)))
      {
	alert("אנא ציינו את כתובת הדואר האלקטרוני שלכם בתבנית תקינה.");
	passForm.email_address.focus();
	return false;
      }
   // End of Email Address Checking

   // Beginning of Password Checking
   temp=trim(passForm.password.value);
   passForm.password.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את הסיסמה המבוקשת באותיות לועזיות ובספרות בלבד.");
	passForm.password.focus();
	return false;
      }
   // End of Password Checking
   return true;
  }

/* validWordsForm Function */
function validWordsForm(passForm)
  {
   // Beginning of Word Letter Checking
   temp=trim(passForm.word_letter.value);
   passForm.word_letter.value=temp;
   if (temp=="")
      {
	alert("אנא בחרו באות הראשונה של המילה.");
	passForm.word_letter.focus();
	return false;
      }
   // End of Word Letter Checking
  
   // Beginning of Word Checking
   temp=trim(passForm.word.value);
   passForm.word.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את המילה.");
	passForm.word.focus();
	return false;
      }
   // End of Word Checking

   // Beginning of Explanation Checking
   temp=trim(passForm.explanation.value);
   passForm.explanation.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את הפירוש.");
	passForm.explanation.focus();
	return false;
      }
   // End of Explanation Checking

   // Beginning of Difficulty Checking
   temp=trim(passForm.difficulty.value);
   passForm.difficulty.value=temp;
   if (temp=="")
      {
	alert("אנא בחרו בדרגת הקושי.");
	passForm.difficulty.focus();
	return false;
      }
   // End of Difficulty Checking
   return true;
  }

/* validQuestionnaireForm Function */
function validQuestionnaireForm(form_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   count_answers=0;

   q_amount=passForm.q_amount.value;
   q_amount=parseInt(q_amount);

   for (i=1; i<=q_amount; i++)
	{
	 valid_q=0;
	 
	 for (j=1; j<=4; j++)
	     {
	      exp ="q_value=passForm.q"+i+"_"+j+".checked;";
	      eval(exp);
	      
	      if (q_value)
		  { valid_q++; }
	     }
	     
	 if (valid_q==1)
	    { count_answers++; }
	}

   if (count_answers==0)
      { message ="לא ענית על אף שאלה."; }

   if (count_answers==1)
      { message ="ענית על שאלה אחת בלבד."; }

   if (count_answers>1)
      {
	message ="ענית על ";
	message+=count_answers;
	message+=" שאלות בלבד.";
      }
	
   if (count_answers<q_amount)
      {
	alert(message+"\nעליך לענות על כל השאלות.");
	return false;
      }

   return true;
  }

/* change_radio_button Function */
function change_radio_button(q_number, q_bg, selected_answer)
  {
   for (j=1; j<=4; j++)
	{
	 if (j==selected_answer)
	    { exp="temp=document.getElementById('"+q_number+j+"').style.background='url(images/numbers/"+q_bg+"-black.png) no-repeat center';"; }
	 else
	    { exp="temp=document.getElementById('"+q_number+j+"').style.background='url(images/numbers/"+q_bg+j+".png) no-repeat center';"; }

	 eval(exp);
	}
  }

function popitup(win_url, win_height, win_width)
  {
   temp="window.open('"+win_url+"', 'פורטל פסיכומטרי', 'height="+win_height+"px, width="+win_width+"px, toolbar=0, status=0, scrollbars=0, resizable=0, menubar=0, left=50px, top=50px');";
   eval(temp);
  }

/* validMsgForm Function */
function validMsgForm(form_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   // Beginning of Subject Checking
   temp=trim(passForm.subject.value);
   passForm.subject.value=temp;
   if (temp=="")
      {
       alert("אנא רשמו את כותרת ההודעה.");
       passForm.subject.focus();
       return false;
      }
   // End of Subject Checking

   // Beginning of Content Checking
   temp=trim(passForm.content.value);
   passForm.content.value=temp;
   if (temp=="")
      {
       alert("אנא רשמו את תוכן ההודעה.");
       passForm.content.focus();
       return false;
      }
   // End of Content Checking
  return true;
 }

/* validMsgWithTermsForm Function */
function validMsgWithTermsForm(form_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   // Beginning of Msg Title Checking
   temp=trim(passForm.msg_title.value);
   passForm.msg_title.value=temp;
   if (temp=="")
      {
       alert("אנא רשמו את כותרת ההודעה.");
       passForm.msg_title.focus();
       return false;
      }
   // End of Msg Title Checking

   // Beginning of Msg Body Checking
   temp=trim(passForm.msg_body.value);
   passForm.msg_body.value=temp;
   if (temp=="")
      {
       alert("אנא רשמו את תוכן ההודעה.");
       passForm.msg_body.focus();
       return false;
      }
   // End of Msg Body Checking

   // Beginning of Terms of Use Checking
   temp=document.getElementById('terms').checked;
   if (!temp)
      {
	alert("אנא אשרו את תנאי השימוש בפורום.");
	return false;
      }
   // End of Terms of Use Checking
  return true;
 }

w=1;
function show_reply_area()
  {
   w++;

   if (w%2!=0)
      { document.getElementById('reply_area').style.display="none"; }
   else
      { document.getElementById('reply_area').style.display=""; }
  }

z=1;
function show_reply_area_admin(sender_id, sender_name)
  {
   z++;

   if (z%2!=0)
      { document.getElementById('reply_area').style.display="none"; }
   else
      { document.getElementById('reply_area').style.display=""; }

   document.forms['reply_form'].mekabel_id.value=sender_id;
   document.forms['reply_form'].mekabel_name.value=sender_name;
  }

/* validForumReplyForm Function */
function validForumReplyForm(form_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   // Beginning of Subject Checking
   temp=trim(passForm.subject.value);
   passForm.subject.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את כותרת ההודעה.");
	passForm.subject.focus();
	return false;
      }
   // End of Subject Checking

   if (passForm.must_content.value=="1")
      {
       // Beginning of Content Checking
       temp=trim(passForm.content.value);
       passForm.content.value=temp;
       if (temp=="")
          {
	    alert("אנא רשמו את תוכן ההודעה.");
	    passForm.content.focus();
	    return false;
          }
       // End of Content Checking
      }

   return true;
  }

/* validMitlabetForm Function */
function validMitlabetForm(form_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   // Beginning of Regular Expressions Creating
   regular_hebrew=/^([^a-zA-Z0-9_]{1,})$/;
   regular_digits=/^([^a-zA-Zא-ת]{9,20})$/;
   // End of Regular Expressions Creating

   // ----------------------------------------------------------------------------------------------------

   // Beginning of First Name Checking
   temp=trim(passForm.first_name.value);
   passForm.first_name.value=temp;
   if (!(regular_hebrew.test(temp)))
      {
	alert("אנא רשמו את השם הפרטי בעברית בלבד.\nרב תודות.");
	passForm.first_name.focus();
	return false;
      }
   // End of First Name Checking

   // Beginning of Last Name Checking
   temp=trim(passForm.last_name.value);
   passForm.last_name.value=temp;
   if (!(regular_hebrew.test(temp)))
      {
	alert("אנא רשמו את שם המשפחה בעברית בלבד.\nרב תודות.");
	passForm.last_name.focus();
	return false;
      }
   // End of Last Name Checking

   // Beginning of Phone Number Checking
   temp=trim(passForm.phone_number.value);
   passForm.phone_number.value=temp;
    if (!(regular_digits.test(temp)))
	{
	 alert("מספר הטלפון חייב להכיל בין 9 ל-20 תווים ואינו יכול להכיל אותיות.");
	 passForm.phone_number.focus();
	 return false;
	}
   // End of Phone Number Checking

   // Beginning of Machonim Checking
   high_q=document.getElementById('high_q').checked;
   ezway=document.getElementById('ezway').checked;
   ankori=document.getElementById('ankori').checked;
   caspi=document.getElementById('caspi').checked;
   shmonameot=document.getElementById('shmonameot').checked;
   smart=document.getElementById('smart').checked;
   nivrevah=document.getElementById('nivrevah').checked;
   student_p=document.getElementById('student_p').checked;
   one_one=document.getElementById('one_one').checked;

   if ((!high_q) && (!ezway) && (!ankori) && (!caspi) && (!shmonameot) && (!smart) && (!nivrevah) && (!student_p) && (!one_one))
      {
	alert("אנא בחרו לפחות מכון אחד.");
	return false;
      }
   // End of Machonim Checking

   // Beginning of License Agreement Checking
   if (passForm.license_agreement.checked==false)
      {
	alert("עליך להסכים לתנאי השימוש.");
	return false;
      }
   // End of License Agreement Checking
   return true;
  }

/* validForumReplyNoRegForm Function */
function validForumReplyNoRegForm(form_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   // Beginning of Nickname Checking
   temp=trim(passForm.nickname.value);
   passForm.nickname.value=temp;
   if (temp=="")
      {
	alert("אנא בחרו כינוי לזיהוי בפורום.");
	passForm.nickname.focus();
	return false;
      }
   // End of Nickname Checking

   // Beginning of Subject Checking
   temp=trim(passForm.subject.value);
   passForm.subject.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את כותרת ההודעה.");
	passForm.subject.focus();
	return false;
      }
   // End of Subject Checking

   // Beginning of Captcha Checking
   temp=trim(passForm.captcha_code.value);
   passForm.captcha_code.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את רצף התווים המופיע בתמונה.");
	passForm.captcha_code.focus();
	return false;
      }
   // End of Captcha Checking

   // Beginning of License Agreement Checking
   if (passForm.license_agreement.checked==false)
      {
	alert("עליך להסכים לתנאי השימוש בפורום.");
	return false;
      }
   // End of License Agreement Checking

   return true;
  }
  
/* clear_search_field Function */
function clear_search_field(sel_option, sel_id, sel_text)
 {
  temp="obj=document.getElementById('"+sel_id+"');";
  eval(temp);
  if (sel_option=="1")
     {
      if (obj.value=="")
         { obj.value=sel_text; }
     }
     
  if (sel_option=="0")
     {
      if (obj.value==sel_text)
         { obj.value=""; }
     }
 }
 
/* clear_form_field Function */
function clear_form_field(form_id, field_id, sel_option, field_value)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);
 
  temp="obj=passForm."+field_id+";";
  eval(temp);
  
  if (sel_option=="1")
     {
      if (obj.value=="")
         { obj.value=field_value }
     }
     
  if (sel_option=="0")
     {
      if (obj.value==field_value)
         { obj.value=""; }
     }
 }
 
/* goto_forum Function */
function goto_forum(chosen_top_id, chosen_msg_id)
 {
  temp="redirect='http://www.psychometry.co.il/psychometry/forum.php?chosen_top_id="+chosen_top_id+"&chosen_msg_id="+chosen_msg_id+"#msg"+chosen_msg_id+"';";
  eval(temp);
  window.location=redirect;
 }
 
/* delete_msg Function */
function delete_msg(id)
 {
  var r=confirm("האם אתה בטוח שברצונך למחוק הודעה זו?");
  if (r==true)
     {
      temp="redirect='http://www.psychometry.co.il/psychometry/messages/delete_msg.php?id="+id+"';";
      eval(temp);
      window.location=redirect;
     }
  else
     { return false; }
 }
 
/* validBuyForm Function */
function validBuyForm(form_id)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);

  // Beginning of Regular Expressions Creating
  regular_username=/^([0-9a-zA-Z_\-]{6,10})$/;
  regular_phones=/^([0-9]{7,})$/;
  regular_email_address=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  regular_english=/^([a-zA-Z0-9]{2,})$/;
  regular_id_number=/^([0-9]{9})$/;
  regular_credit_card_number=/^([0-9]{8,16})$/;
  regular_credit_card_cvv=/^([0-9]{3})$/;
  // End of Regular Expressions Creating
  
  // Beginning of Product Selection Checking
  o1=passForm.product_selection_1.checked;
  o2=passForm.product_selection_2.checked;
  o3=passForm.product_selection_3.checked;
  o4=passForm.product_selection_4.checked;
  o5=passForm.product_selection_5.checked;
  o6=passForm.product_selection_6.checked;
  if ((!o1) && (!o2) && (!o3) && (!o4) && (!o5) && (!o6))
     {
      alert("אנא בחרו בסוג החבילה.");
      return false;
     }
  // End of Product Selection Checking

      // Beginning of English First Name Checking
      temp=trim(passForm.en_fn.value);
      passForm.en_fn.value=temp;
      if (temp=="")
	  {
	   alert("אנא רשמו את שמכם הפרטי באנגלית בלבד.");
	   passForm.en_fn.focus();
	   return false;
	  }
      // End of English First Name Checking

      // Beginning of Credit Card Type Checking
      temp=trim(passForm.credit_card_type.value);
      passForm.credit_card_type.value=temp;
      if (temp=="")
	  {
	   alert("אנא בחרו בסוג כרטיס האשראי שלכם.");
	   passForm.credit_card_type.focus();
	   return false;
	  }
      // End of Credit Card Type Checking

      // Beginning of English Last Name Checking
      temp=trim(passForm.en_ln.value);
      passForm.en_ln.value=temp;
      if (temp=="")
	  {
	   alert("אנא רשמו את שם המשפחה שלכם באנגלית בלבד.");
	   passForm.en_ln.focus();
	   return false;
	  }
      // End of English Last Name Checking
      
      // Beginning of Credit Card Number Checking
      temp=trim(passForm.credit_card_number.value);
      passForm.credit_card_number.value=temp;
      if (!(regular_credit_card_number.test(temp)))
	  {
	   alert("אנא רשמו את מספר כרטיס האשראי שלכם ב-16 ספרות בלבד, ללא מרווחים וסימנים אחרים.");
	   passForm.credit_card_number.focus();
	   return false;
	  }
      // End of Credit Card Number Checking
  
      // Beginning of ID Number Checking
      temp=trim(passForm.id_number.value);
      passForm.id_number.value=temp;
      if (!(regular_id_number.test(temp)))
	  {
	   alert("אנא רשמו את מספר תעודת הזהות שלכם ב-9 ספרות בלבד.");
	   passForm.id_number.focus();
	   return false;
	  }
      // End of ID Number Checking
      
      // Beginning of Credit Card Expires Month Checking
      temp=trim(passForm.credit_card_expires_month.value);
      passForm.credit_card_expires_month.value=temp;
      if (temp=="")
	  {
	   alert("אנא בחרו בחודש עבור תוקף כרטיס האשראי שלכם.");
	   passForm.credit_card_expires_month.focus();
	   return false;
	  }
      // End of Credit Card Expires Month Checking

      // Beginning of Credit Card Expires Year Checking
      temp=trim(passForm.credit_card_expires_year.value);
      passForm.credit_card_expires_year.value=temp;
      if (temp=="")
	  {
	   alert("אנא בחרו בשנה עבור תוקף כרטיס האשראי שלכם.");
	   passForm.credit_card_expires_year.focus();
	   return false;
	  }
      // End of Credit Card Expires Year Checking
      
  // Beginning of Phone Number Checking
  temp=trim(passForm.hphone.value);
  passForm.hphone.value=temp;
  if (!(regular_phones.test(temp)))
     {
      alert("אנא רשמו את מספר הטלפון שלכם בספרות בלבד.");
      passForm.hphone.focus();
      return false;
     }
  // End of Phone Number Checking

      // Beginning of Credit Card CVV Checking
      temp=trim(passForm.credit_card_cvv.value);
      passForm.credit_card_cvv.value=temp;
      if (!(regular_credit_card_cvv.test(temp)))
	  {
	   alert("אנא רשמו את 3 הספרות בגב הכרטיס בספרות בלבד.");
	   passForm.credit_card_cvv.focus();
	   return false;
	  }
      // End of Credit Card CVV Checking
      
   // Beginning of Terms of Use Checking
   temp=document.getElementById('terms').checked;
   if (!temp)
      {
	alert("אנא אשרו את תנאי השימוש.");
	return false;
      }
   // End of Terms of Use Checking
  return true;
 }
