function sf(show)
{ if(show=='f')
	{show = 'contactInfo';
	 hide = 'process'; }
  else { show = 'process'; hide = 'contactInfo'; }	
window.document.getElementById(show).style.display = 'block';
window.document.getElementById(hide).style.display = 'none';
}
function handleErrFullPage(strIn) {
        var errorWin;
        // Create new window and display error
        try {   errorWin = window.open('', 'errorWin');
                errorWin.document.body.innerHTML = strIn;        }
        // If pop-up gets blocked, inform user
        catch(e) {alert('An error occurred, but the error message cannot be' +
                        ' displayed because of your browser\'s pop-up blocker.\n' +
                        'Please allow pop-ups from this Web site.');  }
}

function handleHttpResponse() {
  if (http.readyState == 4) {
strResponse = http.responseText;
switch (http.status) {
                   case 200:    results = http.responseText;
                                document.getElementById(target_div).innerHTML = results;
								break;
                   // Page-not-found error
                   case 404:
                           alert('Error: Not Found. The requested URL could not be found.');
                           break;
                   // Display results in a full window for server-side errors
                   case 500:
                           handleErrFullPage(strResponse);
                           break;
                   default:
                           // Call JS alert for custom error or debug messages
                           if (strResponse.indexOf('Error:') > -1 ||
                                   strResponse.indexOf('Debug:') > -1) {
                                   alert(strResponse);                 }
                           break;
                              }
  }
// else we're not ready
else { document.getElementById(target_div).innerHTML = 'sending enquiry....';
     }
}

function prml() {
  email = window.document.contact.email.value;
  email2= window.document.contact.email2.value;
  enquiry=window.document.contact.enquiry.value;
  form_errors = '';
  if(email==null||email==''||email2==null||email2==''||email!=email2)
  { form_errors = "Please enter/check email address in both boxes.\n";
  }
  if(enquiry==null||enquiry=='')
  {
	form_errors += "Please enter an enquiry.";  
  }
  if(form_errors!='')
   {  	alert(form_errors);
   		}
  else {
  sf('p');
  target_div = 'process';
  http.open("GET", "process_form.php?email=" + escape(email) + "&enquiry=" + escape(enquiry), true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null);
  }
}

function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object
