var relativePath = '';

function getContactUsForm(path) {
    relativePath = path;
    if (document.getElementById('contactUs').innerHTML) {
      document.getElementById('contactUs').innerHTML = '';
    } else {
      xmlHttp=GetXmlHttpObject(showContactUsForm)
      xmlHttp.open("GET", relativePath+'_contactUs.php' , true)
      xmlHttp.send(null)
      return false;
    }
}
function showContactUsForm() {
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
      document.getElementById('contactUs').innerHTML = xmlHttp.responseText;
    }
}

function submitContactForm(form) {
    url = relativePath+'_contactUs.php?first_name='+form.first_name.value+'&last_name='+form.last_name.value+'&organization='+form.organization.value+'&email='+form.email.value+'&phone='+form.phone.value+'&more_info='+form.more_info.value;
    xmlHttp=GetXmlHttpObject(showContactUsForm)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    return false;
}

function GetXmlHttpObject(handler) { 
    var objXmlHttp=null
    
    if (window.XMLHttpRequest) {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler
        objXmlHttp.onreadystatechange = handler
        return objXmlHttp
    } else if (window.ActiveXObject) {
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0) {
        strName="Microsoft.XMLHTTP"
        } 
        try { 
            objXmlHttp=new ActiveXObject(strName)
            objXmlHttp.onreadystatechange=handler 
            return objXmlHttp
        } 
        catch(e) { 
            alert("Error. Scripting for ActiveX might be disabled") 
            return 
        } 
    } 
}
