var img_captcha=new Image();img_captcha.src="/common/captcha.php";var img_submit=new Image();img_submit.src="/images/btn_submit.gif";var img_cancel=new Image();img_cancel.src="/images/btn_cancel.gif";var d,dom,ie,ie4,ie5x,moz,mac,win,lin,old,ie5mac,ie5xwin,op;d=document;n=navigator;na=n.appVersion;nua=n.userAgent;win=(na.indexOf("Win")!=-1);mac=(na.indexOf("Mac")!=-1);lin=(nua.indexOf("Linux")!=-1);if(!d.layers){dom=(d.getElementById);op=(nua.indexOf("Opera")!=-1);konq=(nua.indexOf("Konqueror")!=-1);saf=(nua.indexOf("Safari")!=-1);moz=(nua.indexOf("Gecko")!=-1&&!saf&&!konq);ie=(d.all&&!op);ie4=(ie&&!dom);ie5x=(d.all&&dom);ie5mac=(mac&&ie5x);ie5xwin=(win&&ie5x)}window.size=function(){var a=0;var b=0;if(!window.innerWidth){if(!(document.documentElement.clientWidth==0)){a=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else{a=document.body.clientWidth;b=document.body.clientHeight}}else{a=window.innerWidth;b=window.innerHeight}return{width:a,height:b}};window.center=function(){var f=(arguments[0]!=null)?arguments[0]:{width:0,height:0};var b=0;var a=0;var c=0;var e=0;if(!window.pageYOffset){if(!(document.documentElement.scrollTop==0)){e=document.documentElement.scrollTop;c=document.documentElement.scrollLeft}else{e=document.body.scrollTop;c=document.body.scrollLeft}}else{c=window.pageXOffset;e=window.pageYOffset}b=((this.size().width-f.width)/2)+c;a=((this.size().height-f.height)/2)+e-115;return{x:b,y:a}};function refreshCaptcha(){var a=Math.floor(Math.random()*99999999);img_captcha.src="/common/captcha.php?rand="+a}function Ltrim(a){return a.replace(/^\s+/,"")}function Rtrim(a){return a.replace(/\s+$/,"")}function trim(a){return Ltrim(Rtrim(a))}function chkSpecialChar(b){var c="`~_!@#$%^&*()+=-[]\\';,./{}|\":<>?";for(var a=0;a<b.length;a++){if(c.indexOf(b.charAt(a))!=-1){return false}}return true}function IsNumeric(e){var c="0123456789";var b=true;var a;for(i=0;i<e.length&&b==true;i++){a=e.charAt(i);if(c.indexOf(a)==-1){b=false}}return b}function createCookie(b,e,f){var a=new Date();a.setTime(a.getTime()+(f*1000));var c="; expires="+a.toGMTString();document.cookie=b+"="+e+c+"; path=/"}function readCookie(b){var g=b+"=";var a=document.cookie.split(";");for(var e=0;e<a.length;e++){var f=a[e];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(g)==0){return f.substring(g.length,f.length)}}return null}function eraseCookie(a){createCookie(a,"",-1)}function addComment(q){	var iChars = "`~^";var e="",l;var g=trim(q.author.value);var a=q.cmnComment.value;var u=q.page_type.value;var s=q.getElementsByTagName("input")[q.getElementsByTagName("input").length-3];var h=q.getElementsByTagName("input")[q.getElementsByTagName("input").length-1];var j=q.getElementsByTagName("span")[q.getElementsByTagName("span").length-1];var w=q.month.value;var k=q.year.value;var b=q.article_id.value;var m=q.cmnwebsite.value;if(g==""){e+="Please enter your name.\n"}else{if(g.length<3){e+="Name should be atleast three characters.\n"}else{if(!chkSpecialChar(g)){e+="Name should not have special characters.\n"}else{if(IsNumeric(g)){e+="Name should contain atleast one alphabet.\n"}}}}if(trim(a)==""){e+="Comment cannot be blank.\n"}else if(a!="") {
                cerr = '';
		                for (var i = 0; i < a.length; i++) {
				                        if (iChars.indexOf(a.charAt(i)) != -1) {
							                                cerr = "Comment can't have special characters.\n";
											                        }
														                }
																                e += cerr;
																		        }if(trim(q.scode.value)==""){e+="Please enter Security Code."}if(e!=""){alert(e);return false}var c="DisplayAllComments";var p=q.path.value;var f=q.aid.value;var o=q.pid.value;var r=q.container_id.value;var t=p.replace(/\//g,"_");showLoader(s,h,j);var v=AjaxRequest.submit(q,{onSuccess:function(x){l=trim(x.responseText);responseData=l.split("~~||~~");if(l=="captcha_error"){hideLoader(s,h,j);alert("Error in processing security code.\nPlease enter new security code.");loadCaptcha("frmComments")}else{if(l=="ip_blocked"){hideLoader(s,h,j);closeDiv(r);createCookie("oneIndia-comments","1",300)}else{if(responseData[0]=="comment_inserted"){hideLoader(s,h,j);closeDiv(r);createCookie("oneIndia-comments","1",300);if(document.getElementById("no_comments_div")){document.getElementById("no_comments_div").style.display="none"}document.getElementById("actual-comments-div").innerHTML=responseData[2];if(u=="article"){document.getElementById("read-all-comments").innerHTML='&nbsp; &nbsp;[ <a id="read-all-link" href="/comment/'+k+"/"+w+"/"+getContentId()+'.html" target="_blank">Read All Comments</a> ]'}if(u=="article"){showCommentAlert("/comment/"+k+"/"+w+"/"+getContentId()+".html")}else{alert("Your comment has been added.")}window.setTimeout("getLatestComments()",100)}else{hideLoader(s,h,j);alert("Your comment has been added.\nIt will appear in few minutes.");closeDiv(r);createCookie("oneIndia-comments","1",300)}}}},onError:function(x){hideLoader(s,h,j)}});return false}function showLoader(c,b,a){c.style.display="none";b.style.display="none";a.style.display=""}function hideLoader(c,b,a){a.style.display="none";c.style.display="";b.style.display=""}function loadCaptcha(a){img_captcha="/common/captcha.php?rand="+Math.floor(Math.random()*99999999);document.getElementById(""+a+"").getElementsByTagName("img")[document.getElementById(""+a+"").getElementsByTagName("img").length-4].src=img_captcha;document.getElementById(""+a+"").getElementsByTagName("input")[document.getElementById(""+a+"").getElementsByTagName("input").length-4].value=""}function reportAbuse(b){var f="",g,l=false;if((b.abusecheck1.checked==true)||(b.abusecheck2.checked==true)||(b.abusecheck3.checked==true)||(b.abusecheck4.checked==true)||(b.abusecheck5.checked==true)||(b.abusecheck6.checked==true)){l=true}if(!l){f+="Please select the reason(s) that best describe your complaint\n"}if(trim(b.scode.value)==""){f+="Please enter Security Code."}if(f!=""){alert(f);return false}var c=b.aid.value;var h=b.container_id.value;var j=b.getElementsByTagName("input")[b.getElementsByTagName("input").length-3];var k=b.getElementsByTagName("input")[b.getElementsByTagName("input").length-1];var a=b.getElementsByTagName("span")[b.getElementsByTagName("span").length-1];showLoader(j,k,a);var e=AjaxRequest.submit(b,{onSuccess:function(m){g=m.responseText;if(g=="error"){hideLoader(j,k,a);alert("Please enter valid security code.")}else{if(g=="success"){hideLoader(j,k,a);closeDiv(h);alert("Your abuse report has been sent.")}else{if(g=="failed1"){hideLoader(j,k,a);alert("Failed to send your abuse report.")}else{hideLoader(j,k,a);alert("Failed to send your abuse report.")}}}},onError:function(m){hideLoader(j,k,a)}});return false}function getLatestComments(){var b="/scripts/comments/publish_recent_comments.php?domain=thatstamil.oneindia.in";var a=AjaxRequest.get({url:b,onSuccess:function(c){},onError:function(c){}});return false}function showComments(e,c,a){document.getElementById("preDiv").value="";var f="/new_comments/comments_"+e+c;var b=AjaxRequest.get({url:f,onSuccess:function(h){var g=document.getElementById("DisplayAllComments");if(g.style.display=="none"){g.style.display="block"}document.getElementById("DisplayAllComments").innerHTML=h.responseText;if(a>1){var j="Comment"+a}else{var j="Comment1"}readComments(j);document.location.href="#cmntTop"},onError:function(g){}});return false}function showCommentsForm(p,c,k,g,a,h,o){if(h==1&&document.getElementById("prePage")){var b=document.getElementById("prePage").value;readComments(b)}var j=document.getElementById("preDiv").value;if(j==""){document.getElementById("preDiv").value=g}else{closeDiv(j);document.getElementById("preDiv").value=g}var f=window.location.hostname;var l=getmetaContents("title");var m="/post_comments.php?path="+p+"&aid="+c+"&parent_id="+k+"&theDiv="+g+"&level_id="+a+"&pid="+h+"&wid="+o+"&cmnwebsite="+f+"&cmntitle="+l;var e=AjaxRequest.get({url:m,onSuccess:function(q){theFormTxt=q.responseText;document.getElementById(g).style.display="block";document.getElementById(g).innerHTML=theFormTxt;onLoad()},onError:function(q){alert(q.statusText+"\nContents="+q.responseText)}});return false}function showCommentsFormNew(p,c,k,g,a,h,o){if(h==1&&document.getElementById("prePage")){var b=document.getElementById("prePage").value;readComments(b)}var j=document.getElementById("preDiv").value;if(j==""){document.getElementById("preDiv").value=g}else{closeDiv(j);document.getElementById("preDiv").value=g}var f=window.location.hostname;var l=getmetaContents("title");var m="/post_comments.php?path="+p+"&aid="+c+"&parent_id="+k+"&theDiv="+g+"&level_id="+a+"&pid="+h+"&wid="+o+"&cmnwebsite="+f+"&cmntitle="+l;var e=AjaxRequest.get({url:m,onSuccess:function(q){theFormTxt=q.responseText;document.getElementById(g).style.display="block";document.getElementById(g).innerHTML=theFormTxt;onload=function(){setTimeout("onLoad()",100)}},onError:function(q){alert(q.statusText+"\nContents="+q.responseText)}});return false}var current_comment_box="";function showCommentsFormNew1(r,b,l,g,a,h,q,o,j,k,e){var f=window.location.hostname;var m=getmetaContents("title");var p="/scripts/comments/post_comments.php?path="+f+r+"&aid="+b+"&parent_id="+l+"&theDiv="+g+"&level_id="+a+"&pid="+h+"&wid="+q+"&cmnwebsite="+f+"&cmntitle="+m+"&art_id="+o+"&month="+j+"&year="+k+"&page_type="+e;var c=AjaxRequest.get({url:p,onSuccess:function(s){theFormTxt=s.responseText;if(current_comment_box!=""&&document.getElementById(current_comment_box)){document.getElementById(current_comment_box).innerHTML="";document.getElementById(current_comment_box).style.display="none"}if(current_comment_box!=""){}document.getElementById(g).style.display="block";document.getElementById(g).innerHTML=theFormTxt;current_comment_box=g;setTimeout("onLoad()",100)},onError:function(s){alert(s.statusText+"\nContents="+s.responseText)}});document.getElementById("newCommentFormDiv").style.display="none";return false}function readComments(a){if(document.getElementById("readComments")){document.getElementById("readComments").style.display="none";document.getElementById("CommentsInitial").style.display="none"}document.getElementById(a).style.display="block"}function makeOriginalFormBlank(){var a=document.getElementById("cmntsForm");a.getElementsByTagName("form")[0].name="";a.getElementsByTagName("form")[0].id="";a.getElementsByTagName("input")[1].value="";a.getElementsByTagName("input")[2].value="";a.getElementsByTagName("input")[3].value="";a.getElementsByTagName("input")[4].value="";a.getElementsByTagName("input")[5].value="";a.getElementsByTagName("input")[6].value="";a.getElementsByTagName("input")[7].value="";a.getElementsByTagName("input")[8].value="";a.getElementsByTagName("input")[9].value="";a.getElementsByTagName("input")[10].value="";a.getElementsByTagName("img")[a.getElementsByTagName("img").length-4].src=""}function checkSleep(){return true}function getmetaContents(e){var a=document.getElementsByTagName("meta");var c="";for(var b in a){if(a[b].name==e){c=a[b].content}}if((c=="")||(c=="undefined")){c=document.title}return c}var current_abuse_box="";function showReportAbuse(e,b,a,c){var f=Math.floor(Math.random()*999999);document.getElementById("abuspace").width=c;document.getElementById("abuaid").value=e;document.getElementById("abucontainer_id").value=a;document.getElementById("abucomment_id").value=b;document.getElementById("abucaptcha").src="/common/captcha.php?rand="+f;if(current_abuse_box!=""&&document.getElementById(current_abuse_box)){document.getElementById(current_abuse_box).style.display="none"}window.setTimeout("document.getElementById('"+a+"').innerHTML = document.getElementById('abuseForm').innerHTML; document.getElementById('"+a+"').style.display = 'block';",100);current_abuse_box=a}function hideComments(a){var b=document.getElementById(a);if(b.style.display=="block"){b.style.display="none"}}function switchPage(c){var a=document.getElementById("prePage").value;var b=document.getElementById("preDiv").value;if(b!=""){closeDiv(b)}if(document.getElementById){document.getElementById(c).style.display="block";document.getElementById(a).style.display="none"}else{if(document.layers){document.id.display="block";document.prepage.display="none"}else{document.all.id.style.display="block";document.all.prepage.style.display="none"}}document.getElementById("prePage").value=c;document.location.href="#cmntTop"}function closeDiv(a){document.getElementById(a).innerHTML=""}function textCounter(c,a,b){if(c.value.length>b){c.value=c.value.substring(0,b)}else{a.innerHTML=b-c.value.length}}function showFullComments(){if((location.hash!="")&&(location.hash!="#cmntTop")){readComments("Comment1")}}function newPopup(a){var b=document.createElement("form");b.method="GET";b.action=a;b.target="_blank";document.body.appendChild(b);b.submit();window.focus()}function iePopup(){if(document.getElementById("read-all-link")&&(document.getElementById("read-all-link").href!="")){document.getElementById("read-all-link").click();window.focus()}else{setTimeout("iePoupup()",100)}}var comment_alert_tab=new Image();comment_alert_tab.src="/img/comments/alert.jpg";var comment_alert_icon=new Image();comment_alert_icon.src="/img/comments/alert-icon.jpg";function showCommentAlert(b){var a=window.center({width:270,height:115});var c=document.createElement("div");c.setAttribute("id","alertDiv");c.style.verticalAlign="middle";c.style.textAlign="center";c.style.background="#ece9d8";c.style.position="absolute";c.style.top=a.y+"px";c.style.left=a.x+"px";c.style.width="270px";c.style.display="none";c.style.height="115px";c.style.padding="0px";c.style.font="normal 12px arial,verdana";c.innerHTML='<img id="alert-tab-img" src="/img/comments/alert.jpg" border="0" /><div id="info-box" style="margin-top: -5px;height: 86px;padding: 0px;border: solid 2px #0047df;width: 266px;"><div id="alert-icon-div" style="float: left;"><img id="alert-icon-img" src="/img/comments/alert-icon.jpg" border="0" style="float: left;padding-top: 10px;padding-bottom: 5px;padding-right:10px;padding-left: 10px;"  /></div><div id="comment-alert-msg-div" style="float: left;padding-top:20px;font: normal 12px arial;">Your comment has been added.</div><div id="clear-div" style="clear: both;"></div><div id="alert-form-div" style="padding-top: 5px;"><form><input type="button" style="width: 73px;height: 23px;font: normal 11px arial;" name="alert_ok" value="OK" onclick="callPopup(\''+b+"');\" /></form></div></div>";document.body.appendChild(c);document.getElementById("alert-tab-img").src=comment_alert_tab.src;document.getElementById("alert-icon-img").src=comment_alert_icon.src;document.body.setAttribute("onClick","callPopup('"+b+"');");document.getElementById("alertDiv").style.display="block"}function callPopup(a){if(ie){iePopup()}else{newPopup(a)}var b=document.getElementById("alertDiv");document.body.removeChild(b);document.body.setAttribute("onClick","");return false}function setReadAllLink(){if(document.getElementById("article_info_form")){var e=document.getElementById("article_info_form");var a=e.content_id.value;var b=document.getElementById("read-all-comments");var c=document.getElementById("read-all-link");c.href=(c.href).replace(".html",a+".html");b.style.display="block"}}function setTopReadAllLink(){var a=document.getElementById("read-all-comments").innerHTML;a=a.replace("[ ","");a=a.replace(" ]","");a=a.replace("Read All Comments","<b>Post/Read All Comments</b>");document.getElementById("top_read_all_comments").innerHTML=a}function getContentId(){if(document.getElementById("article_info_form")){return document.getElementById("article_info_form").content_id.value}}function hookEvent(b,c,a){if(b.attachEvent){b.attachEvent("on"+c,a)}else{b.addEventListener(c,a,false)}};
