
/* Simple Synchronous AJAX implementation */
/* By MdR   Wednesday, June 11, 2008 5:15:31 PM */

// Call with:
// var fileFromServer = runSyncAjaxPost('http://somedomain.com/processData.php', sendThisDataAsAPost);
function runSyncAjaxPost(url, data) {  
	if (window.XMLHttpRequest) {
		ajax = new XMLHttpRequest();                
	} else {                                      
		//ajax = new ActiveXObject("Microsoft.XMLHTTP");  
		try {
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				ajax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				ajax = null;
			}
		}
	}  
	if (ajax) {    
		ajax.open("POST", url, false);    
		ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");    
		ajax.send(data);    
		return ajax.responseText;                                           
	} else {     
		return false;  
	}
}

// Call with:
// var fileFromServer = runSyncAjaxGet('http://somedomain.com/somefile.txt');
function runSyncAjaxGet(url) {  
	if (window.XMLHttpRequest) {
		ajax = new XMLHttpRequest();                
	} else {                                      
		//ajax = new ActiveXObject("Microsoft.XMLHTTP");  
		try {
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				ajax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				ajax = null;
			}
		}
	}  
	if (ajax) {     
		ajax.open("GET", url, false);                                  
		ajax.send(null);     
		return ajax.responseText;                                           
	} else {     
		return false;  
	}                                             
}

