/*
	2007.10.03	gricke
				<Bonsai Transform Document Error>
				If the ajax string finds an error, send an email
				**requires that variables are set in file prior to this load (siteFunction.js)
				
					var ajaxErrorTo = 'gricke@orbisdesign.com';
					var ajaxErrorFrom = 'errors@federalsignal-integratedsystems.com';
					var ajaxErrorSubject = 'federalsignal-integratedsystems.com error';				
*/
function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            returnHttpReqResults(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send('asdf');	//must send something or get "length required" in FF
}
function returnHttpReqResults(results){
	var HTMLDisp = '';
	if (document.getElementById('httpReqResults')){
		var httpReqResultsHtml = document.getElementById('httpReqResults');
		if(results.indexOf('Bonsai Transform Document Error') != -1){
			HTMLDisp = HTMLDisp + '<div id=\"ajaxError\">There has been error retrieving the data.  We apologize for the inconvenience.  We are checking into the problem, please check back soon.</div>';
			if((typeof(ajaxErrorTo) != 'undefined') && (typeof(ajaxErrorFrom) != 'undefined') && (typeof(ajaxErrorSubject) != 'undefined')){
				HTMLDisp = HTMLDisp + '<img src=\"http://www.orbisdesign.com/include/emailError.asp?to=' + ajaxErrorTo + '&from=' + ajaxErrorFrom + '&subject=' + ajaxErrorSubject + '&body=Source- ' + window.location +'\">';
			}	
		}else{
			HTMLDisp = HTMLDisp + results;
		}
		httpReqResultsHtml.innerHTML = HTMLDisp; 
	}
}
function loadingMessage(loadingImage,padImage){
	document.getElementById('httpReqResults').innerHTML = "<img src=\"" + loadingImage + "\" style=\"padding:" + padImage + "px;\" style=\"\" /> Loading...";
}