function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }  
return xmlHttp;
}

/* Trim Function */
function trim(value)
 {
  var temp = value;
  return temp.replace(/^\s*(\b.*\b|)\s*$/, "$1");
 }

/* validContactForm Function */
function validContactForm(form_id, div_id)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);

  // Beginning of Regular Expressions Creating
  regular_digits=/^([0-9]{1})$/;
  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.charAt(0)!="0")
	{
	 alert("הספרה הראשונה של מספר הטלפון מוכרחה להיות 0.");
	 passForm.phone_number.focus();
	 return false;
	}

   count_digits=0;
   for (i=0; i<=temp.length; i++)
	 {
	  if (regular_digits.test(temp.charAt(i)))
	     { count_digits++; }
	 }

   if (count_digits<9)
	{
	 alert("אנא רשמו את מספר הטלפון שלכם כולל קידומת ב-9 ספרות לפחות.");
	 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 Message Content Checking
  temp=trim(passForm.message_content.value);
  passForm.message_content.value=temp;
  // End of Message Content Checking

  return true;
 }
  
/* clear_field Function */
function clear_field(sel_id, sel_option, sel_text)
 {
  eval("obj=document.getElementById('"+sel_id+"');");
  if ((sel_option=="1") && (obj.value==""))
     { obj.value=sel_text; }
     
  if ((sel_option=="0") && (obj.value==sel_text))
     { obj.value=""; }
 }
 
/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

/* validNewsletterForm Function */
function validNewsletterForm(form_id, div_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 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
  
  newsletter_procedure(form_id, div_id);
  return false;
 }
 
function newsletter_procedure(form_id, div_id)
  {
   tmp="passForm=document.forms['"+form_id+"'];";
   eval(tmp);

   email_address=passForm.email_address.value;
   
   xmlHttp=GetXmlHttpObject();
   if (xmlHttp==null)
      {
       alert("Your browser does not support AJAX!");
       return;
      }
  
   var url="newsletter_procedure.php";
   var params="email_address="+email_address;
  
   xmlHttp.open("POST", url, true);
   //Send the proper header information along with the request
   xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   xmlHttp.setRequestHeader("Content-length", params.length);
   xmlHttp.setRequestHeader("Connection", "close");
   xmlHttp.onreadystatechange=function()
    {
     if (xmlHttp.readyState==4)
       {
	 str ="document.getElementById('"+div_id+"').innerHTML='"+xmlHttp.responseText+"';";
	 eval(str);
       }
    } 
   xmlHttp.send(params);
  }
  
/* validSendFriendForm Function */
function validSendFriendForm(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 Friend 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 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 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 E-mail Address Checking
  return true;
 }
 
/* validTrumaForm Function */
function validTrumaForm(form_id)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);

  // Beginning of Regular Expressions Creating
  regular_digits=/^([0-9]{1})$/;
  regular_credit_card_cvv=/^([0-9]{3,4})$/;
  regular_credit_card_number=/^([0-9]{8,16})$/;
  regular_id_number=/^([0-9]{9})$/;
  regular_credit_card_cvv=/^([0-9]{3})$/;
  regular_credit_card_number=/^([0-9]{8,16})$/;
  regular_email_address=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  // End of Regular Expressions Creating
  
  // Beginning of CC 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 CC Type Checking
  
  // Beginning of CC Number Checking
  temp=trim(passForm.credit_card_number.value);
  passForm.credit_card_number.value=temp;
  if (!(regular_credit_card_number.test(temp)))
     {
      alert("אנא רשמו מספר כרטיס אשראי בספרות בלבד.");
      passForm.credit_card_number.focus();
      return false;
     }
  // End of CC Number Checking

  // Beginning of CC 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 CC Expires Month Checking
  
  // Beginning of CC 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 CC Expires Year Checking
  
  // Beginning of CVV Checking
  temp=trim(passForm.credit_card_cvv.value);
  passForm.credit_card_cvv.value=temp;
  if (!(regular_credit_card_cvv.test(temp)))
     {
      alert("אנא רשמו 3 ספרות 3-4 גב הכרטיס.");
      passForm.credit_card_cvv.focus();
      return false;
     }
  // End of CVV 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 First Name Checking
  temp=trim(passForm.first_name.value);
  passForm.first_name.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו שם פרטי.");
      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 (temp=="")
     {
      alert("אנא רשמו שם משפחה.");
      passForm.last_name.focus();
      return false;
     }
  // End of Last Name Checking
  
  // Beginning of Street Address Checking
  temp=trim(passForm.street_address.value);
  passForm.street_address.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו כתובת.");
      passForm.street_address.focus();
      return false;
     }
  // End of Street Address Checking
  
  // Beginning of City Checking
  temp=trim(passForm.city.value);
  passForm.city.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו עיר.");
      passForm.city.focus();
      return false;
     }
  // End of City Checking
  
  // Beginning of Zip Code Checking
  temp=trim(passForm.zip_code.value);
  passForm.zip_code.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו מיקוד.");
      passForm.zip_code.focus();
      return false;
     }
  // End of Zip Code Checking
  
   // Beginning of Phone Number Checking
   temp=trim(passForm.phone_number.value);
   passForm.phone_number.value=temp;

   if (temp.charAt(0)!="0")
	{
	 alert("הספרה הראשונה של מספר הטלפון מוכרחה להיות 0.");
	 passForm.phone_number.focus();
	 return false;
	}

   count_digits=0;
   for (i=0; i<=temp.length; i++)
	 {
	  if (regular_digits.test(temp.charAt(i)))
	     { count_digits++; }
	 }

   if (count_digits<9)
	{
	 alert("אנא רשמו את מספר הטלפון שלכם כולל קידומת ב-9 ספרות לפחות.");
	 passForm.phone_number.focus();
	 return false;
	}
   // End of Phone Number Checking
   
   // Beginning of Cell Phone Checking
   temp=trim(passForm.cell_phone.value);
   passForm.cell_phone.value=temp;

   if (temp.charAt(0)!="0")
	{
	 alert("הספרה הראשונה של מספר הטלפון מוכרחה להיות 0.");
	 passForm.cell_phone.focus();
	 return false;
	}

   count_digits=0;
   for (i=0; i<=temp.length; i++)
	 {
	  if (regular_digits.test(temp.charAt(i)))
	     { count_digits++; }
	 }

   if (count_digits<9)
	{
	 alert("אנא רשמו את מספר הטלפון שלכם כולל קידומת ב-9 ספרות לפחות.");
	 passForm.cell_phone.focus();
	 return false;
	}
   // End of Cell Phone 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
  
  return true;
 }
 
 function show_dd(d_name, d_status)
   {
    if (d_status=="on")
       {
	 temp="document.getElementById('"+d_name+"').style.display='';";
	 eval(temp);
	}
	
    if (d_status=="off")
       {
	 temp="document.getElementById('"+d_name+"').style.display='none';";
	 eval(temp);
	}
   }
   
