
var isIE = false;
var req;
var passurl;

function loadXMLDoc() {
	// alert("Here is the URL:" + passurl);
	var urlread;
	var now=new Date();
	// readurl = passurl + '&spoiler=' + (now.getSeconds());
	// readurl = passurl + '&spoiler=' + now;
	readurl = passurl;
	// alert("Here is the URL:" + readurl);
  		
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", readurl, true);
        req.send(null);
    } 
	else if (window.ActiveXObject) {
    	isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
        	req.onreadystatechange = processReqChange;
			req.open("GET", readurl, true);
            req.send();
        }
    } 
}

function processReqChange() {
	if (req.readyState == 4) {
    	if (req.status == 200) {
			displayresult();
		} 
		else {
        	alert("There was a problem retrieving the XML data:" + req.statusText);
        }
    }
}

function displayresult() {
	div = document.getElementById("data");
	// With date
	// div.innerHTML = '<b>' + (new Date).toLocaleString() + '</b><br>' + req.responseText;
	// Without date
	div.innerHTML = req.responseText;
	// document.getElementById('greyout').style.visibility='visible';
	// document.getElementById('prodpop').style.visibility='visible';
}

function getusedspas() {
	// alert("Overflow : " + document.body.style.overflow);
	// parent.document.body.style.overflow='hidden';  // was used to turn off scroll bars
	// alert("Overflow : " + document.body.style.overflow);
	// passurl = url;
	var domain = 'http://' + window.location.hostname + '/';
	passurl = domain + 'cgi-bin/smartadm.pl?command=dispusedspas';
	loadXMLDoc();
	// MsgBox ("URL: " + passurl);
	// passurl = url + "&sqft=" + document.getElementById("sqft");
	// setInterval("loadXMLDoc()", 2*1000 );
}

function getspecoffers() {
	var domain = 'http://' + window.location.hostname + '/';
	passurl = domain + 'cgi-bin/smartadm.pl?command=dispspecoffers';
	loadXMLDoc();
}