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]*)<\/p>[\s\S]*?<\/body>/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(/<(\w+).*?id\s*=\s*("|')(comment-\d+?)\2[^>]*>[\s\S]*<\/\1>/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<11){ if(typeof(childelement.className) != 'undefined' && lstcommentid.className.match(/\balt\b/i)){ childelement.className = childelement.className.replace(/\balt\b/i,''); } element.parentNode.insertBefore(childelement,element); element.parentNode.removeChild(element); if($s('comment_reply_ID').value == 0) lstcommentid = childelement; if(typeof(AjaxEditComments) != 'undefined' && typeof(AjaxEditComments.init) == 'function') AjaxEditComments.init(); } }else{ lstcommentid = element; } return true; } function stpm(aname,array){ for (var i=0; i < array.length; i++){ var c = array[i].split("="); c[0] = unescape(decodeURI(c[0])); c[0] = c[0].replace(/^\s+|\s+$/g,""); if (aname == c[0]){ c[1] = unescape(decodeURI(c[1])); c[1] = c[1].replace(/^\s+|\s+$/g,""); return c[1]; } } return null; }