function do_karma(id, karma){
    xmlHttp=GetXmlHttpObject();
    url = "/comments/karma/vote/"+id+"/"+karma;
    alert("test"+url);
    xmlHttp.open("GET", url , true);
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            alert("did_karma");
        }
    }
    xmlHttp.send("");
}
function report_comment(id){
    xmlHttp=GetXmlHttpObject();
    url = "/comments/flag/"+id;
    xmlHttp.open("GET", url , true);
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            cmt_div = "cmt_verify_"+id;
            var div = document.getElementById(cmt_div);
            div.innerHTML = xmlHttp.responseText;
        }
    }
    xmlHttp.send("");
}
function confirm_report(id){
    xmlHttp=GetXmlHttpObject();
    url = "/comments/flag/"+id+"/";
    xmlHttp.open("POST", url , true);
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            cmt_div = "report_comment_"+id;
            var div = document.getElementById(cmt_div)
            if(div.innerHTML.search('Reported') != -1){
                div.innerHTML = "Report Comment";
            }
            else{
                div.innerHTML = "<strong>Reported</strong>";
                cmt_div = "cmt_verify_"+id;
                var div = document.getElementById(cmt_div);
                div.innerHTML = "An editor has been alerted and will review the comment shortly";
                
            }
        }
    }
    xmlHttp.send("id="+id);
}

function close_cmt_confirm(id){
    cmt_div = "cmt_verify_"+id;
    var div = document.getElementById(cmt_div);
    div.innerHTML = "";  
}

function delete_comment(id){
    xmlHttp=GetXmlHttpObject();
    url = "/comments/delete/"+id;
    xmlHttp.open("GET", url , true);
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            cmt_div = "cmt_verify_"+id;
            var div = document.getElementById(cmt_div);
            div.innerHTML = xmlHttp.responseText;
        }
    }
    xmlHttp.send("");
}
function confirm_delete(id){
    xmlHttp=GetXmlHttpObject();
    url = "/comments/delete/"+id+"/";
    xmlHttp.open("POST", url , true);
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            cmt_div = "delete_comment_"+id;
            var div = document.getElementById(cmt_div)
            if(div.innerHTML.search('Removed') != -1){
                div.innerHTML = "Remove Comment";
            }
            else{
                div.innerHTML = "done";
                cmt_div = "cmt_verify_"+id;
                var div = document.getElementById(cmt_div);
                div.innerHTML = "The comment has been changed. Refresh the page to make sure it took effect.";
            }
        }
    }
    xmlHttp.send("id="+id);
}

function close_cmt_confirm(id){
    cmt_div = "cmt_verify_"+id;
    var div = document.getElementById(cmt_div);
    div.innerHTML = "";  
}

