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");
 }

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" : "" );
}

/* validContactForm Function */
function validContactForm(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})$/;
   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('michlalot_form[full_name]', '"+escape(temp)+"', 30, '/');";
   eval(exp);
   // End of Full 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;
	}

   exp ="Set_Cookie('michlalot_form[phone_number]', '"+escape(temp)+"', 30, '/');";
   eval(exp);
   // End of Phone Number Checking

   // Beginning of Bulletin Address Checking
   if (passForm.v_bulletin_address.value!="")
	{
	 temp=trim(passForm.bulletin_address.value);
	 passForm.bulletin_address.value=temp;
	 if (passForm.v_must_bulletin_address.value!="")
	    {
	     if (temp=="")
		 {
		  alert("אנא רשמו כתובת למשלוח ידיעון.");
		  passForm.bulletin_address.focus();
		  return false;
		 }
          }

       exp ="Set_Cookie('michlalot_form[bulletin_address]', '"+escape(temp)+"', 30, '/');";
       eval(exp);
      }
   // End of Bulletin Address Checking

   // Beginning of Living Area Checking
   if (passForm.v_living_area.value!="")
	{
	 temp=trim(passForm.living_area.value);
	 passForm.living_area.value=temp;
	 if (passForm.v_must_living_area.value!="")
	    {
	     if (temp=="")
		 {
		  alert("אנא רשמו את יישוב המגורים שלכם.");
		  passForm.living_area.focus();
		  return false;
		 }
          }

       exp ="Set_Cookie('michlalot_form[living_area]', '"+escape(temp)+"', 30, '/');";
       eval(exp);
      }
   // End of Living Area Checking
   
   // Beginning of Field1 Checking
   if ((passForm.field1_must.value!="") && (passForm.field1_must.value!="0"))
	{
	 temp=trim(passForm.field1.value);
	 passForm.field1.value=temp;
        if (temp=="")
	   {
	    alert("אנא בחרו באפשרות המבוקשת.");
	    passForm.field1.focus();
	    return false;
          }
      }
   // End of Field1 Checking
   
   // Beginning of Field2 Checking
   if ((passForm.field2_must.value!="") && (passForm.field2_must.value!="0"))
	{
	 temp=trim(passForm.field2.value);
	 passForm.field2.value=temp;
        if (temp=="")
	   {
	    alert("אנא בחרו באפשרות המבוקשת.");
	    passForm.field2.focus();
	    return false;
          }
      }
   // End of Field2 Checking

   // Beginning of E-mail Address Checking
   if (passForm.v_email_address.value!="")
	{
	 temp=trim(passForm.email_address.value);
	 passForm.email_address.value=temp;
	 if (passForm.v_must_email_address.value!="")
	    {
	     if (!(regular_email_address.test(temp)))
		 {
		  alert("אנא רשמו את כתובת הדואר האלקטרוני שלכם בתבנית חוקית.");
		  passForm.email_address.focus();
		  return false;
		 }
          }

       exp ="Set_Cookie('michlalot_form[email_address]', '"+escape(temp)+"', 30, '/');";
       eval(exp);
      }
   // End of E-mail Address Checking

   // Beginning of License Agreement Checking
   if (passForm.license_agreement.checked==false)
      {
	alert("עליך להסכים לתנאי השימוש.");
	return false;
      }
   // End of License Agreement Checking

   // Beginning of Message Content Checking
   if (passForm.v_remarks.value!="")
	{
	 temp=trim(passForm.msg_content.value);
	 passForm.msg_content.value=temp;
	 if (passForm.v_must_remarks.value!="")
	    {
	     if (temp=="")
		 {
		  alert("אנא רשמו מלל חופשי.");
		  passForm.msg_content.focus();
		  return false;
		 }
          }
      }
   // End of Message Content Checking

   // Beginning of Course of Studies Checking
   if (passForm.v_cos.value!="")
	{
	 temp=trim(passForm.cos.value);
	 passForm.cos.value=temp;
	 if (passForm.v_must_cos.value!="")
	    {
	     if (temp=="")
		 {
		  alert("אנא מלאו את שדה מסלול הלימודים.");
		  passForm.cos.focus();
		  return false;
		 }
          }
      }
   // End of Course of Studies Checking

   // Beginning of Departments Checking
   if (passForm.internal_page.value=="1")
	{
	 temp=trim(passForm.deps.value);
	 passForm.deps.value=temp;
	 if (passForm.v_must_deps.value!="")
	    {
	     if (temp=="")
		 {
		  alert("אנא מלאו את שדה החוג.");
		  passForm.deps.focus();
		  return false;
		 }
          }
      }
   // End of Departments Checking
   return true;
  }
  
function display_banner(div_id, object_id, div_width, div_height, banner_name, banner_bg)
{
		x ="<object style='z-index:1;' width='"+div_width+"' height='"+div_height+"' id='"+object_id+"'>";
		x+="<param name='movie' value='"+banner_name+"' />";
		x+="<param name='quality' value='high' />";
		//x+"<PARAM NAME='wmode' VALUE='transparent' />";
		x+="<param name='bgcolor' value='" + banner_bg+"' />";
		x+="<embed src='"+banner_name+"' quality='high' bgcolor='"+banner_bg+"' width='"+div_width+"' height='"+div_height+"' type='application/x-shockwave-flash'></embed>";
		x+="</object>";
		
		eval("document.getElementById('"+div_id+"').innerHTML=\""+x+"\";");
}