function getServerName() { var str = window.location.protocol + '//' + window.location.hostname; return str; } function getObjectRefByID(objectId) { var element = false; // cross-browser function to get an object given its id if(document.getElementById && document.getElementById(objectId)) { // W3C DOM element = document.getElementById(objectId); } else if (document.all && document.all(objectId)) { // MSIE 4 DOM element = document.all(objectId); } else if (document.layers && document.layers[objectId]) { // NN 4 DOM.. note: this won’t find nested layers element = document.layers[objectId]; } return element; } var http_request = false; function makePOSTRequest(url, parameters) { http_request = false; 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; charset=iso-8859-9;"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Referer",window.document.location); http_request.setRequestHeader("Connection", "close"); http_request.send(parameters); } function alertContents() { if (http_request.readyState == 4) { if (http_request.status == 200) { //alert(http_request.responseText); hideContactTimer(); result = http_request.responseText; document.getElementById('myspan').innerHTML = result; } else { alert('There was a problem with the request.'); } } } function get(obj) { var success = document.getElementById('emailSuccess'); var poststr = ''; for (var i = 0; i0)) {poststr += '&';} poststr += FormName + '=' + encodeURI( getObjectRefByID(FormName).value ); //alert (poststr); } showContactTimer(); // quickly begin the load bar success.style.display = 'none'; // hide the success bar (incase this is a multi-email makePOSTRequest(getServerName()+'/formatik/formatik.asp', poststr); } function showContactTimer () { var loader = document.getElementById('loadBar'); loader.style.display = 'block'; } function hideContactTimer () { var loader = document.getElementById('loadBar'); var success = document.getElementById('emailSuccess'); // Hide the load bar alas! Done Loading loader.style.display = "none"; success.style.display = "block"; } function hideSuccess () { var success = document.getElementById('emailSuccess'); success.style.display = "none"; }