function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();
var responseid = "";

function recorddownload(filename,cat,language) {
    s = '/library/resources/download.php?file='+filename+'&category='+cat+'&language='+language;
    responseid = 'count-'+filename;
    http.open('post',s,true);
    http.onreadystatechange = handleDownloadResponse;
    http.send(null);
}

function getdownloads(filename,cat) {
    s = '/library/resources/download.php?file='+filename+'&category='+cat;
    responseid = 'count-'+filename;
    http.open('post',s,true);
    http.onreadystatechange = handleDownloadResponse;
    http.send(null);
}

function showfiledata(filename) {
    s = '/library/resources/showfiledata.php?file='+filename;
    responseid = 'count-'+filename;
    http.open('post',s,true);
    http.onreadystatechange = handleDownloadResponse;
    http.send(null);
}

function handleDownloadResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        document.getElementById(responseid).innerHTML = response;
        }
}


