function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

/* Trim Function */
function trim(value)
 {
  var temp = value;
  return temp.replace(/^\s*(\b.*\b|)\s*$/, "$1");
 }

/* Input Emphasis Function */
function input_emphasis(cell)
 {
  var emphasis="document.all."+cell+".style.backgroundColor='#ffffff'";
  eval(emphasis);
  return true;
 }

/* Cell Emphasis Function */
function cell_emphasis(question, field, number_of_fields)
  {
   for (i=0; i<number_of_fields; i++)
	{
	 if (field==i)
	  {
	   var emphasis="document.all."+question+"_"+i+".style.backgroundColor='#ff0000'";
	   eval(emphasis);
	  }
	 else
	  {
	   var emphasis="document.all."+question+"_"+i+".style.backgroundColor='#ffffcc'";
	   eval(emphasis);
	  }
	}
  }

/* Checkbox Emphasis Function */
function checkbox_emphasis(cell)
 {
  cell_="document.all."+cell+".checked";
  if (eval(cell_ ))
     {
      var emphasis="document.all."+cell+".style.backgroundColor='#ff0000'";
      eval(emphasis);
     }
  else
    {
     var emphasis="document.all."+cell+".style.backgroundColor='#ffffcc'";
     eval(emphasis);
    }
 }

/* validEntranceForm Function */
function validEntranceForm(passForm)
  {
   // Beginning of Regular Expressions Creating
   regular_english=/^([a-zA-Z0-9]{2,})$/;
   // End of Regular Expressions Creating


   // Beginning of Username Checking
   temp=trim(passForm.username.value);
   passForm.username.value=temp;
   if (!(regular_english.test(temp)))
      {
	alert("אנא רשמו את שם המשתמש באותיות באנגלית ובספרות בלבד.\nרב תודות.");
	passForm.username.focus();
	return false;
      }
   // End of Username Checking

   // Beginning of Password Checking
   temp=trim(passForm.password.value);
   passForm.password.value=temp;
   if (!(regular_english.test(temp)))
      {
	alert("אנא רשמו את הסיסמה באותיות באנגלית ובספרות בלבד.\nרב תודות.");
	passForm.password.focus();
	return false;
      }
   // End of Password Checking
   return true;
  }

