
function sendData(url, data, callbackFunction){

	var xmlDocSub;

	if (typeof window.ActiveXObject != 'undefined' ) {
		xmlDocSub = new ActiveXObject("Microsoft.XMLHTTP");
		xmlDocSub.onreadystatechange = function(){
			if(xmlDocSub.readyState == 4) {
				callbackFunction(xmlDocSub.responseXML);
			}
        }        
    } 
    else {
        xmlDocSub = new XMLHttpRequest();
        xmlDocSub.onload = function(){
       		if(xmlDocSub.readyState == 4) {
       			callbackFunction(xmlDocSub.responseXML);
       		}
        }        
    }
    xmlDocSub.open("POST",url,true);
    xmlDocSub.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    xmlDocSub.send(data);
}


function sendDataReplaceHtml(url, data, containerelement, callbackFunction){
	var htmlDoc = null;

/*
    // here is a shorter way of doing the below TODO replace below with this
    new Ajax.Request(data,{
        method:'post',
        onSuccess: callbackFunction
    });
*/

	if (typeof window.ActiveXObject != 'undefined' ) {
		htmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
		htmlDoc.onreadystatechange = function(){
			if(htmlDoc.readyState == 4) {
				//alert("containerelement:" +containerelement);
       			//alert("htmlDoc.responseText:" + htmlDoc.responseText);
				containerelement.innerHTML = htmlDoc.responseText;
				if(callbackFunction != null){
					callbackFunction();
				}
			}
        }        
    } 
    else {
        htmlDoc = new XMLHttpRequest();
        htmlDoc.onload = function(){
       		if(htmlDoc.readyState == 4) {
       			containerelement.innerHTML = htmlDoc.responseText;
       			if(callbackFunction != null){
					callbackFunction();
				}
       		}
        	
        }        
    }
    htmlDoc.open("POST",url,true);
    htmlDoc.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    htmlDoc.send(data);
}

