/*
 * $Id: lineage.js 193 2006-07-22 05:30:37Z michi2 $
 */

function getXConfidence(strURLs, ids, img_ids) {
    for (var i = 0; i < strURLs.length; i++) {
        getConfidence(strURLs[i], ids[i], img_ids[i]);
    }
}

function getConfidence(strURL, id, img_id) {
    var xmlHttpReq = false;

    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlHttpReq.open('POST', strURL, true);
    xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttpReq.onreadystatechange = function() {
        if (xmlHttpReq.readyState == 4) {
            updateConf(xmlHttpReq.responseText, id, img_id);
        }
    }
    xmlHttpReq.send('');
}

function updateConf(str, id, img_id){
    var img = document.getElementById(img_id);
    if (document.getElementById(id).innerHTML == '') {
        document.getElementById(id).innerHTML = str;
        img.innerHTML = '';
    } else {
        document.getElementById(id).innerHTML = '';
    }
}
