if(lstcommentid){ if($s("comment-"+lstcommentid)){ lstcommentid = $s("comment-"+lstcommentid); var commentformel = $s("comment_reply_ID"); while(commentformel != null && commentformel.tagName != "FORM"){ commentformel = commentformel.parentNode; } if(commentformel != null && commentformel.action.indexOf("wp-comments-post.php") != -1){ commentformel.onsubmit = wptcajaxsend; } } } function gparam(f){ var p='wptcajax=wptcajax'; var fi = f.getElementsByTagName('input'); for(i=0; i

"); comment = comment.replace(/\r\n/g, "
"); comment = comment.replace(/\n\n/g, "

"); comment = comment.replace(/\n/g, "
"); comment = "

"+comment+"

"; var dateObj = new Date(); if(r == 0){ c = document.createElement('div'); //c = document.createElement(lstcommentid.tagName); c.id = "newcomment"; if(sortflag == 'DESC'){ lstcommentid.parentNode.insertBefore(c,lstcommentid); window.location="#newcomment"; }else{ if(lstcommentid.parentNode.lastChild == lstcommentid){ lstcommentid.parentNode.appendChild(c); }else{ lstcommentid.parentNode.insertBefore(c,lstcommentid.nextSibling); } } }else{ c = document.createElement('div'); c.id = "newcomment"; rpPel.appendChild(c); } c.innerHTML = "

"+author+" Submit on "+dateObj.toLocaleString()+":

"+comment+"

new comment is submiting, please wait a comment...

"; $s(commentformid).style.display='none'; req.onreadystatechange = function(){ if(req.readyState == 4){ $s(commentformid).style.display='block'; if(req.status == 200){ wptctextreplace($s('newcomment'),req.responseText); if(parseInt(r)){ movecfm(null,0,0,null); } if($s('comment')) $s('comment').value = ''; }else{ c.parentNode.removeChild(c); var error = req.responseText.match(/]*>[\s\S]*?

]*>([\s\S]*)[\s\S]*?/i); if(typeof(error) != 'undefined' && error != null && error != ''){ alert(error[1]); }else{ alert('Failed to add your comment.'); } } } } req.open('POST', commentformel.action, true); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.setRequestHeader("Content-length", p.length); req.setRequestHeader("Connection", "close"); req.send(p); return false; } function wptctextreplace(element,text){ if(!text) return false; element.innerHTML = text; var commentid = text.match(/]*>[\s\S]*/i); if(typeof(commentid) != 'undefined' && commentid != null){ var commentid = commentid[3]; var childelement = $s(commentid); var n=1; while(childelement.parentNode != element){ childelement = childelement.parentNode; n= n+1; if(n>10) break; } if(n