function $F(A){return $(A).value;}var cc_url=window.location.href;if(window!=window.parent&&cc_url.indexOf("iframe")==-1){if("trident"==Browser.Engine.name){window.parent.navigate(cc_url);document.execCommand("stop");}else{window.parent.location.href=cc_url;window.stop();}}function checkFormData(){$("submit").value="数据正在提交";$("submit").disabled=true;return true;}function imgRefresh(A){$("vimg").src="/vimg.php?n="+A+"&"+Math.random();}function cnLength(B){if(""==B){return 0;}var A=B.match(/[^\x00-\xff]/ig);return B.length+(A==null?0:A.length);}var recent_visit_num=15;function recentVisitUpdate(D){if(!comic_id){return ;}var C=Cookie.read("ktxprecentvisit");var B=0;if(C){var A=JSON.decode(C);A=A.filter(function(F,E){return !!(F.a!=comic_id);});B=A.length;if(recent_visit_num<=B){A=A.filter(function(F,E){return(E>B-recent_visit_num);});B=A.length;}}else{var A=new Array();}A[B]=new Object();A[B].a=comic_id;A[B].b=comic_name;A[B].c=comic_url;if(1==D){A[B].d=chapter_name;A[B].e=window.location.href;A[B].f=1;}Cookie.write("ktxprecentvisit",JSON.encode(A),{path:"/",duration:365});}function recentVisitShow(){var F=$("recent-visit");if(!F){return false;}var C=Cookie.read("ktxprecentvisit");var E="";if(C){var B=JSON.decode(C);var A=B.length;for(var D=(A-1);D>=0;D--){E+="<li>";E+='<a href="'+B[D].c+'" title="'+B[D].b+'" target="_blank">'+B[D].b+"</a>";if(B[D].e){E+='浏览到<a href="'+B[D].e+'" title="'+B[D].d+'" target="_blank">'+B[D].d+"</a>";}E+="</li>";}if(recent_visit_num>A){E+=F.innerHTML;}F.innerHTML=E;}}function addFavorite(B,A){if("undefined"==typeof (B)){B=location.href;}if("undefined"==typeof (A)){A=location.href;}if("trident"==Browser.Engine.name){window.external.addFavorite(A,B);}else{if("gecko"==Browser.Engine.name){window.sidebar.addPanel(B,A,"");}else{}}}function panelSwitch(D,C,A){for(var B=1;B<=C;B++){$(D+B).className="";$(D+"list"+B).setStyle("display","none");}$(D+A).className="active";$(D+"list"+A).setStyle("display","block");}function searchCheck(){if($F("keyword")==""){return false;}if($F("keyword")=="请输入搜索内容"){return false;}return true;}function changeSearchBntText(A){$("searchbutton").value=A;}var searTextClicked=false;var clickedSearchItem=false;function showSearchItem(A){if(1==A){document.body.onmousedown=function(){showSearchItem(0);};if(!searTextClicked){if("请输入搜索内容"==$F("keyword")){$("keyword").value="";}$("search-item").setStyle("display","block");setPosition("keyword","search-item");searTextClicked=true;}}if(0==A){if(clickedSearchItem){clickedSearchItem=false;return ;}if(""==$F("keyword")){$("keyword").value="请输入搜索内容";}$("search-item").setStyle("display","none");searTextClicked=false;}return false;}function setPosition(A,B){var E=$(A);var G=$(B);var D=E.offsetLeft;var C=E.offsetTop;while(E=E.offsetParent){D+=E.offsetLeft;C+=E.offsetTop;}if(window.ie){D+=1;C+=1;}var F=$(A).offsetHeight;G.setStyles({left:D,top:C+F,display:"block"});}function showFav(){var A="<a title=\"收藏到QQ书签\" href=\"javascript:void(0);\" onclick=\"window.open('http://shuqian.qq.com/post?from=3&title='+encodeURIComponent(document.title)+'&uri='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','fav_qq','width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');return false;\" style=\"background:url('/images/fav/qq.gif') no-repeat 0px -1px;padding:2px 2px 0px 20px;\">收藏到QQ书签</a>";var C="<a title=\"添加到雅虎收藏\" href=\"javascript:void(0);\" onclick=\"window.open('http://myweb.cn.yahoo.com/popadd.html?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title), 'fav_yahoo','scrollbars=yes,width=440,height=440,left=80,top=80,status=yes,resizable=yes');return false;\" style=\"background:url('/images/fav/yahoo.gif') no-repeat 0 2px;padding:2px 2px 0px 16px;\">添加到雅虎收藏</a>";var B="<a title=\"添加到百度搜藏\" href=\"javascript:void(0);\" onclick=\"window.open('http://cang.baidu.com/do/add?it='+encodeURIComponent(document.title.substring(0,76))+'&iu='+encodeURIComponent(location.href)+'&fr=ien#nw=1','fav_baidu','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes');return false;\" style=\"background:url('/images/fav/baidu.jpg') no-repeat 0px -1px;padding:2px 2px 0px 20px;\">添加到百度搜藏</a>";document.write(A+"&nbsp;&nbsp;"+B+"&nbsp;&nbsp;"+C);}function digger(){if(!comic_id){return false;}if(Cookie.read("digg"+comic_id)){alert("您已经顶过啦，请明天再顶吧！");return false;}var A=new Request({method:"post",url:"/ajax.php",data:{act:"digg",id:comic_id},onFailure:function(){diggerStatus("error");},onComplete:function(){diggerStatus(this.response.text);}}).send();}function diggerStatus(A){if("error"==A){alert("请求失败，请稍后再试！");return false;}if("succeed"!=A){alert("未知错误，请稍后再试！");return false;}Cookie.write("digg"+comic_id,1,{duration:1});$("digg_num").innerHTML=$("digg_num").innerHTML.toInt()+1;}function bookFavorite(){if(!comic_id){return false;}if(!Cookie.read("MH_NICKNAME")){alert("您还未登录，登录后才能拥有您的书架！");return false;}var A=new Request({method:"post",url:"/ajax.php",data:{act:"favorite",id:comic_id},onFailure:function(){bookFavoriteStatus("error");},onComplete:function(){bookFavoriteStatus(this.response.text);}}).send();}function bookFavoriteStatus(A){if("error"==A){alert("请求失败，请稍后再试！");return false;}if("notlogin"==A){alert("您还未登录，登录后才能拥有您的书架！");return false;}if("exists"==A){alert("该漫画已存在您的书架中，不能重复添加！");return false;}if("succeed"!=A){alert("未知错误，请稍后再试！");return false;}else{if($("book-favorite")){$("book-favorite").innerHTML="加入成功";$("book-favorite").onclick="return false;";}alert("恭喜，该漫画已成功放入您的书架！");}}function chapterHistory(){if(!chapter_id){return false;}if(!Cookie.read("MH_NICKNAME")){alert("您还未登录，登录后才能保存当前浏览位置！");return false;}var A=new Request({method:"post",url:"/ajax.php",data:{act:"history",bid:comic_id,id:chapter_id,page:current_page},onFailure:function(){chapterHistoryStatus("error");},onComplete:function(){chapterHistoryStatus(this.response.text);}}).send();}function chapterHistoryStatus(A){if("error"==A){alert("请求失败，请稍后再试！");return false;}if("notlogin"==A){alert("您还未登录，登录后才能保存当前浏览位置！");return false;}if("succeed"!=A){alert("未知错误，请稍后再试！");return false;}else{if($("chapter-history")){$("chapter-history").innerHTML="记录成功";$("chapter-history").onclick="return false;";}alert("恭喜，浏览记录保存成功！");}}function loadUserInfo(){var A=Cookie.read("MH_NICKNAME");if(A){$("top-user-info").innerHTML='<strong class="green">'+A+'</strong>，您好，欢迎回来！进入我的<a href="http://my.'+site_domain+'">用户中心</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://my.'+site_domain+'/login.php?act=logout">退出登录</a>';}else{$("top-user-info").innerHTML='游客，您好！&nbsp;<a href="http://my.'+site_domain+'/login.php">已注册，登录</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://my.'+site_domain+'/register.php">新用户注册</a>';}}