var flagCaptcha = false; var flagEmail = false; var flagFields = true; var message = ''; function createRequestObject(){ try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp; }; var http = createRequestObject(); function refreshimg(){ var url = InstallationUrl + 'captcha-refresh.php'; dorefresh(url, displayimg); }; function dorefresh(url, callback) { http.open('POST', url, true); http.onreadystatechange = displayimg; http.send(null); }; function displayimg() { if(http.readyState == 4) { var showimage = http.responseText; document.getElementById('captchaimage').innerHTML = showimage; }; }; function checkForm(checkemail) { var vercode = document.PostCommentForm.vercode.value; if(checkemail) { var email = document.PostCommentForm.PostCommentEmail.value; } else { var email = 'anonymous@animestreamers.com'; } var url = InstallationUrl + 'process.php?captcha=' + vercode + '&email=' + email; http.open('GET', url, true); http.onreadystatechange = displaycheck; http.send(null); }; function displaycheck() { message = 'Please fix the following errors:\n'; flagFields = true; var PostCommentName = document.PostCommentForm.PostCommentName.value; var PostCommentEmail = document.PostCommentForm.PostCommentEmail.value; var PostCommentBody = document.PostCommentForm.PostCommentBody.value; if (PostCommentName.length==0 || PostCommentEmail.length==0 || PostCommentBody.length==0){ flagFields = false; }; if(http.readyState == 4) { var showcheck = http.responseText; eval(http.responseText); if (flagCaptcha == false || flagFields==false || flagEmail==false) { if (flagCaptcha == false) { message += '- Incorrect verification code\n'; }; if (flagEmail == false) { message += '- Invalid email address\n'; }; if (PostCommentName.length == 0) { message += '- Please enter your name\n'; }; if (PostCommentEmail.length == 0) { message += '- Please enter your email address\n'; }; if (PostCommentBody.length == 0) { message += '- Please enter a message\n'; }; }; if (flagCaptcha == false || flagFields==false || flagEmail==false) { alert(message); } else { ajaxpage(InstallationUrl + 'postcomment.php?id='+pageCommentID+'&do=post','PostCommentContainer','post'); }; }; }; var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; function ajaxpage(url, containerid, requesttype){ var page_request = createRequestObject(); if (requesttype=='get'){ if (bustcachevar) bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() page_request.open('GET', url+bustcacheparameter, true) page_request.send(null) } else if (requesttype=='post') { var PostCommentName = document.PostCommentForm.PostCommentName.value; var PostCommentEmail = document.PostCommentForm.PostCommentEmail.value; var PostCommentBody = document.PostCommentForm.PostCommentBody.value; var poststr = "PostCommentName=" + encodeURIComponent(PostCommentName) + "&PostCommentEmail=" + encodeURI(PostCommentEmail) + "&PostCommentBody=" + encodeURIComponent(PostCommentBody); page_request.open('POST', url, true); page_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); page_request.setRequestHeader("Content-length", poststr.length); page_request.setRequestHeader("Connection", "close"); page_request.send(poststr); }; page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) document.getElementById(containerid).innerHTML=page_request.responseText } loadComments = '
'; document.writeln(loadComments);