/* validUsersForm Function */
function validUsersForm(passForm)
  {
   // Beginning of Regular Expressions Creating
   regular_english=/^([a-zA-Z0-9_]{1,})$/;
   regular_hebrew=/^([^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 Username Checking
   temp=trim(passForm.username.value);
   passForm.username.value=temp;
   if (!(regular_english.test(temp)))
      {
	alert("אנא רשמו את שם המשתמש באותיות באנגלית ובספרות בלבד.\nרב תודות.");
	passForm.username.focus();
	return false;
      }
   // End of Username Checking

   // Beginning of Password Checking
   temp=trim(passForm.password.value);
   passForm.password.value=temp;
   if (!(regular_english.test(temp)))
      {
	alert("אנא רשמו את הסיסמה באותיות באנגלית ובספרות בלבד.\nרב תודות.");
	passForm.password.focus();
	return false;
      }
   // End of Password Checking

   // Beginning of Full Name Checking
   temp=trim(passForm.full_name.value);
   passForm.full_name.value=temp;
   if (!(regular_hebrew.test(temp)))
      {
	alert("אנא רשמו את השם המלא בעברית בלבד.\nרב תודות.");
	passForm.full_name.focus();
	return false;
      }
   // End of Full Name Checking

   // Beginning of E-mail Address Checking
   temp=trim(passForm.email_address.value);
   passForm.email_address.value=temp;
   if (temp!="")
      {
	if (!(regular_email_address.test(temp)))
	   {
	    alert("אנא רשמו את כתובת הדואר האלקטרוני האדמיניסטרטיבית בתבנית נאותה.\nרב תודות.");
	    passForm.email_address.focus();
	    return false;
          }
      }
   // End of E-mail Address Checking

   // Beginning of Phone Number Checking
   temp=trim(passForm.phone_number.value);
   passForm.phone_number.value=temp;
   if (!(regular_phones.test(temp)))
      {
	alert("אנא רשמו את מספר הטלפון בספרות בלבד.\nרב תודות.");
	passForm.phone_number.focus();
	return false;
      }
   // End of Phone Number Checking

   // Beginning of User Status Checking
   o1=passForm.user_status_0.checked;
   o2=passForm.user_status_1.checked;
   if ((!(o1)) && (!(o2)))
      {
	alert("אנא בחרו במצב המשתמש.\nרב תודות.");
	return false;
      }
   // End of User Status Checking
   return true;
  }

/* validCategoriesForm Function */
function validCategoriesForm(passForm)
  {
   // Beginning of Regular Expressions Creating
   regular_hebrew=/^([^a-zA-Z0-9_]{1,})$/;
   // End of Regular Expressions Creating

   // Beginning of Category Name Checking
   temp=trim(passForm.category_name.value);
   passForm.category_name.value=temp;
   if (!(regular_hebrew.test(temp)))
      {
	alert("אנא רשמו את שם הקטגוריה באותיות בעברית בלבד.\nרב תודות.");
	passForm.category_name.focus();
	return false;
      }
   // End of Category Name Checking

   // Beginning of Category Folder Checking
   temp=trim(passForm.category_folder.value);
   passForm.category_folder.value=temp;
   if (temp=="")
      {
	alert("אנא בחרו בשם עבור תיקיית הקטגוריה.\nרב תודות.");
	passForm.category_folder.focus();
	return false;
      }
   // End of Category Folder Checking
   return true;
  }

/* validPagesForm Function */
function validPagesForm(passForm)
  {
   // Beginning of Regular Expressions Creating
   regular_english=/^([a-zA-Z0-9_]{1,})$/;
   regular_hebrew=/^([^a-zA-Z0-9_]{1,})$/;
   // End of Regular Expressions Creating

   // Beginning of Page Name Checking
   temp=trim(passForm.page_name.value);
   passForm.page_name.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את שם העמוד.\nרב תודות.");
	passForm.page_name.focus();
	return false;
      }
   // End of Page Name Checking

   // Beginning of Page Title Checking
   temp=trim(passForm.page_title.value);
   passForm.page_title.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את כותרת העמוד.\nרב תודות.");
	passForm.page_title.focus();
	return false;
      }
   // End of Page Title Checking

   // Beginning of Page Description Checking
   temp=trim(passForm.page_description.value);
   passForm.page_description.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את תיאור העמוד.\nרב תודות.");
	passForm.page_description.focus();
	return false;
      }
   // End of Page Description Checking

   // Beginning of Page Keywords Checking
   temp=trim(passForm.page_keywords.value);
   passForm.page_keywords.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את מילות המפתח של העמוד.\nרב תודות.");
	passForm.page_keywords.focus();
	return false;
      }
   // End of Page Keywords Checking

   // Beginning of Page Header 1 Checking
   temp=trim(passForm.page_header_1.value);
   passForm.page_header_1.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את הכותרת הראשית של העמוד.\nרב תודות.");
	passForm.page_header_1.focus();
	return false;
      }
   // End of Page Header 1 Checking

   // Beginning of Page Header 2 Checking
   temp=trim(passForm.page_header_2.value);
   passForm.page_header_2.value=temp;
   // End of Page Header 2 Checking
   return true;
  }

/* validNavigationForm Function */
function validNavigationForm(passForm)
  {
   // Beginning of Regular Expressions Creating
   regular_english=/^([a-zA-Z0-9_]{1,})$/;
   // End of Regular Expressions Creating

   // Beginning of Regular Expressions Creating
   regular_hebrew=/^([^a-zA-Z0-9_]{1,})$/;
   // End of Regular Expressions Creating

   // Beginning of Page Name Checking
   temp=trim(passForm.page_name.value);
   passForm.page_name.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את שם הפריט.\nרב תודות.");
	passForm.page_name.focus();
	return false;
      }
   // End of Page Name Checking

   // Beginning of Page URL Checking
   temp=trim(passForm.page_url.value);
   passForm.page_url.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את URL הפריט.\nרב תודות.");
	passForm.page_url.focus();
	return false;
      }
   // End of Page URL Checking
   return true;
  }

/* 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 (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 (temp=="")
     {
      alert("אנא מלאו כתובת דואר אלקטרוני תקינה.");
      passForm.email_address.focus();
      return false;
     }
  // End of E-mail Address Checking

  // Beginning of Message Content Checking
  temp=trim(passForm.message_content.value);
  passForm.message_content.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו את תוכן המסר.");
      passForm.message_content.focus();
      return false;
     }
  // End of Message Content 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

  return true;
 }
 
 /* validMazalotForm Function */
