var http_requestaddCommentOk = false;
var URL
function makeRequestaddCommentOk(URL, alertFunction) {
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
        http_requestaddCommentOk = new XMLHttpRequest()
    } else if (window.ActiveXObject) { // IE
        try {
            http_requestaddCommentOk = new ActiveXObject("Msxml2.XMLHTTP")
        } catch (e) {
            try {
                http_requestaddCommentOk = new ActiveXObject("Microsoft.XMLHTTP")
            } catch (e) {}
        }
    }
    if (!http_requestaddCommentOk) {
        alert('Giving up :( Cannot create an XMLHTTP instance')
        return false
    }
    http_requestaddCommentOk.onreadystatechange = function() {alertFunction(http_requestaddCommentOk)}
    http_requestaddCommentOk.open('GET', URL, true)
    http_requestaddCommentOk.send(null)
    return true
}

var alertContentsaddCommentOk = function (http_local_requestaddCommentOk) {
    if ( (http_local_requestaddCommentOk.readyState == 4)||(http_local_requestaddCommentOk.readyState=="complete") ) {
        if (http_local_requestaddCommentOk.status == 200) {
    		document.getElementById('add_comment').innerHTML = http_local_requestaddCommentOk.responseText
        } else {
            alert('There was a problem with the request: '+URL+', '+http_local_requestaddCommentOk.status)
    	}
    }
}
function addCommentOk(f_add) {
	if(document.getElementById('form_add_comment_txt').value == "")  {
	alert('Veuillez remplir le champs commentaire. Merci');
} else {
	x = makeRequestaddCommentOk('ajax_add_comment_ok.php?video_id='+escape(document.getElementById('form_add_comment_video_id').value)+'&cat='+escape(document.getElementById('form_add_comment_cat').value)+'&txt='+escape(document.getElementById('form_add_comment_txt').value), alertContentsaddCommentOk)
	listeComment(document.getElementById('form_add_comment_video_id').value);
	// On return, call alertContent() to display returned value
}
}