var util=util||{};util.config={jsfile:environment.basepath+"/v2/local/js/",cssfile:environment.basepath+"/v2/local/css/",imgfile:environment.basepath+"/v2/local/img/",cityspotlight:[],hotcityspotlight:[],banksspotlight:[]};util.getname=function(a){return document.getelementsbyname(a)};util.getid=function(id){return document.getelementbyid(id)};util.gettag=function(ele,oparent){return(oparent||document).getelementsbytagname(ele)};util.ct=function(txt){return document.createtextnode(txt)};util.ce=function(name){return document.createelement(name)};util.alink=function(name){return $(name).bind("focus",function(){if(this.blur){this.blur()}})};util.stopbubble=function(e){e.stoppropagation?e.stoppropagation():e.cancelbubble=true};util.stopdefault=function(e){e.preventdefault?e.preventdefault():e.returnvalue=false};util.clselect=function(){try{window.getselection?window.getselection().removeallranges():document.selection.empty()}catch(_){}};util.getstyle=function(element){return element.currentstyle||document.defaultview.getcomputedstyle(element,null)};util.exid=function(id){return document.getelementbyid(id)?true:false};util.strtrim=function(str){return str.replace(/(^\s*)|(\s*$)/g,"")};util.checkval=function(val){return val==null||val==''};util.browser=function(){var a=navigator.useragent.tolowercase();var u=navigator.useragent;var b={};b.isstrict=document.compatmode=="css1compat";b.isfirefox=a.indexof("firefox")>-1;b.isopera=a.indexof("opera")>-1;b.issafari=(/webkit|khtml/).test(a);b.issafari3=b.issafari&&a.indexof("webkit/5")!=-1;b.isie=!b.isopera&&a.indexof("msie")>-1;b.isie6=!b.isopera&&a.indexof("msie 6")>-1;b.isie7=!b.isopera&&a.indexof("msie 7")>-1;b.isie8=!b.isopera&&a.indexof("msie 8")>-1;b.isgecko=!b.issafari&&a.indexof("gecko")>-1;b.ismozilla=document.all!=undefined&&document.getelementbyid!=undefined&&!window.opera!=undefined;b.istrident=u.indexof('trident')>-1;b.ispresto=u.indexof('presto')>-1;b.iswebkit=u.indexof('applewebkit')>-1;b.isgecko=u.indexof('gecko')>-1&&u.indexof('khtml')==-1;b.ismobile=!!u.match(/applewebkit.*mobile.*/)||!!u.match(/applewebkit/);b.isios=!!u.match(/\(i[^;]+;( u;)? cpu.+mac os x/);b.isandroid=u.indexof('android')>-1||u.indexof('linux')>-1;b.isiphone=u.indexof('iphone')>-1||u.indexof('mac')>-1;b.isipad=u.indexof('ipad')>-1;b.iswebapp=u.indexof('safari')==-1;return b}();util.addstyle=function(str){var b=window.style;if(!b){b=window.style=document.createelement('style');b.setattribute('type','text/css');document.getelementsbytagname('head')[0].appendchild(b)};b.stylesheet&&(b.stylesheet.csstext+=str)||b.appendchild(document.createtextnode(str))};util.loadcss=function(path,name){if(!path)return;var b=util.gettag('link');for(var c in b){if(b[c].href==path)return};var links=document.createelement("link");links.id=name;links.rel="stylesheet";links.media="screen";links.type="text/css";links.href=path;util.gettag("head").item(0).appendchild(links)};util.loadjs=function(url,callback,ecall){var head=document.head||document.getelementsbytagname("head")[0]||document.documentelement,script,options,o,scriptsarray=[];if(typeof url==="object"){options=url;url=undefined};o=options||{};url=url||o.url;var path=url.split(",");callback=callback||o.success;for(var i=0;i1)?(regexp.$1.length>2?"\u661f\u671f":"\u5468"):"")+week[this.getday()+""])};for(var k in o){if(new regexp("("+k+")").test(fmt)){fmt=fmt.replace(regexp.$1,(regexp.$1.length==1)?(o[k]):(("00"+o[k]).substr((""+o[k]).length)))}};return fmt};util.getdatestr=function(c,d){d.setdate(d.getdate()+c);return(d.getmonth()+1)+'/'+(d.getdate())+'/'+d.getfullyear()};util.numformat=function(s,n){var t='',r='';var str=function(){n=n>0&&n<=20?n:2;s=parsefloat((s+'').replace(/[^\d\.-]/g,'')).tofixed(n)+'';var l=s.split('.')[0].split('').reverse();r=s.split('.')[1];for(var i=0;i=0){str();return t.split('').reverse().join('')+'.'+r}else{str();return t.split('').reverse().join('')}};util.stringtoarray=function(str,substr){var arrtmp=new array();if(substr==""){arrtmp.push(str);return arrtmp};var i=0,j=0,k=str.length;while(ib){$(this).attr("title",d);d=$(this).text(d.substring(0,b)+"...")}})};util.chacktextarea={clear:"timer",init:function(a,b,c,d,f,g){util.chacktextarea.clear=setinterval(function(){var v=util.getlength($("#"+a).val()),numclor;if(v>=0){if(v>b*2){$(c).html('已超出" +parseint((v - b*2)/2) +"个字!');if(d)$(d).attr("disabled","disabled").attr("class",g);numclor=util.config.chacktextareatipscolor}else{$(c).html('还能输入" +parseint((b*2-v)/2) +"个字!');if(d)$(d).attr("disabled","").attr("class",f);numclor=""};$(".chacktextareatipsnum").css({fontfamily:"georgia,tahoma,arial",position:"relative",top:"-5px",fontsize:"26px",verticalalign:"middle",color:numclor})}else{if(d)$(d).attr("disabled","disabled").attr("class",f)}},100)}};util.scrollto=function(a,b,c){util.fixed(a);$("#"+a).hide().click(function(){var d=b!=""?util.getid(b).offsettop:document.body.offsettop;$("html,body").stop().animate({scrolltop:d},{duration:c||500,queue:false});return false});$(window).bind("scroll",function(){var st=$(document).scrolltop();(st>30)?$("#"+a).show():$("#"+a).hide()})};util.scrolldiv=function(a,b,c){var d=$(a);var s=util.pagesize.get();d.css({position:"absolute",top:b+"px"});$(window).scroll(function(){var g=parseint(b)+$(window).scrolltop();d.animate({top:g+"px"},{duration:c||350,queue:false})})};util.file={showsize:function(bytes){bytes=parseint(number(bytes));var unit=new array("b","kb","mb","gb","tb","pb","eb","zb","yb","db","nb");var extension=unit[0];var max=unit.length;for(var i=1;((i=1024));i++){bytes=bytes/1024;extension=unit[i]}return number(bytes).tofixed(2).replace(/\.00/,"")+extension}};util.getposition=function(obj){if(typeof(obj)==="string")obj=util.getid(obj);var c=0;var d=0;var w=obj.offsetwidth;var h=obj.offsetheight;do{d+=obj.offsettop||0;c+=obj.offsetleft||0;obj=obj.offsetparent}while(obj)return{x:c,y:d,width:w,height:h}};util.getpop=function(self,tar,wid){var atop=self.offset().top;var aleft=self.offset().left;var aheight=self.outerheight();var awidth=self.outerwidth();var tmpwidth=tar.width();var tmpheight=tar.height();var tmptop=atop;var tmpleft=aleft+awidth/2;var up=tar.find('.ar_up');var upinner=tar.find('.ar_up_in');if(self.hasclass('tooltipcols')){tmpwidth=tar.width()}else{if(tmpwidth>wid){tmpwidth=wid}else{tmpwidth=tar.width()}};var tipy=$(window).height()-(atop+tmpheight);var tipx=$(window).width()-(aleft+tmpwidth);if(tipx';util.gettargeting(tar,typ)},error:function(tar,text){var typ='
'+text+'
';util.gettargeting(tar,typ)},succeed:function(tar,text){var typ='
'+text+'
';util.gettargeting(tar,typ)}};util.gettargeting=function(tar,typ){var con=$(typ);$('body').append(con);con.css({position:'absolute',top:tar.offset().top+tar.outerheight()/2-10,left:tar.offset().left+tar.outerwidth()+10,zindex:9999})};util.calltype={loading:function(text){return'

'+text+'

'},tips:function(text){return'

'+text+'

'},erro:function(text){return'

'+text+'

'}};util.jdialog={mask:function(dia,confirmcallback,cancelcallback){if(typeof($('#overlaymodal')[0])=='undefined'){$('body').append('
');var mod=$('#overlaymodal');var tmpwidth=$(document.body).width();var tmpheight=$(document.body).height();if(util.browser.isios||util.browser.isandroid){tmpwidth=tmpwidth+20};mod.css({position:'absolute',left:0,top:0,right:0,bottom:0,width:tmpwidth,height:tmpheight,background:'#000000',zindex:9997}).fadeto(0,0.3);util.jdialog.event(dia,mod,confirmcallback,cancelcallback)}},event:function(dia,mod,confirmcallback,cancelcallback){dia.find('.closemodal').click(function(){dia.fadeout();mod.fadeout(function(){mod.remove()});if(cancelcallback!=false)cancelcallback();return});dia.find('.verifymodal').click(function(){dia.fadeout();mod.fadeout(function(){mod.remove()});if(confirmcallback!=false)confirmcallback();return});document.onkeydown=function(event){event=window.event||event;var keycode=event.keycode||event.which||event.charcode;if(event.keycode==27){dia.fadeout();mod.fadeout(function(){mod.remove()});if(cancelcallback!=false)cancelcallback();return}}},pois:function(dia){var tmph=dia.height();var tmpw=dia.width();var tmpl=($(window).width()-tmpw)/2;var tmpt=($(window).height()-tmph)/2+$(document).scrolltop();dia.css({left:tmpl,top:tmpt,width:tmpw,zindex:9999}).fadein(200)},modal:function(jdia,undia){var dia=$('#'+jdia);if(util.getid(jdia)&&util.getid(undia)){util.jdialog.mask(dia,false,false);util.jdialog.pois(dia);util.mdrag(jdia,undia)}},prompt:function(options){var defaults={button:true,buttoncancel:true,icon:'tanhao-gray60',title:'提示',text:'',color:'#475058',closed:'关闭',cancel:'取消',confir:'确认',type:'prompt',width:400,confirmcallback:false,cancelcallback:false};if(options&&typeof(options)=='object'){for(var key in options){if(key.match(/^_/)){continue}defaults[key]=options[key]}};$('#dialogprompt').remove();var html='
';html+='

'+defaults.title+'

'+defaults.closed+'
';html+='
';if(defaults.type=='prompt'){html+='
';html+='
'+defaults.text+'
';html+='';html+='
'};if(defaults.type=='modal'){html+=defaults.text};if(defaults.button){html+='
';if(defaults.buttoncancel){html+=''+defaults.cancel+''};html+=''+defaults.confir+'';html+='
'};html+='
';$('body').append(html);var dia=$('#dialogprompt');util.jdialog.mask(dia,defaults.confirmcallback,defaults.cancelcallback);util.jdialog.pois(dia);util.mdrag('dialogprompt','dialogcont')},getpois:function(a,b){this._b=null;if(b===null||b===''||typeof b==='undefined'){return a.width()}else{return b};this._b=b}};util.mdrag=function(a,b){var bdrag=false;var disx=0,disy=0;var win=util.getid(a);var obj=util.getid(b);if(win&&obj){obj.onmousedown=function(event){(event||window.event).cancelbubble=true};win.onmousedown=function(event){event=event||window.event;bdrag=true;disx=event.clientx-win.offsetleft;disy=event.clienty-win.offsettop;this.setcapture&&this.setcapture();return false};document.onmousemove=function(event){if(!bdrag)return;event=event||window.event;var il=event.clientx-disx;var it=event.clienty-disy;var maxl=document.documentelement.clientwidth-win.offsetwidth;var maxt=document.documentelement.scrollheight-win.offsetheight;il=il<0?0:il;il=il>maxl?maxl:il;it=it<0?0:it;it=it>maxt?maxt:it;win.style.margintop=win.style.marginleft=0;win.style.left=il+'px';win.style.top=it+'px';return false};document.onmouseup=window.onblur=win.onlosecapture=function(){bdrag=false;win.releasecapture&&win.releasecapture()}}};util.tooltip={x:20,y:20,zindex:999,timer:200,toolclass:'tool-tip',tipclass:'tooltips',tipid:'tooltip',wid:300,hei:0,init:function(){$('.'+util.tooltip.tipclass).bind('mouseenter',function(e){util.stopbubble(e);var self=$(this);var txt=self.attr('data-text');util.tooltip.createhtml(self,txt)}).click(function(e){util.stopbubble(e);var self=$(this);var txt=self.attr('data-text');if(typeof($('#'+util.tooltip.tipid)[0])==='undefined'){util.tooltip.createhtml(self,txt)};return false})},createhtml:function(self,txt){if(!(txt==''||txt=='undefined'||txt==null)){$('#'+util.tooltip.tipid).remove();var items=[],html='';items=$.trim(txt).split("|");if(self.hasclass('tooltipcol')){html+='
';html+='
'+items+'
'}else if(self.hasclass('tooltipcols')){html+='';$('body').append(html);var tar=$('#'+util.tooltip.tipid);tar.show(function(){util.getpop(self,tar,util.tooltip.wid)});util.getpop(self,tar,util.tooltip.wid);tar.mouseleave(function(){tar.remove()});tar.click(function(e){util.stopbubble(e)});$(document).click(function(){tar.remove()})}}};function divtipcreate(txt){return'
'+txt+'
'};util.arrowprompt=function(tar,txt,typ){var c;if(typ=='err'){c=$('
'+divtipcreate(txt)+'
')}else if(typ=='def'){c=$('
'+divtipcreate(txt)+'
')}else{c=$('
'+divtipcreate(txt)+'
')};$('body').append(c);var x=10,y=10;var atop=tar.offset().top;var aleft=tar.offset().left;var aheight=tar.outerheight();var awidth=tar.outerwidth();var cwidht=c.width();var cheight=c.height();var tipy=$(window).height()-(atop+cheight);var tipx=$(window).width()-(aleft+cwidht);var tmptop=atop;var tmpleft=aleft+awidth/2;var up=c.find('.ar_up');var upinner=c.find('.ar_up_in');var poprompt=c.find('.content');if(tipx300){_width=300};poprompt.css({width:_width});$(document).click(function(){c.remove()})};util.jtab=function(tab,pan,evt){$(pan).find('.jpanel').hide();$(tab).find('.jtab:first').addclass('current').show();$(pan).find('.jpanel:first').show();$(tab).find('.jtab').bind(evt,function(){$(this).addclass('current').siblings('.jtab').removeclass('current');var index=$(tab).find('.jtab').index(this);$(pan).children().eq(index).show().siblings().hide();var tool=$('#tooltip');if(typeof(tool[0])!='undefined'){tool.remove()};return false})};util.countdown=function(o){var count=60,clear;var time=function(){if(count==0){o.hide();o.after('电话获取验证码短信获取验证码');o.remove();count=60;clearinterval(clear)}else{o.attr('class','getcodebotton codedisabled r3');o.html(count+'秒后重新获取');count--;clear=settimeout(function(){time()},1000)}};if(!o.hasclass('codedisabled')){time()}};util.customcheckbox=function(a){var sel='selected';var ove='hover';a.click(function(){var _this=$(this).children('span');if(_this.hasclass(sel)){_this.removeclass(sel)}else{_this.addclass(sel)}}).hover(function(){$(this).children('span').addclass(ove)},function(){$(this).children('span').removeclass(ove)})};util.customradio=function(a,b){var sel='selected';var ove='hover';var a=$(a);var b=$(b);a.click(function(){var _this=$(this).children('span');b.find(a).children('span').removeclass(sel);if(_this.hasclass(sel)){_this.removeclass(sel)}else{_this.addclass(sel)}}).hover(function(){$(this).children('span').addclass(ove)},function(){$(this).children('span').removeclass(ove)})};util.cookie={get:function(a){var b="";var c=a+"=";var d=document.cookie;if(d.length>0){g=d.indexof(c);if(g!=-1){g+=c.length;f=d.indexof(";",g);if(f==-1)f=d.length;b=unescape(d.substring(g,f))}};return b},set:function(a,b,t,d,e){var c="";var h=t||24*30;if(h!=null){c=new date((new date()).gettime()+h*3600000);c="; expires="+c.togmtstring()};document.cookie=a+"="+escape(b)+c+(d?";path="+d:";path=/")+(e?";domain="+e:"")},del:function(a){document.cookie=a+"=;path=/;expires="+(new date(0)).togmtstring()}};jquery.cookie=function(key,value,options){if(arguments.length>1&&string(value)!=="[object object]"){options=jquery.extend({},options);if(value===null||value===undefined){options.expires=-1};if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new date();t.setdate(t.getdate()+days)};value=string(value);return(document.cookie=[encodeuricomponent(key),'=',options.raw?value:encodeuricomponent(value),options.expires?'; expires='+options.expires.toutcstring():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''))};options=value||{};var result,decode=options.raw?function(s){return s}:decodeuricomponent;return(result=new regexp('(?:^|; )'+encodeuricomponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null};util.cookieenable=function(){var a=false;if(navigator.cookiesenabled)return true;document.cookie="b=yes;";var c=document.cookie;if(c.indexof("b=yes")>-1)a=true;document.cookie="";return a};util.weixinpay=function(){var tar=$('a.weixin');if(typeof(tar[0])!='undefined'){var html='
';html+='
';html+='

关注有利网官方微信

';html+='关闭
';html+='
';html+='

';html+='

打开微信,点击底部的′发现′,使用′扫一扫′即可关注有利网官方微信。

';html+='
';$('body').append(html);tar.click(function(){util.jdialog.modal('weixindialog','weixinentry');return false})}};try{document.execcommand("backgroundimagecache",false,true)}catch(e){};$(function(){util.tooltip.init();util.alink('a');util.weixinpay();$('input.input').focus(function(){$(this).addclass('focus')}).blur(function(){$(this).removeclass('focus')})});