Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /sitebase/antiheroescomic.com/include/comments-js.module.php on line 6
Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /sitebase/antiheroescomic.com/include/comments-js.module.php on line 7
var switchOpenDisplayComments = new Array();
var switchOpenAddComment = new Array();
var defaultUsername = "";
var defaultEmail = "";
var loadingImage = new Image();
loadingImage.src = "/client_include/images/indolents-t.gif";
function displayAddComment(postId, divId, override) {
var divObj = document.getElementById(divId);
if (switchOpenAddComment[postId] != undefined && override != true) {
divObj.innerHTML = "";
switchOpenAddComment[postId] = undefined;
switchOpenDisplayComments[postId] = undefined;
} else {
if (postId != NaN) {
var addComment = "Add Your Comment
";
divObj.innerHTML = addComment + "
" + divObj.innerHTML;
divObj.style.display = "block";
window.location.hash = "#table_comment_post"+postId;
switchOpenAddComment[postId] = true;
}
}
}
function addComment(postId, divId) {
var floaterObj = document.getElementById("floater");
floaterObj.style.width = "100%";
floaterObj.style.height = "100%";
if (!window.XMLHttpRequest) {
floaterObj.style.position = "absolute";
floaterObj.style.top = (document.body.scrollTop)+"px";
} else {
floaterObj.style.position = "fixed";
floaterObj.style.top = "0px";
floaterObj.style.left = "0px";
}
floaterObj.style.top = "0px";
floaterObj.style.left = "0px";
floaterObj.style.backgroundColor = "transparent";
floaterObj.innerHTML = "";
floaterObj.style.visibility = "visible";
floaterObj.style.display = "block";
document.getElementById("loading_image").src = loadingImage.src;
var veilObj = document.getElementById("veil");
setOpacity(veilObj, 90);
veilObj.style.width = "100%";
veilObj.style.height = "100%";
if (!window.XMLHttpRequest) {
veilObj.style.position = "absolute";
veilObj.style.height = (document.body.scrollHeight)+"px";
} else {
veilObj.style.position = "fixed";
veilObj.style.top = "0px";
veilObj.style.left = "0px";
}
veilObj.style.top = "0px";
veilObj.style.left = "0px";
veilObj.style.backgroundColor = "#A89794";
veilObj.style.visibility = "visible";
veilObj.style.display = "block";
var formObj = document.forms["new_comment_post"+postId];
formObj.elements["comment_name"].className = "";
formObj.elements["comment_email"].className = "";
formObj.elements["comment_body"].className = "";
if (formObj.elements["comment_name"].value.match(/^ *$/)) {
formObj.elements["comment_name"].className += "alert";
floaterObj.innerHTML = "";
floaterObj.style.visibility = "hidden";
floaterObj.style.display = "none";
veilObj.style.visibility = "hidden";
veilObj.style.display = "none";
raiseAlert("Please fill out your name or a nickname.");
return false;
} else if (!formObj.elements["comment_email"].value.match(/^(?:(?:[-a-z0-9_\.]+@[-a-z0-9_\.]+\.[a-z][a-z][a-z]?)|(?: *))$/i)) {
formObj.elements["comment_email"].className += "alert";
floaterObj.innerHTML = "";
floaterObj.style.visibility = "hidden";
floaterObj.style.display = "none";
veilObj.style.visibility = "hidden";
veilObj.style.display = "none";
raiseAlert("Your email address is not valid. Remember, this field is optional.");
return false;
} else if (formObj.elements["comment_body"].value.match(/^ *$/)) {
formObj.elements["comment_body"].className += "alert";
floaterObj.innerHTML = "";
floaterObj.style.visibility = "hidden";
floaterObj.style.display = "none";
veilObj.style.visibility = "hidden";
veilObj.style.display = "none";
raiseAlert("Please leave a message!");
return false;
}
var str = "comment_email="+formObj.elements["comment_email"].value+"&comment_name="+formObj.elements["comment_name"].value+"&comment_body="+escape(formObj.elements["comment_body"].value);
str += "&comment_code="+formObj.elements["comment_code"].value;
var xmlhttp = getXmlHttp();
xmlhttp.open("POST", "/news/pid="+postId+"/sendcomment=true/xmlhttp=true");
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
if (xmlhttp.responseText.match(/^error\t/)) {
var splitResponse = xmlhttp.responseText.split("\t");
if (splitResponse[1] != undefined) {
floaterObj.innerHTML = "";
floaterObj.style.visibility = "hidden";
floaterObj.style.display = "none";
veilObj.style.visibility = "hidden";
veilObj.style.display = "none";
raiseAlert(splitResponse[1]);
switchOpenAddComment[postId] = undefined;
switchOpenDisplayComments[postId] = undefined;
}
} else if (xmlhttp.responseText == "ok") {
switchOpenAddComment[postId] = undefined;
switchOpenDisplayComments[postId] = undefined;
divObj = document.getElementById(divId);
divObj.innerHTML = "";
divObj.style.display = "none";
displayComments(postId, divId);
var postNumber = document.getElementById("comment_number_post"+postId);
postNumber.innerHTML = postNumber.innerHTML * 1 + 1;
raiseAlert("Your comment has been posted!");
} else if (xmlhttp.responseText == "pending") {
switchOpenAddComment[postId] = undefined;
switchOpenDisplayComments[postId] = undefined;
var postNumber = document.getElementById("comment_number_post"+postId);
if (postNumber.innerHTML > 0) {
divObj = document.getElementById(divId);
divObj.innerHTML = "";
divObj.style.display = "none";
displayComments(postId, divId);
} else {
floaterObj.innerHTML = "";
floaterObj.style.visibility = "hidden";
floaterObj.style.display = "none";
veilObj.style.visibility = "hidden";
veilObj.style.display = "none";
}
raiseAlert("Your comment has been successfully submitted, and it is currently being held for approval. Make sure to check back later!");
} else if (xmlhttp.responseText == "code") {
document.images["code_image_for_"+postId].src = "/news/conf=true/date="+new Date();
floaterObj.innerHTML = "";
floaterObj.style.visibility = "hidden";
floaterObj.style.display = "none";
veilObj.style.visibility = "hidden";
veilObj.style.display = "none";
formObj.elements["comment_code"].value = "";
formObj.elements["comment_code"].focus();
// REMOVE TEMP COOKIES SESSION
raiseAlert("The code you entered was incorrect. Please try again. If you are having persistent problems, please try this link.");
} else {
switchOpenAddComment[postId] = undefined;
switchOpenDisplayComments[postId] = undefined;
floaterObj.innerHTML = "";
floaterObj.style.visibility = "hidden";
floaterObj.style.display = "none";
veilObj.style.visibility = "hidden";
veilObj.style.display = "none";
raiseAlert("There was an undefined error. Please try again. If you cannot get it working, please consider contacting our technical support.");
}
}
}
xmlhttp.send(str);
return false;
}
function displayComments(postId, divId, override) {
var divObj = document.getElementById("reader_comments_list");
var xmlhttp = getXmlHttp();
if (switchOpenDisplayComments[postId] != undefined && override != true) {
divObj.innerHTML = "";
divObj.style.display = "none";
header = document.getElementById("reader_comments").getElementsByTagName('header')[0];
header.removeChild(header.getElementsByTagName('h2')[0]);
switchOpenDisplayComments[postId] = undefined;
if (switchOpenAddComment) {
switchOpenAddComment[postId] = undefined;
}
} else {
if (postId != NaN) {
var floaterObj = document.getElementById("floater");
floaterObj.style.width = "100%";
floaterObj.style.height = "100%";
if (!window.XMLHttpRequest) {
floaterObj.style.position = "absolute";
floaterObj.style.top = document.body.scrollTop+"px";
} else {
floaterObj.style.position = "fixed";
floaterObj.style.top = "0px";
floaterObj.style.left = "0px";
}
floaterObj.style.backgroundColor = "transparent";
floaterObj.innerHTML = "";
floaterObj.style.visibility = "visible";
floaterObj.style.display = "block";
document.getElementById("loading_image").src = loadingImage.src;
var veilObj = document.getElementById("veil");
setOpacity(veilObj, 80);
veilObj.style.width = "100%";
veilObj.style.height = "100%";
if (!window.XMLHttpRequest) {
veilObj.style.position = "absolute";
veilObj.style.height = (document.body.scrollHeight)+"px";
} else {
veilObj.style.position = "fixed";
veilObj.style.top = "0px";
veilObj.style.left = "0px";
}
veilObj.style.backgroundColor = "#A89794";
veilObj.style.display = "block";
veilObj.style.visibility = "visible";
var xmlhttp = getXmlHttp();
var serverPage = "/news/pid="+postId+"/getcomments=true";
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
floaterObj.innerHTML = "";
floaterObj.style.visibility = "hidden";
floaterObj.style.display = "none";
veilObj.style.visibility = "hidden";
veilObj.style.display = "none";
var addComment = "";
if (xmlhttp.responseText == "none") {
var newInner = (switchOpenAddComment[postId] == undefined) ? "No comments were found for this post. Would you like to add one?
" + addComment: divObj.innerHTML + "No comments were found for this post.";
divObj.innerHTML = newInner;
divObj.style.display = "block";
switchOpenDisplayComments[postId] = true;
switchOpenAddComment[postId] = true;
} else if (xmlhttp.responseText == "disabled") {
return false;
} else if (xmlhttp.responseText.match(/^([^\n]+\t[^\n]*\t[^\n]+\t[^\n]+\t[^\n]+\n)+$/)) {
var addCommentLink = (!switchOpenAddComment) ? "Add Comment" : "";
newHeader = document.createElement("h2");
newHeader.innerText = "Comments";
document.getElementById("reader_comments").getElementsByTagName('header')[0].appendChild(newHeader);
divObj.style.display = "block";
var comments = xmlhttp.responseText.split("\n");
var output = "";
var postNumber = document.getElementById("comment_number_post"+postId);
postNumber.innerHTML = comments.length-1;
for (var i=0; i