function validMazalotForm(passForm)
  {
   // Beginning of Mazal Name Checking
   temp=trim(passForm.mazal_name.value);
   passForm.mazal_name.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו את שם המזל.");
	passForm.mazal_name.focus();
	return false;
      }
   // End of Mazal Name Checking

   // Beginning of Start Date Checking
   temp=trim(passForm.start_date.value);
   passForm.start_date.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו תאריך התחלה.");
	passForm.start_date.focus();
	return false;
      }
   // End of Start Date Checking
   
   // Beginning of End Date Checking
   temp=trim(passForm.end_date.value);
   passForm.end_date.value=temp;
   if (temp=="")
      {
	alert("אנא רשמו תאריך סיום.");
	passForm.end_date.focus();
	return false;
      }
   // End of End Date Checking
   return true;
  }
  
 /* validApplicationsForm Function */
function validApplicationsForm(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;
     }
     
  exp ="Set_Cookie('horoscop_form[full_name]', '"+temp+"', 30, '/');";
  eval(exp);
  // End of Full Name Checking

  /*
  temp=trim(passForm.phone_number.value);
  passForm.phone_number.value=temp;
  if (temp=="")
     {
      alert("אנא מלאו את מספר הטלפון שלכם בספרות, קווים מפרידים וסימני + בלבד.");
      passForm.phone_number.focus();
      return false;
     }
     
  exp ="Set_Cookie('horoscop_form[phone_number]', '"+temp+"', 30, '/');";
  eval(exp);
  */

  // Beginning of E-mail Address Checking
  temp=trim(passForm.email_address.value);
  passForm.email_address.value=temp;
  if (temp=="")
     {
      if (!(regular_email_address.test(temp)))
	  {
	   alert("אנא מלאו כתובת דואר אלקטרוני תקינה.");
	   passForm.email_address.focus();
	   return false;
	  }
	  
      exp ="Set_Cookie('horoscop_form[email_address]', '"+temp+"', 30, '/');";
      eval(exp);
     }
  // End of E-mail Address Checking

   // Beginning of birthday_name Checking
  temp=trim(passForm.birthday_name.value);
  passForm.birthday_name.value=temp;
  if (temp=="")
     {
      alert("אנא הכניסו את שם בעל השמחה.");
      passForm.birthday_name.focus();
      return false;
     }
     
  exp ="Set_Cookie('horoscop_form[birthday_name]', '"+temp+"', 30, '/');";
  eval(exp);
  // End of Full Name Checking

  // Beginning of Age Checking
  temp=trim(passForm.age.value);
  passForm.age.value=temp;
  
  exp ="Set_Cookie('horoscop_form[age]', '"+temp+"', 30, '/');";
  eval(exp);
  // End of Age Checking
  
  // Beginning of Home Address Checking
  temp=trim(passForm.home_address.value);
  passForm.home_address.value=temp;
  
  exp ="Set_Cookie('horoscop_form[home_address]', '"+temp+"', 30, '/');";
  eval(exp);
  // End of Home Address Checking

  // Beginning of Notes Checking
  temp=trim(passForm.notes.value);
  passForm.notes.value=temp;
  // End of Notes Checking
  
  // Beginning of License Agreement Checking
  if (passForm.license_agreement.checked==false)
     {
      alert("עליך להסכים לתנאי השימוש.");
      return false;
     }
  // End of License Agreement Checking
  return true;
 }
 
  /* check_poll_answer Function */
function check_poll_answer(poller_id)
 {
  f1=document.getElementById('option1').value;
  f2=document.getElementById('option2').value;
  f3=document.getElementById('option3').value;
  f4=document.getElementById('option4').value;
  
  temp="o1=document.getElementById('pollerOption"+f1+"').checked";
  eval(temp);
  
  temp="o2=document.getElementById('pollerOption"+f2+"').checked";
  eval(temp);
  
  temp="o3=document.getElementById('pollerOption"+f3+"').checked";
  eval(temp);
  
  temp="o4=document.getElementById('pollerOption"+f4+"').checked";
  eval(temp);
  
  if ((!o1) && (!o2) && (!o3) && (!o4))
     {
      alert("אנא סמן את תשובתך");
      return false;
     }
  else
     { castMyVote(poller_id ,document.forms[0]); }
 }
