function comment_add(pub_id) { var civ = document.getElementById("comment_add"); if (civ.className == "invis") { civ.className = "c_add"; document.getElementById('comment_add_link').className = 'invis'; civ.innerHTML = "\"Loading...\""; var xmlhttp = getXmlHttp(); xmlhttp.open('GET', '/blogs/xml_comment_add?pub_id='+pub_id, true); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { civ.innerHTML = xmlhttp.responseText; document.comment_add_form.message.focus(); window.scrollBy(0,50); } } }; xmlhttp.send(null); } } function comment_show(pub_id,page_num) { var civ = document.getElementById("comment_show"); civ.className = "c_show"; document.getElementById("comment_show_link").className = "invis"; civ.innerHTML = "\"Loading...\""; var xmlhttp = getXmlHttp() xmlhttp.open('GET', '/blogs/xml_comment_show?pub_id='+pub_id+'&page='+page_num, true); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.getElementById("comment_show").innerHTML = xmlhttp.responseText; window.scrollBy(0,50); } } }; xmlhttp.send(null); } function comment_submit_logged (pub_id) { var message = document.forms['comment_add_form'].message.value; var xmlhttp = getXmlHttp(); var params = 'send=true&pub_id='+pub_id+'&message='+encodeURIComponent(message); xmlhttp.open('POST', '/blogs/xml_comment_add', true); xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { var result = xmlhttp.responseText; var resultflag = result.substr(2,8); if (resultflag=="is_error") { var result = result.substr(12); show_message(result); } else { show_message("Your message has been sent."); document.getElementById('comment_add').className="invis"; comment_add(pub_id); comment_show(pub_id); } } } }; xmlhttp.send(params); } function comment_submit (pub_id) { var username = document.forms['comment_add_form'].user_name.value; var useremail = document.forms['comment_add_form'].user_email.value; var message = document.forms['comment_add_form'].message.value; var xmlhttp = getXmlHttp(); var params = 'send=true&pub_id='+pub_id+'&username='+encodeURIComponent(username)+'&useremail='+encodeURIComponent(useremail)+'&message='+encodeURIComponent(message); xmlhttp.open('POST', '/blogs/xml_comment_add', true); xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { var result = xmlhttp.responseText; var resultflag = result.substr(2,8); if (resultflag=="is_error") { var result = result.substr(12); show_message(result); } else { show_message("Your message has been sent."); document.getElementById('comment_add').className="invis"; comment_add(pub_id); comment_show(pub_id); } } } }; xmlhttp.send(params); }