   var http_request = false;
   var show_success = true;
   var submit_button;
   function makePOSTRequest(url, parameters, success) {
      show_success = success;
      http_request = false;
      if ( submit_button ) {
        submit_button.disabled = true;
      }
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if ( submit_button ) {
           submit_button.disabled = false;
         }
         if (http_request.status == 200) {
            //alert(http_request.responseText);
	    if ( show_success ) {
	      Growl.Bezel( {title:'Thank You', image:'/images/growl/success.png', text:http_request.responseText, duration:4} );
	    }
	    else {
	    }
         } else {
            //alert('There was a problem with the request.');
	    Growl.Bezel( {title:'Error', image:'/images/growl/error.png', text:http_request.responseText, duration:4} );
         }
      }
   }
   
   function email(obj) {
      submit_button = obj.submit;
      var poststr = "from=" + encodeURI( document.getElementById("from").value ) +
                    "&email=" + encodeURI( document.getElementById("email").value ) +
                    "&subject=" + encodeURI( document.getElementById("subject").value ) +
                    "&message=" + encodeURI( document.getElementById("message").value );
      makePOSTRequest('/cgi-bin/contact.cgi', poststr, true);
   }

   function download_product(product) {
      var poststr = "shortname=" + encodeURI( product ) +
		    "&download=true" +
		    "&os=" + encodeURI( document.getElementById("os").value ) +
                    "&email=" + encodeURI( document.getElementById("email").value ) +
                    "&ip=" + encodeURI( document.getElementById("ip").value ) +
                    "&majordomo=" + encodeURI( document.getElementById("majordomo").checked ) +
                    "&gen_license=" + encodeURI( document.getElementById("gen_license").checked );
      makePOSTRequest('/store/download_product.jsp', poststr, false);
   }

   function report404() {
      Growl.Bezel( {title:'Error: 404', image:'/images/growl/error.png', text:'The requested page could <b>not</b> be found.', duration:7} );
   }

  function purchase_verify(obj) {
    var tot = parseInt(obj.quantity0.value);
    if ( obj.quantity1 )
      tot += parseInt(obj.quantity1.value);
    if ( obj.quantity2 )
      tot += parseInt(obj.quantity2.value);
    if ( obj.quantity3 )
      tot += parseInt(obj.quantity3.value);
    if ( obj.quantity4 )
      tot += parseInt(obj.quantity4.value); 

    if ( isNaN(tot) || tot <= 0 ) {
      Growl.Bezel( {title:'Error', image:'/images/growl/error.png', text:'An invalid quantity was entered.', duration:3} );
      return false;
    }
    else {
      return true;
    }
  }

