function dropdown_top(){$('.btn-group').on('show.bs.dropdown',function(){var $_ul=$(this).children(".dropdown-menu");var $_button=$(this).children(".dropdown-toggle");var ulOffset=$(this).offset();var spaceUp=ulOffset.top-$_button.height()-$_ul.height();var spaceDown=$(window).height()-(ulOffset.top+$_ul.height());if(spaceDown<0&&(spaceUp>=0||spaceUp>spaceDown)){$(this).addClass("dropup");}}).on("hidden.bs.dropdown",function(){$(this).removeClass("dropup");});}
var fixHelper=function(e,ui){ui.children().each(function(){$(this).width($(this).width());});return ui;};function clearAddtype(){$(".btn_addtype").removeClass('disabled').removeAttr('disabled');$(".addtype").remove();return false;}
function closewindows_mess(){$(window).bind('beforeunload',function(){return espcms_lanpack_close_mess;});}
function banpageKey(){return false;$(document).bind("contextmenu",function(){return false;});$(document).bind("selectstart",function(){return false;});$(document).keydown(function(){return key(arguments[0]);});}
function espcms_are_loading(){var dialog_html='<div id="espcms_are_loading" title="'+espcms_lanpack_loading_title+'">'+'<p><span class="espcms_icon_fa espcms_icon_fa-spinner espcms_icon_fa-spin" style="float:left;margin:0 7px 0px 0;"></span>'+espcms_lanpack_loading+'</p>'+'</div>';$("body").append(dialog_html);$("#espcms_are_loading").dialog({resizable:false,width:220,height:100,modal:true,dialogClass:"no-close",close:function(){$(this).remove();}});}
function espcms_public_dialog(domname,botton,width){width=width?width:720;$("#"+domname).dialog({resizable:false,width:width,modal:true,dialogClass:"no-close",open:function(){$(this).parent().focus();},buttons:botton,close:function(){$(this).remove();}});}
function espcms_public_dialog_mess(mess,domname,botton,width,format_array){width=width?width:720;if(format_array){mess=mess.format(format_array);}
var dialog_html='<div id="'+domname+'" title="'+espcms_dialog_title+'" class="displaynone">'+'<p><span class="espcms_icon_fa espcms_icon_fa-exclamation-circle" style="float:left;margin:0 3px 0px 0;padding-top:4px;"></span>'+mess+'</p>'+'</div>';$("body").append(dialog_html);espcms_public_dialog(domname,botton,width);}
String.prototype.format=function(args){var result=this;if(arguments.length<1){return result;}
var data=arguments;if(arguments.length==1&&typeof(args)=="object"){data=args;}
for(var key in data){var value=data[key];if(undefined!=value){result=result.replace("{"+key+"}",value);}}
return result;}
function loading(formname,dbcount){var listurl=$('#listurl').val();var loadname=$('#loadname').val();var page_botton=$('#page_botton').val();var per_page_num=$('#per_page_num').val();var num_display_entries=$('#num_display_entries').val();var sum_db_count=parseInt($('#sum_db').val());var sum_db=parseInt(dbcount)>0?sum_db_count-dbcount:sum_db_count;if(parseInt(dbcount)>0){$('#sum_db').val(sum_db);}
var sum_page=$('#sum_page').val();var now_page=$('#now_page').val();var sum_select_show=$('#sum_select_show').val();$('#espcms_select_botton').select_checkbox('resume');pageload(listurl,loadname,page_botton,per_page_num,sum_db,sum_page,now_page,formname,espcms_page_message,sum_select_show,num_display_entries);}
function add_loading(formname){var listurl=$('#listurl').val();$.ajax({type:"get",url:listurl,data:{'searchlist':'true'},dataType:'json',global:false,success:function(data){$('#sum_db').val(data['sum_db']);$('#sum_page').val(data['sum_page']);loading(formname);}});}
function espcms_url_array(str){var newArray=new Array();var urlarrayStr=str.split("&");var valname=null;for(var i=0;i<urlarrayStr.length;i++){valname=urlarrayStr[i].split("=");newArray[valname[0]]=decodeURIComponent(valname[1]);}
return newArray;}
function espcms_url_long_array(url){if(url===''){return false;}
var num=url.indexOf("?");url=url.substr(num+1);var arr=url.split("&");var theRequest=new Object();var urlArray;for(var i=0;i<arr.length;i++){urlArray=arr[i].split("=");if(urlArray.length>0){theRequest[urlArray[0]]=(urlArray[1]);}}
return theRequest;}
function espcms_combine_url(queryString,url){if(queryString===''||url===''){return false;}
var urlArray=url.split('?');var urlQueryArray=espcms_url_long_array(url);var queryStringArray=espcms_url_long_array(queryString);var newArray=new Array();var i=0;for(var key in urlQueryArray){if(queryStringArray[key]||queryStringArray[key]===''){delete urlQueryArray[key];}else{newArray[i]=key+'='+urlQueryArray[key];i++;}}
for(var key in queryStringArray){if(queryStringArray[key]&&queryStringArray[key]!=='undefined'&&queryStringArray[key]!=='false'){newArray[i]=key+'='+encodeURI(queryStringArray[key]);i++;}}
var combined=urlArray[0]+"?";var keyStr=newArray.join('&');combined+=keyStr;return combined;}
function search_list(queryString,formName,out_type){var listtype=out_type?true:false;var listurl=$('#listurl').val();var loadingurl=espcms_combine_url(queryString,listurl);$('#listurl').val(loadingurl);if(listtype){loading(formName);}else{$.ajax({type:"get",url:loadingurl,data:{'searchlist':'true'},dataType:'json',global:false,success:function(data){$('#sum_db').val(data['sum_db']);$('#sum_page').val(data['sum_page']);$('#now_page').val(0);loading(formName);}});}}
function select_id_update(inputname,value,update_type){var select_id_list=$(inputname).val();if(select_id_list){var select_id_list_array=select_id_list.split(',');if(update_type==='add'){select_id_list_array.push(value);select_id_list_array=unique(select_id_list_array);select_id_list=select_id_list_array.join(',');}else if(update_type==='del'){select_id_list_array.remove(value);select_id_list_array=unique(select_id_list_array);select_id_list=select_id_list_array.join(',');}
$(inputname).val(select_id_list);}else{$(inputname).val(value);}}
function un_repeat_array(arr1,arr2){if(arr1.length<=0||arr2.length<=0){return false;}
var new_array_info=new Array();for(var i=0;i<arr1.length;i++){if(!in_array(arr1[i],arr2)){new_array_info.push(arr1[i]);}}
return new_array_info.length>0?new_array_info:false;}
function unique(arr){var result=[],hash={};for(var i=0,elem;(elem=arr[i])!=null;i++){if(!hash[elem]){result.push(elem);hash[elem]=true;}}
return result;}
Array.prototype.indexOf=function(val){for(var i=0;i<this.length;i++){if(this[i]==val)
return i;}
return-1;};Array.prototype.remove=function(val){var index=this.indexOf(val);if(index>-1){this.splice(index,1);}};Array.prototype.deljson=function(val){for(var i=0;i<this.length;i++){if(this[i].id==val){this.splice(i,1);}}};function dialog_delete_element(val,inputname,elementID){$('#'+elementID).remove();if(val){select_id_update(inputname,val,'del');}}
function into_input_value(val,inputElementID,isappend){var elementName='#'+inputElementID;if(isappend){var append_val=$(elementName).val();var news_str=append_val?append_val+','+val:val;$(elementName).val(news_str);}else{$(elementName).val(val);}}
function repce_div_pic_input(filename,elementID,inputElementID){var elementName='#'+elementID;var inputElementName='#'+inputElementID;var elementList='#'+elementID+'_list';var elementUL_name=elementID+'_ul';$(elementName).hide();var $picUL=$('<ul class="espcms_pic_onlyList" id="'+elementUL_name+'"></ul>').appendTo(elementList);var $li=$('<li><p class="uploadimgWrap"><img src="'+filename+'" width="100" height="100"></p></li>').appendTo($picUL);var $btns=$('<div class="upload_file_panel"><span class="cancel"></span></div>').appendTo($li);$li.on('mouseenter',function(){$btns.stop().animate({height:30});});$li.on('mouseleave',function(){$btns.stop().animate({height:0});});$btns.on('click','span',function(){$picUL.remove();$(inputElementName).val('');$(elementName).show();return true;});}
$.fn.picInputClear=function(){var $li=$(this);$($li).mouseenter(function(){var clickname=$(this);var input_id=$(this).attr('input_id');var select_id=$(this).attr('select_id');var $btns=$(this).find('.upload_file_panel');$btns.stop().animate({height:30});$(this).on('mouseleave',function(){$btns.stop().animate({height:0});});$btns.on('click','span',function(){clickname.remove();$('#'+input_id).val('');$('#'+select_id).show();return true;});});};function espcms_print_r(theObj){var retStr='';if(typeof theObj=='object'){for(var p in theObj){if(typeof theObj[p]=='object'){retStr+='['+p+'] => '+typeof(theObj)+'; ';retStr+=espcms_print_r(theObj[p])+'; ';}else{retStr+='['+p+'] => '+theObj[p]+'; ';}}}
return retStr;}
function getFileIcon(url){var ext=url.substr(url.lastIndexOf('.')+1).toLowerCase(),maps={"rar":"icon_rar.gif","zip":"icon_rar.gif","tar":"icon_rar.gif","gz":"icon_rar.gif","bz2":"icon_rar.gif","doc":"icon_doc.gif","docx":"icon_doc.gif","pdf":"icon_pdf.gif","mp3":"icon_mp3.gif","xls":"icon_xls.gif","chm":"icon_chm.gif","ppt":"icon_ppt.gif","pptx":"icon_ppt.gif","avi":"icon_mv.gif","rmvb":"icon_mv.gif","wmv":"icon_mv.gif","flv":"icon_mv.gif","swf":"icon_mv.gif","rm":"icon_mv.gif","exe":"icon_exe.gif","psd":"icon_psd.gif","txt":"icon_txt.gif","jpg":"icon_jpg.gif","png":"icon_jpg.gif","jpeg":"icon_jpg.gif","gif":"icon_jpg.gif","ico":"icon_jpg.gif","bmp":"icon_jpg.gif"};return maps[ext]?maps[ext]:maps['txt'];}
function isArray(source){return'[object Array]'==Object.prototype.toString.call(source);}
function in_array(search,array){for(var i in array){if(array[i]==search){return true;}}
return false;}
function refreshURL(id,name){var listurl=$('#listurl').val();var queryString=name+'='+id;var refrshurl=espcms_combine_url(queryString,listurl);$('#listurl').val(refrshurl);loading('ajax_usermanage_list');}
function clear_value(unvalue,original_value){if(!original_value||unvalue){return original_value;}
var original_value_array=$.isArray(original_value)?original_value:original_value.split(',');for(var i=0;i<original_value_array.length;i++){if(parseInt(original_value_array[i])==parseInt(unvalue)){original_value_array.splice(i,1);}}
original_value=original_value_array.join(',');return original_value;}
function espcms_redirection(){if(seconds<=0){window.clearInterval();return;}
seconds--;$("#spanSeconds").html(seconds);if(seconds===0){location.href=defaultUrl;}}
function ScreenSaver(settings){this.settings=settings;this.nTimeout=this.settings.timeout;document.body.screenSaver=this;document.body.onmousemove=ScreenSaver.prototype.onevent;document.body.onmousedown=ScreenSaver.prototype.onevent;document.body.onkeydown=ScreenSaver.prototype.onevent;document.body.onkeypress=ScreenSaver.prototype.onevent;var pThis=this;var f=function(){pThis.timeout();};this.timerID=window.setTimeout(f,this.nTimeout);}
function initScreenSaver(){espcms_login_timeout=new ScreenSaver({timeout:timeout});}
ScreenSaver.prototype.signal=function(){if(this.saver){this.saver.stop();}
window.clearTimeout(this.timerID);var pThis=this;var f=function(){pThis.timeout();};this.timerID=window.setTimeout(f,this.nTimeout);};ScreenSaver.prototype.onevent=function(e){if(!timecookiekey){return false;}
this.screenSaver.signal();};function espcms_addFilelist(elementID,html){var elementName='#'+elementID;$(elementName).append(html);$("[placeholder]").tooltip();$('.file_del').click(function(){var deltrname=$(this).parents('tr');deltrname.remove();});}
function fmoney(s,n){var n=n>0&&n<=20?n:2;var s=parseFloat((s+"").replace(/[^\d\.-]/g,"")).toFixed(n)+"";var l=s.split(".")[0].split("").reverse(),r=s.split(".")[1];var t="";for(var i=0;i<l.length;i++){t+=l[i]+((i+1)%3==0&&(i+1)!=l.length?",":"");}
return t.split("").reverse().join("")+"."+r;}
function addSticky(message){$.espcms_sticky(message,{'autoclose':1500});}
function espcms_popover_message(obj,message){$(obj).popover({html:true,content:function(){return message;},placement:"top"}).popover('show').click(function(){$(this).popover('destroy');});}
function espcms_count(array_value){if(!array_value){return false;}
if($.isArray(array_value)){return array_value.length;}else{return false;}}
function espcms_isInteger(val){return(/(^[1-9]\d*$)/.test(val));}
function espcms_ismatch(val){return(/(^[0-9]+$)/.test(val));}
function espcms_get_cookie_page(key,update_key){if(!key){var dburl=window.location.href;var db_key=hex_md5(dburl);}else{var db_key=key;}
var cookie_now_page=$.cookie(db_key);if(cookie_now_page>0&&update_key=='now_page'){$("#now_page").val(cookie_now_page);}
var cookie_per_page_num=$.cookie(db_key);if(cookie_per_page_num>0&&update_key=='per_page_num'){$("#per_page_num").val(cookie_per_page_num);}
return $.cookie(db_key);}
function espcms_set_cookie_page(page,key){if(!key){var dburl=window.location.href;var db_key=hex_md5(dburl);}else{var db_key=key;}
$.cookie(db_key,page,{expires:1});return db_key;}
function espcms_get_cookie_threelist(){var dburl=window.location.href;var dburl_array=espcms_url_long_array(dburl);var cookiename=dburl_array['act']+'_'+dburl_array['iframes_name'];var db_key=hex_md5(cookiename+'_three');var cookie_page=$.cookie(db_key);$("#expanded_id").val(cookie_page);return cookie_page;}
function espcms_set_cookie_threelist(page){var dburl=window.location.href;var dburl_array=espcms_url_long_array(dburl);var cookiename=dburl_array['act']+'_'+dburl_array['iframes_name'];var db_key=hex_md5(cookiename+'_three');$.cookie(db_key,page,{expires:1});return db_key;}
function espcms_round(num,v){var vv=Math.pow(10,v);return Math.round(num*vv)/vv;}
function number_format(number,decimals,dec_point,thousands_sep){number=(number+'').replace(/[^0-9+-Ee.]/g,'');number=espcms_round(number,decimals);var n=!isFinite(+number)?0:+number,prec=!isFinite(+decimals)?0:Math.abs(decimals),sep=(typeof thousands_sep==='undefined')?',':thousands_sep,dec=(typeof dec_point==='undefined')?'.':dec_point,s='',toFixedFix=function(n,prec){var k=Math.pow(10,prec);return''+Math.floor(n*k)/k;};s=(prec?toFixedFix(n,prec):''+Math.floor(n)).split('.');var re=/(-?\d+)(\d{3})/;console.log(s);while(re.test(s[0])){s[0]=s[0].replace(re,"$1"+sep+"$2");}
if((s[1]||'').length<prec){s[1]=s[1]||'';s[1]+=new Array(prec-s[1].length+1).join('');s[1]=s[1]?s[1]:'00';}
return s.join(dec);}
function trim(str){return str.replace(/(^\s*)|(\s*$)/g,"");}
function ltrim(str){return str.replace(/(^\s*)/g,"");}
function rtrim(str){return str.replace(/(\s*$)/g,"");}
function espcms_button_disabled(button_id){if(!button_id){return false;}
$(button_id).attr("disabled","disabled");}
function espcms_match(str,reg){if(!str||!reg){return false;}
if(reg){var re=new RegExp(reg,"ig");}else{return false;}
if(!str.match(re)){return false;}else{return true;}}
function espcms_autoHeight(){var tab_h=parent.page_win();var page_height=tab_h-155;$('.form_bottom_page').css('min-height',page_height);}
$.fn.espcms_sidebar_click=function(options){options=$.extend({name:'espcms_sidebar_click',cssname:'.espcms_sidebar_default'},options||{});return this.each(function(){$sidebar_class=parent.$(options.cssname);var show_name=$(this).attr('open_name');show_name='<span class="espcms_icon_fa espcms_icon_fa-columns" aria-hidden="true"></span>'+show_name;var close_name=$(this).attr('close_name');close_name='<span class="espcms_icon_fa espcms_icon_fa-columns" aria-hidden="true"></span>'+close_name;if($sidebar_class.hasClass('displaynone')){$(this).empty().append(show_name);}else{$(this).empty().append(close_name);}
$(this).unbind('click').bind('click',function(){if($sidebar_class.hasClass('displaynone')){$(this).empty().append(close_name);$sidebar_class.removeClass('displaynone');parent.$('.espcms_content_wrapper').css('margin-left','200px');$.cookie(options.name,1,{expires:1});}else{$(this).empty().append(show_name);$sidebar_class.addClass('displaynone');parent.$('.espcms_content_wrapper').css('margin-left','0px');$.cookie(options.name,0,{expires:1});}});});};function espcms_get_cookie_sidebar(name){var cookie_value=$.cookie(name);return cookie_value;}
function set_save_loading(set_url){var listurl=set_url?set_url:$('#espcms_service_tab_link').val();$.ajax({type:"get",url:listurl,dataType:'json',success:function(data){if(data.uid=='0'){var get_url=window.location.protocol+'//'+window.location.host+window.location.pathname+'?act=Portal/Join';set_save_loading(get_url);}}});}
function center_main_message(){var get_url=window.location.protocol+'//'+window.location.host+window.location.pathname+'?act=MainCenter/ViewService';$.ajax({type:"get",url:get_url,dataType:'json',success:function(data){if(data.uid=='1'){$('#login_info').empty().append(data.message).fadeIn("fast");$('.espcms_dialog_link').espcms_dig();}},error:function(){$('a').removeAttr('href');$('a').removeAttr('data-url');$('a').removeClass('espcms_dialog_link');}});}
function site_loading(){var listurl=window.location.protocol+'//'+window.location.host+window.location.pathname+'?act=MainCenter/SiteState';$.ajax({type:"get",url:listurl,dataType:'json',success:function(data){if(data.uid||!espcms_ismatch(data.uid)){$('a').removeAttr('href');$('a').removeAttr('data-url');$('a').removeClass('espcms_dialog_link');}
if(data.ishref==1){window.location.href=data.hrefurl;}},error:function(){$('a').removeAttr('href');$('a').removeAttr('data-url');$('a').removeClass('espcms_dialog_link');}});}