function preg_replace(search, replace, str, regswitch) { var regswitch = !regswitch ? 'ig' : regswitch; var len = search.length; for(var i = 0; i < len; i++) { re = new RegExp(search[i], regswitch); str = str.replace(re, typeof replace == 'string' ? replace : (replace[i] ? replace[i] : replace[0])); } return str; } function Rfilter(str) { return preg_replace(['\'','"', '<\/?[^>]*>'], ['','', ''], str); } function getCookie(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) { return unescape(arr[2]); } else { return null; } } function SetCommentiframeHeight(obj) { var win=obj; setInterval(function(){setIntervalSetCommentiframeHeight(win);},1000); //var IframeBodyHeight=getCookie('IframeBodyHeight'); //win.height = IframeBodyHeight; } function setIntervalSetCommentiframeHeight(win){ var IframeBodyHeight=getCookie('IframeBodyHeight'); win.height = IframeBodyHeight; } function makeFrameReply() { if(document.getElementById('reply_button')) { //document.getElementById('reply_button').innerHTML = '我要评论()'; } var hash = Math.random(); var comments = document.body.innerHTML ; var iscommentobj = null; iscommentobj = document.getElementById('iscomment'); if(!iscommentobj) { return false; } if(iscommentobj.value != 1) { return false; } var articleid = comments.substring(comments.indexOf("")+8,comments.indexOf("")) ; var url = encodeURIComponent(window.location.href+'#'+articleid); document.getElementById('hiddenDivReply').innerHTML = ''; } function addLoadEvent(func){ var oldonload = window.onload, sta; if (typeof window.onload!='function'){ window.onload = func; sta = 0; } else { sta = 1; } window.onload = function(){ if (sta == 1){ oldonload(); } func(); } } addLoadEvent(makeFrameReply);