function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
  		// code for IE7+, Firefox, Chrome, Opera, Safari
  		return new XMLHttpRequest();
  	}
	if (window.ActiveXObject){
  	// code for IE6, IE5
  		return new ActiveXObject("Microsoft.XMLHTTP");
  	}
	return null;
}

var http = GetXmlHttpObject(); // We create the HTTP Object

function getRequestBody() {
    var aParams = new Array();
	aParams = getParameters(document.main_form,aParams);
    return aParams.join("&");
}

function getParameters(oForm,aParams) {
    for (var i=0 ; i < oForm.elements.length; i++) {
		add_check = true;
		if(oForm.elements[i].type=="checkbox"){
				add_check = oForm.elements[i].checked;	
		}
		
		// only add the checkbox which are checked
		if(add_check){
        	var sParam = encodeURIComponent(oForm.elements[i].name);
        	sParam += "=";
        	sParam += encodeURIComponent(oForm.elements[i].value);
        	aParams.push(sParam);
		}
    }
	return aParams;
}
