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();

function sndReqCommentMark(action, comment_id, uid, p, pid) {
    http.open('get', '/ajax/comment_mark.php?comment_mark_action='+action+'&comment_id='+comment_id+'&uid='+uid+'&pid='+pid+'&p='+p);
    //document.write('/ajax/comment_mark.php?comment_mark_action='+action+'&comment_id='+comment_id+'&uid='+uid+'&pid='+pid+'&p='+p);
    http.onreadystatechange = handleResponseCommentMark;
    http.send(null);
}

function handleResponseCommentMark() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
        }
    }
}





function sndReqPaintingPosition(action, uid, p, painting_id) {
    http.open('get', '/ajax/painting_position.php?action='+action+'&uid='+uid+'&painting_id='+painting_id+'&p='+p);
    http.onreadystatechange = handleResponsePaintingPosition;
    http.send(null);
}

function handleResponsePaintingPosition() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
        }
    }
}

