if(self==top)self.location.replace("../");(function(){var f=location.search.substr(1),msgboard={};msgboard.loadMsg=function(d,e){if(d>0)$.ajax({type:"GET",dataType:"string",url:"view.asp?page="+d+"&cache="+$.tools.randNum(),error:function(a,b,c){$.alert({content:"无法连接到服务器！<br/>ErrInfo:"+b,autoClose:false})},beforeSend:function(){if(!e)$.loading({title:"稍候",content:"正在加载信息，请稍候……"})},success:function(b){if(!e)$.closeMsgbox();$("#view").html(b).find("#uMsgList").find(".uMsgBox:odd").addClass("msg_over").end().find(".revertView").click(function(){msgboard.loadRevertMsg($(this).parents(".uMsgBox").attr("rel"));return false}).end().find(".revertLink").click(function(){var a=$(this).attr("rel"),block=$(this).parents(".uMsgBox").find("div").clone(),mainContent=$("<div></div>").append(block[0]).append(block[1]);$("#ID").val(a);$("#orgMsg").html(mainContent.html()).show();$("#menu").tabs('select',1);$("#newMsg").show();window.setTimeout(function(){$("#uMsg")[0].focus()},100);return false}).end().end().find("#uMsgPageLead").find(".goPage").click(function(){msgboard.loadMsg(parseInt($(this).attr("rel")),false);return false}).end().find("#msg_prev").click(function(){var a=parseInt($("#onPage").text());if(a==1)$.alert("已经是第一页了！");else msgboard.loadMsg(a-1,false);return false}).end().find("#msg_next").click(function(){var a=parseInt($("#onPage").text());if(parseInt($(this).prev().text())==a)$.alert("已经是最后一页了！");else msgboard.loadMsg(a+1,false);return false}).end().end()}})};msgboard.loadRevertMsg=function(b){var c=$(".uMsgBox[rel="+b+"] .revertMsg"),onShow=$(".revertMsg:visible");if(c[0]!=onShow[0]){$.get("read.asp?id="+b+"&cache="+$.tools.randNum(),function(a){if(a!="0"){if(onShow[0]){onShow.hide("fast",function(){c.html(a).show("normal")})}else{c.html(a).show("normal")}}})}else onShow.hide("normal")};msgboard.submit=function(){var d=$.trim($("#uName").val()),uEmail=$.trim($("#uEmail").val()),uMsg=$.trim($("#uMsg").val()),id=$.trim($("#ID").val()),hasError=false,t1=t2=tmp="";if(d==""){d="匿名";$("#uName").val(d)}if(uEmail==""){uEmail="someOne@someSite.com";$("#uEmail").val(uEmail)}if(!$.tools.CheckeMail(uEmail)){$.alert({title:"格式错误",content:"电子邮件格式错误！",autoClose:false,onOK:function(){$("#uEmail")[0].select();$("#uEmail")[0].focus()}});hasError=true}if(uMsg==""&&!hasError){$.alert({title:"不能为空",content:"反馈内容不能为空！",autoClose:false,onOK:function(){$("#uMsg")[0].focus()},onClose:function(){$("#uMsg")[0].focus()}});hasError=true}if(!hasError)$.ajax({type:"POST",url:"update.asp",dataType:"string",data:{"uName":d,"uEmail":uEmail,"uMsg":uMsg,"id":id},error:function(a,b,c){$.closeMsgbox();$.alert({contnet:"无法连接到服务器！<br>ErrInfo:"+b,autoClose:false})},beforeSend:function(){$.loading({title:"稍候",content:"正在保存信息，请稍候……"})},success:function(a){$.closeMsgbox();if(a=="ok"){$.confirm({title:"谢谢",content:"反馈信息已经保存！<br>非常感谢您的支持！",autoClose:false,yesStr:"查看留言",noStr:"关闭",onYes:function(){$.closeMsgbox();msgboard.loadMsg(1,true);msgboard.resetPage();$("#menu").tabs("select",0)},onNo:function(){parent.$.closeMsgbox()}})}else $.alert({content:a,autoClose:false})}})};msgboard.resetPage=function(){$("#uName,#uEmail,#uMsg,#ID").val("");$("#orgMsg,#newMsg").hide();$("#msg_counter input").val(1000)};msgboard.resetForm=function(){$("#uName,#uEmail,#uMsg").val("");$("#msg_counter input").val(1000);$("#uMsg")[0].focus()};msgboard.asNew=function(){$("#ID").val("");$("#orgMsg,#newMsg").hide();$("#uMsg")[0].focus()};msgboard.setHeight=function(){var h=$("#foot").offset().top-$("#menu").offset().top-40;$("#view,#put").height(h+"px")};$(document).ready(function(){switch(f){case"Advertise":$("#logo")[0].className="adv";$("#typeInfo").html("互助互利才是互联网永恒的商业模式！");break;case"ReportBugs":break;case"Contact":$("#logo")[0].className="con";$("#typeInfo").html("这是我们<a href='http://www.unihan.com.cn/map/' target='_blank'>公司的坐落</a>，这是我们的<a href='http://www.unihan.com.cn/ContactUs.html' target='_blank'>联系方式</a>。");break}$("#menu").tabs({selected:1,show:function(){msgboard.setHeight()}});msgboard.loadMsg(1,true);$("#putBtn a").each(function(){var a=this.hash;switch(a){case"#submit":$(this).click(function(){msgboard.submit();return false});break;case"#reset":$(this).click(function(){msgboard.resetForm();return false});break;case"#newMSg":$(this).click(function(){msgboard.asNew();return false});break}});var b=function(e){var a=e.keyCode,obj=$("#uMsg"),ziCounter=$("#msg_counter input")[0],n=obj.val().length;if(n>1000){obj.val(obj.val().substr(0,1000));ziCounter.value=0;return false}else{ziCounter.value=1000-n;return true}};$("#uMsg").change(function(e){return b(e)}).keydown(function(e){return b(e)}).keyup(function(e){return b(e)}).get(0).focus();window.onresize=function(){msgboard.setHeight()}})})();