function writeComment(type) { strURL = "/ajax/comments.php"; var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { updatepage(self.xmlHttpReq.responseText); } } self.xmlHttpReq.send(getquerystring('write'+type)); } function editComment() { strURL = "/ajax/comments.php"; var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { updatepage(self.xmlHttpReq.responseText); } } self.xmlHttpReq.send(getquerystring('edit')); } function updateCommentForm(id,hash) { var strURL = '/ajax/comments.php'; var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { document.getElementById("form_comments").innerHTML = self.xmlHttpReq.responseText; } } self.xmlHttpReq.send('action=updateCommentForm&id=' + id + '&hash=' + hash); } function xmlhttpPost(strURL) { var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { updatepage(self.xmlHttpReq.responseText); } } self.xmlHttpReq.send(getquerystring()); } function getquerystring(type) { if ((type == 'write') || (type == 'write_user')) { var form = document.forms['postform']; var text = form.post_content.value; var action = form.action.value; var country = form.country.value; var fid = form.fid.value; var folder = form.folder.value; if (type == 'write') { var name = form.name.value; var email = form.email.value; var key = form.key.value; return 'action=' + escape(action) + '&text=' + escape(text) + '&country=' + escape(country) + '&fid=' + escape(fid) + '&folder=' + escape(folder) + '&name=' + escape(name) + '&email=' + escape(email) + '&key=' + escape(key); } else { return 'action=' + escape(action) + '&text=' + escape(text) + '&country=' + escape(country) + '&fid=' + escape(fid) + '&folder=' + escape(folder); } } else if (type == 'edit') { var form = document.forms['postform']; var text = form.post_content.value; var action = form.action.value; var id = form.id.value; var hash = form.hash.value; return 'action=' + escape(action) + '&text=' + escape(text) + '&id=' + escape(id) + '&hash=' + escape(hash); } } function updatepage(str){ var form = document.forms['postform']; form.post_content.value = ''; // writeCommentForm(,form.folder.value); // document.getElementById("form_comments").innerHTML = '
'; document.getElementById("thread").innerHTML = str; }