 function InitAjax() {     
	 RequestObject = false;     
	 if(window.XMLHttpRequest) {         
		 try {             
		 RequestObject = new XMLHttpRequest();         
		 } 
	 catch(e) {             
	 RequestObject = false;         
	 }     
	 } 
	 else if(window.ActiveXObject) {         
	 try {             
	 RequestObject = new ActiveXObject("Msxml2.XMLHTTP");         
	 } catch(e) {             
		 try {                 
		 RequestObject = new ActiveXObject("Microsoft.XMLHTTP");             
		 } catch(e) {                 
	 RequestObject = false;             
	 }         
	 }     
	 }     
	 return RequestObject; 
 } 
 // ------------------------------------------------------------- 
 function SubmitNewEvent(div_id, script, thisform) {     
 xmlHttp = InitAjax(div_id);     
 elem = document.getElementById(div_id);
 
var script_src = script.replace(/[^a-zA-Z 0-9 _]+/g,'');
xmlHttp.open("POST", "/ajax_"+ script_src +".php?cid=&spath=", true);  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
 
 
function removeEmpty(someArray) {
var newArray = [];
for(var index = 0;
	index < someArray.length; index++) {
 var splitarray = someArray[index].split("=");

// remove empty values	
if (splitarray[1] == null || splitarray[1] == "undefined"){}
//remove hidden names
if (splitarray[0] == "hidden" || splitarray[0] == "submit"){}

	else{
//alert (splitarray[0]+" "+splitarray[1]);
	
	var newvaluesj = splitarray.join();
	newvaluesjr = (newvaluesj.replace(/,/g,"="));
//alert (newvaluesjr);
	newArray.push(newvaluesjr);
	}	
}    
return newArray;
}



/*
//============== un comment this block to remove posted elements ==========
// get all of the form fields to remove elements
		var test = BuildPostVars(thisform);
		var testarray = test.split("&");
// send the fields to remove empty
		var results = removeEmpty(testarray);
// put the string back together
		var retstring = results.join();
// remove spaces
		retstring = (retstring.replace(/ /g,""));
//rebuild with &
		retstr = (retstring.replace(/,/g,"&"));
*/


// this is the original var, comment this out if using the above function
 var retstr = BuildPostVars(thisform);
 
//alert (retstr); 
 xmlHttp.send(retstr);
  
 xmlHttp.onreadystatechange = function()     
	 {         
		 if(xmlHttp.readyState == 4)         
		 {             
		 elem.innerHTML = xmlHttp.responseText;             
		 xmlHttp.close;             
		 xmlHttp = null;         
		 }      
	 } 
 } 
function BuildPostVars(thisform){
var str = "";
	for (var i=0; i<thisform.length; i++) {
		str+= thisform[i].name;
		str+= "=";
		str+= escape(thisform[i].value);
			if (i != thisform.length - 1){
			str+= "&";
			}
	}
//	alert(str);
return str;	
}