/* validBuyForm Function */
function validBuyForm(form_id)
 {
  tmp="passForm=document.forms['"+form_id+"'];";
  eval(tmp);

  // Beginning of Regular Expressions Creating
  regular_digits=/^([0-9]{1})$/;
  regular_id_number=/^([0-9]{9})$/;
  regular_credit_card_cvv=/^([0-9]{3,4})$/;
  regular_credit_card_number=/^([0-9]{8,16})$/;
  regular_email_address=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  // End of Regular Expressions Creating
  
  // 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 First Name Checking
  temp=trim(passForm.first_name.value);
  passForm.first_name.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו שם פרטי.");
      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 (temp=="")
     {
      alert("אנא רשמו שם משפחה.");
      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 (temp.charAt(0)!="0")
	{
	 alert("הספרה הראשונה של מספר הטלפון מוכרחה להיות 0.");
	 passForm.phone_number.focus();
	 return false;
	}

   count_digits=0;
   for (i=0; i<=temp.length; i++)
	 {
	  if (regular_digits.test(temp.charAt(i)))
	     { count_digits++; }
	 }

   if (count_digits<9)
	{
	 alert("אנא רשמו את מספר הטלפון שלכם כולל קידומת ב-9 ספרות לפחות.");
	 passForm.phone_number.focus();
	 return false;
	}
   // End of Phone Number Checking
  
  // Beginning of English First Name Checking
  temp=trim(passForm.english_first_name.value);
  passForm.english_first_name.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו שם פרטי באנגלית.");
      passForm.english_first_name.focus();
      return false;
     }
  // End of English First Name Checking
  
  // Beginning of English Last Name Checking
  temp=trim(passForm.english_last_name.value);
  passForm.english_last_name.value=temp;
  if (temp=="")
     {
      alert("אנא רשמו שם משפחה באנגלית.");
      passForm.english_last_name.focus();
      return false;
     }
  // End of English Last Name 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 CC 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 CC Type Checking
  
  // Beginning of CC Number Checking
  temp=trim(passForm.credit_card_number.value);
  passForm.credit_card_number.value=temp;
  if (!(regular_credit_card_number.test(temp)))
     {
      alert("אנא רשמו מספר כרטיס אשראי בספרות בלבד.");
      passForm.credit_card_number.focus();
      return false;
     }
  // End of CC Number Checking

  // Beginning of CC 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 CC Expires Month Checking
  
  // Beginning of CC 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 CC Expires Year Checking
  
  // Beginning of CVV Checking
  temp=trim(passForm.credit_card_cvv.value);
  passForm.credit_card_cvv.value=temp;
  if (!(regular_credit_card_cvv.test(temp)))
     {
      alert("אנא רשמו 3 ספרות 3-4 גב הכרטיס.");
      passForm.credit_card_cvv.focus();
      return false;
     }
  // End of CVV Checking
  
  return true;
 }
