function set_var(a){return typeof(a)!="undefined"&&a!=""&&a!=0&&a!=false?a:""}function is_element(a){return document.getElementById(a)?1:0}function _G(a){return document.getElementById(a)}function redirect(a){window.location.replace(a)}function get_ext(a){return a.substr(a.lastIndexOf(".")+1,a.length).toLowerCase()}function is_image(a){return $.inArray(get_ext(a),["jpg","gif","png","bmp","jpeg"])!=-1}function preview(d,c,a,b){b=b||window.event;if(!a){var a=400}if(!d){return $RN("img_preview")}setXY("img_preview",a,null,b);_G("img_preview").style.display=(d||c)?"":"none";$("#img_preview").empty().css({width:a+"px",overflow:"hidden","text-align":"left","line-height":"18px",background:"#FEFEF3",border:"1px solid #ffc",padding:"10px"});if(!is_image(get_ext(d))){return}if(d){$("#img_preview").html(insert_img(decodeURIComponent(d),a))}if(c){$("#img_preview").append("<p>"+(decodeURIComponent(c).replace(/\+/g," "))+"</p>")}}function check_all(b,a){if(a){(b?$("#"+b+' input[type="checkbox"]'):$('form input[type="checkbox"]')).each(function(){$(this).attr("checked",(a?true:false))})}else{(b?$("#"+b+' input[type="checkbox"][name!="chkall"]'):$('form input[type="checkbox"][name!="chkall"]')).each(function(){$(this).attr("checked",($(this).attr("checked")?false:true))})}}function show_hide(a){return _G(a).style.display=_G(a).style.display=="none"?"":"none"}function $RN(a){if(is_element(a)){_G(a).parentNode.removeChild(_G(a))}}function $CE(a){return document.createElement(a)}function $RC(b,a){return _G(b).removeChild(_G(a))}if(typeof(decode)!="function"){function decode(a){return decodeURIComponent(a).replace(/\+/g," ")}}function set_tr_class(b){if(!b&&is_element("mytable")){b="mytable"}if(!$("#"+b+" tr")){return false}$("#"+b+" tr:odd[class!='title'][class!='tfoot']").addClass("altbg1");$("#"+b+" tr:even[class!='title'][class!='tfoot']").addClass("altbg2");var a;$("#"+b+" tr").each(function(c){$(this).hover(function(){$(this).addClass("altbg3")},function(){$(this).removeClass("altbg3")})})}function set_td_class(a){if(!a&&is_element("mytable")){a="mytable"}if(!$("#"+a+" td")){return false}$("#"+a+' td[class!="tfoot"][class!="header"]').each(function(b){if($(this).attr("colspan")>1){return true}if(b%2==0){$(this).addClass("subject")}})}function toggle_select(){$("select").each(function(){$(this).toggle()})}function insert_img(c,b){var d='<img src="'+c+'" ';var a=new Image();a.src=c;if(a.width>b||a.height>b){d+=((a.width/a.height)>1?"width":"height")+'="'+b+'" '}d+="/>";return d}function get_wh(b){var a=width=null;if(b){if(window.innerWidth){width=window.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth){width=document.documentElement.clientWidth}else{if(document.body&&document.body.clientWidth){width=document.body.clientWidth}}}return width}else{if(window.innerHeight){a=window.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){a=document.body.clientHeight}}}return a}}function setXY(a,k,d,f){f=f||window.event;if(!is_element(a)){$("body").append('<div id="'+a+'"></div>')}$("#"+a).css({width:k+"px",height:(d?d+"px;":"auto"),position:"absolute"});var n=4;var m=4;var b=0;var o=0;var l=0;var j=0;var i=0;var g=0;if(window.innerWidth){b=window.innerWidth-18}else{if(document.documentElement&&document.documentElement.clientWidth){b=document.documentElement.clientWidth}else{if(document.body&&document.body.clientWidth){b=document.body.clientWidth}}}if(window.innerHeight){o=window.innerHeight-18}else{if(document.documentElement&&document.documentElement.clientHeight){o=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){o=document.body.clientHeight}}}if(typeof window.pageXOffset=="number"){l=window.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollLeft){l=document.documentElement.scrollLeft}else{if(document.body&&document.body.scrollLeft){l=document.body.scrollLeft}else{if(window.scrollX){l=window.scrollX}}}}if(typeof window.pageYOffset=="number"){j=window.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){j=document.documentElement.scrollTop}else{if(document.body&&document.body.scrollTop){j=document.body.scrollTop}else{if(window.scrollY){j=window.scrollY}}}}i=f.pageX?f.pageX:f.clientX+l;g=f.pageY?f.pageY:f.clientY+j;var c=_G(a);if(i+c.offsetWidth+n>b+l){i=i-c.offsetWidth-n;if(i<0){i=0}}else{i=i+n}if(g+c.offsetHeight+m>o+j){g=g-c.offsetHeight-m;if(g<j){g=o+j-c.offsetHeight}}else{g=g+m}c.style.left=i+"px";c.style.top=g+"px"}function top_window(){var a=window.parent;if(window==a){return window}while(a&&a.parent!=a){try{if(a.parent.document.domain!=document.domain){break}if(a.parent.document.getElementsByTagName("frameset").length>0){break}}catch(b){break}a=a.parent}return a}function show_loading(a){top_window().$("#loading").show();if(a){top_window().$("#loading").html('<img src="'+site_root+"stuff/img/default/loading"+a+'.gif" align="absmiddle" />')}}function hide_loading(){top_window().$("#loading").hide()}function big_loading(a){var b="big_loading_div";if(!a){a="\u6570\u636e\u8f7d\u5165\u4e2d..."}if(!is_element(b)){$("body").append('<div id="'+b+'"></div>')}$("#"+b).css({left:(get_wh(1)/2-225)+"px",top:(get_wh()/3+72)+"px"}).show().html("<span>"+a+"</span>")}function hide_big_loading(){$("#big_loading_div").empty().hide()}function show_msg(b,a){top_window().$("#message").show().html('<p><span class="icon"></span>'+b+"</p>");if(a){hide_msg(a)}}function hide_msg(a){if(a){setTimeout(function(){top_window().$("#message").empty().hide()},a)}else{top_window().$("#message").empty().hide()}}function add_quite_operation(a){if(!is_element(a)){return false}return top_window().$("#quick_operation").html($("#"+a).html())}function is_check(b){var a=0;b=b?"#"+b:"form";$(b+' input[type="checkbox"][name!="chkall"]').each(function(){if($(this).attr("checked")){a=1;return false}});return a}function datepicker(){$(function(){$.datetimepicker.setDefaults($.extend({showMonthAfterYear:false},$.datetimepicker.regional["zh-CN"]));$(".datepicker").datetimepicker({showButtonPanel:true,altFormat:"yy-mm-dd",dateFormat:"yy-mm-dd",timeFormat:" hh:ii:ss",changeMonth:true,changeYear:true,showOn:"button",buttonImage:site_root+"stuff/img/icon/calendar.gif",buttonImageOnly:true})})}function png(){if(!$.browser.msie){return}var a=parseInt((navigator.userAgent.match(/msie\s+(\d+)/i))[1]);if(a>6){return}$("img").each(function(){if(get_ext($(this).attr("src"))=="png"){$(this).css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+$(this).attr("src")+")",width:$(this).attr("width")+"px",height:$(this).attr("height")+"px"});$(this).attr("src",site_root+"stuff/img/admin/none.gif")}})}function make_select(a,d,c,f,b){var e='<select name="'+d+'" '+(f?f:"")+">"+(b?b:"");$.each(a,function(g,h){e+="<option value="+h+(h==c?" selected":"")+">"+g+"</option>"});e+="</select>";return e}function show_tip(a){$("#"+a).dialog("destroy").dialog({title:"\u5c0f\u8d34\u58eb",bgiframe:true,resizable:false,autoOpen:false,width:500}).dialog("open")}function resize_img(c,a){var b=c.width;var d=c.height;if(a&&b>a){c.style.width=a+"px";c.style.height=a/b*d+"px";c.alt+=" [\u70b9\u51fb\u56fe\u7247\u5728\u65b0\u7a97\u53e3\u6253\u5f00]";c.onclick=function(){window.open(this.src)};c.ondblclick=function(){c.style.display="none"};c.style.cursor="pointer";return}};
