function replaceHtml(divId, newHtml){
    element = document.getElementById(divId);
    element.innerHTML = newHtml;
}

//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function replaceDivFromAjax(){
    var myajax=ajaxpack.ajaxobj
    var myfiletype=ajaxpack.filetype
    if (myajax.readyState == 4){
        //if request of file completed
        if (myajax.status==200 || window.location.href.indexOf("http")==-1){
            //if request was successful or running script locally
            if (myfiletype=="txt"){
                replaceHtml("divFromAjax", myajax.responseText);
            }else{
                replaceHtml("divFromAjax", myajax.responseXML);
            }
        }
    }
}


function swapInnerHtml(id,newHtml) {
    var obj = document.getElementById(id);
    obj.innerHTML = newHtml;
}
