function alertContents(xmlhttp, id) {
	if (xmlhttp.readyState == 0) {
	}
	else if (xmlhttp.readyState == 1) {
	}
	else if (xmlhttp.readyState == 2) {
	}
	else if (xmlhttp.readyState == 3) {
	}
	else if (xmlhttp.readyState == 4) {
		if (xmlhttp.status == 200) {
			e = document.getElementById(id);
			if(!e){
				alert('There is no element to display results, Sorry!');
				return;
			}
			e.innerHTML = xmlhttp.responseText;
			//document.images['bigPhoto'].src = document.images['bigPhoto'].src;
			var agt;
			var agt=navigator.userAgent.toLowerCase();
			var is_ie6=((agt.indexOf("msie 6.")!=-1));
			if(is_ie6) // animated gif have to be restarted in IE6, aaaarrraghg
			{
				img=document.getElementById('runningLogo');
				if(img) img.src= img.src;
				//document.images['runningLogo'].src = document.images['runningLogo'].src;
			}
		} else {	
			alert('There was a problem with the request.');
		}
	}
}

function makeGETRequest(url,id) {
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}

    if (!xmlhttp) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    xmlhttp.open('GET', url, true);
    xmlhttp.onreadystatechange = function() { alertContents(xmlhttp, id); };
    xmlhttp.send(null);
}

function makePOSTRequest(url,id,params){
    var xmlhttp = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        xmlhttp = new XMLHttpRequest();
        if (xmlhttp.overrideMimeType) {
            xmlhttp.overrideMimeType('text/xml');
            //xmlhttp.overrideMimeType('text/html');
            // See note below about this line
        }
    } else if (window.ActiveXObject) { // IE
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }

    if (!xmlhttp) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    xmlhttp.onreadystatechange = function() { alertContents(xmlhttp, id); };
    xmlhttp.open('POST', url, true);
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(params);
}

