/*! layer-v1.8.5 弹层组件 2014-09-24 license lgpl http://sentsin.com/jquery/layer/ by 贤心 */ ;!function(a,b){"use strict";var c,d,e="",f={getpath:function(){var a=document.scripts,b=a[a.length-1].src;return e?e:b.substring(0,b.lastindexof("/")+1)},type:["dialog","page","iframe","loading","tips"]};a.layer={v:"1.8.5",ie6:!!a.activexobject&&!a.xmlhttprequest,index:0,path:f.getpath(),use:function(a,b){var d=c("head")[0],a=a.replace(/\s/g,""),e=/\.css$/.test(a),f=document.createelement(e?"link":"script"),g=a.replace(/\.|\//g,"");e&&(f.type="text/css",f.rel="stylesheet"),f[e?"href":"src"]=/^http:\/\//.test(a)?a:layer.path+a,f.id=g,c("#"+g)[0]||d.appendchild(f),b&&(document.all?c(f).ready(b):c(f).load(b))},alert:function(a,b,d,e){var f="function"==typeof d,g={dialog:{msg:a,type:b,yes:f?d:e},area:["auto","auto"]};return f||(g.title=d),c.layer(g)},confirm:function(a,b,d,e){var f="function"==typeof d,g={dialog:{msg:a,type:4,btns:2,yes:b,no:f?d:e}};return f||(g.title=d),c.layer(g)},msg:function(a,d,e,f){var g={title:!1,closebtn:!1,time:d===b?2:d,dialog:{msg:""===a||a===b?" ":a},end:f};return"object"==typeof e?(g.dialog.type=e.type,g.shade=e.shade,g.shift=e.rate):"function"==typeof e?g.end=e:g.dialog.type=e,c.layer(g)},load:function(a,b){return"string"==typeof a?layer.msg(a,b||0,16):c.layer({time:a,loading:{type:b},bgcolor:b?"#fff":"",shade:b?[.1,"#000"]:[0],border:3!==b&&b?[6,.3,"#000"]:[0],type:3,title:["",!1],closebtn:[0,!1]})},tips:function(a,b,d,e,f,g){var h={type:4,shade:!1,success:function(a){this.closebtn||a.find(".xubox_tips").css({"padding-right":10})},bgcolor:"",tips:{msg:a,follow:b}};return h.time="object"==typeof d?d.time:0|d,d=d||{},h.closebtn=d.closebtn||!1,h.maxwidth=d.maxwidth||e,h.tips.guide=d.guide||f,h.tips.style=d.style||g,h.tips.more=d.more,c.layer(h)}};var g=["xubox_layer","xubox_iframe",".xubox_title",".xubox_text",".xubox_page",".xubox_main"],h=function(a){var b=this,d=b.config;layer.index++,b.index=layer.index,b.config=c.extend({},d,a),b.config.dialog=c.extend({},d.dialog,a.dialog),b.config.page=c.extend({},d.page,a.page),b.config.iframe=c.extend({},d.iframe,a.iframe),b.config.loading=c.extend({},d.loading,a.loading),b.config.tips=c.extend({},d.tips,a.tips),b.creat()};h.pt=h.prototype,h.pt.config={type:0,shade:[.3,"#000"],fix:!0,move:".xubox_title",title:"信息",offset:["","50%"],area:["310px","auto"],closebtn:[0,!0],time:0,bgcolor:"#fff",border:[6,.3,"#000"],zindex:19891014,maxwidth:400,dialog:{btns:1,btn:["确定","取消"],type:8,msg:"",yes:function(a){layer.close(a)},no:function(a){layer.close(a)}},page:{dom:"#xulayer",html:"",url:""},iframe:{src:"http://sentsin.com",scrolling:"auto"},loading:{type:0},tips:{msg:"",follow:"",guide:0,isguide:!0,style:["background-color:#ff9900; color:#fff;","#ff9900"]},success:function(){},close:function(a){layer.close(a)},end:function(){}},h.pt.space=function(a){var b=this,a=a||"",c=b.index,d=b.config,e=d.dialog,f=-1===e.type?"":'',h=['
'+f+''+e.msg+"
",'
'+a+"
",'','','
'+d.tips.msg+'
'],i="",j="",k=d.zindex+c,l="z-index:"+k+"; background-color:"+d.shade[1]+"; opacity:"+d.shade[0]+"; filter:alpha(opacity="+100*d.shade[0]+");";d.shade[0]&&(i='
'),d.zindex=k;var m="",n="",o="z-index:"+(k-1)+"; background-color: "+d.border[2]+"; opacity:"+d.border[1]+"; filter:alpha(opacity="+100*d.border[1]+"); top:-"+d.border[0]+"px; left:-"+d.border[0]+"px;";d.border[0]&&(j='
'),!d.maxmin||1!==d.type&&2!==d.type||/^\d+%$/.test(d.area[0])&&/^\d+%$/.test(d.area[1])||(n=''),d.closebtn[1]&&(n+='');var p="object"==typeof d.title;return d.title&&(m='
'+(p?d.title[0]:d.title)+"
"),[i,'
'+h[d.type]+m+''+n+'
'+j+"
"]},h.pt.creat=function(){var a=this,b="",d=a.config,e=d.dialog,f=a.index,h=d.page,i=c("body"),j=function(d){var d=d||"";b=a.space(d),i.append(c(b[0]))};switch(d.type){case 0:d.title||(d.area=["auto","auto"]),c(".xubox_dialog")[0]&&layer.close(c(".xubox_dialog").parents("."+g[0]).attr("times"));break;case 1:if(""!==h.html)j('
'+h.html+"
"),i.append(c(b[1]));else if(""!==h.url)j('
'+h.html+"
"),i.append(c(b[1])),c.get(h.url,function(a){c("#xuboxpagehtml"+f).html(a.tostring()),h.ok&&h.ok(a)});else{if(0!=c(h.dom).parents(g[4]).length)return;j(),c(h.dom).show().wrap(c(b[1]))}break;case 3:d.title=!1,d.area=["auto","auto"],d.closebtn=["",!1],c(".xubox_loading")[0]&&layer.closeload();break;case 4:d.title=!1,d.area=["auto","auto"],d.fix=!1,d.border=[0],d.tips.more||layer.closetips()}1!==d.type&&(j(),i.append(c(b[1])));var k=a.layere=c("#"+g[0]+f);if(k.css({width:d.area[0],height:d.area[1]}),d.fix||k.css({position:"absolute"}),d.title&&(3!==d.type||4!==d.type)){var l=0===d.type?e:d,m=k.find(".xubox_botton");switch(l.btn=d.btn||e.btn,l.btns){case 0:m.html("").hide();break;case 1:m.html(''+l.btn[0]+"");break;case 2:m.html(''+l.btn[0]+''+l.btn[1]+"")}}"auto"===k.css("left")?(k.hide(),settimeout(function(){k.show(),a.set(f)},500)):a.set(f),d.time<=0||a.autoclose(),a.callback()},f.fade=function(a,b,c){a.css({opacity:0}).animate({opacity:c},b)},h.pt.offset=function(){var a=this,b=a.config,c=a.layere,e=c.outerheight();a.offsettop=""===b.offset[0]&&ee.maxwidth&&i.width(e.maxwidth),o.tipcolor=e.tips.style[1],m[0]=i.outerwidth(),o.autoleft=function(){o.left+m[0]-d.width()>0?(o.tipleft=o.left+o.width-m[0],p.css({right:12,left:"auto"})):o.tipleft=o.left},o.where=[function(){o.autoleft(),o.tiptop=o.top-m[1]-10,p.removeclass("layertipsb").addclass("layertipst").css({"border-right-color":o.tipcolor})},function(){o.tipleft=o.left+o.width+10,o.tiptop=o.top,p.removeclass("layertipsl").addclass("layertipsr").css({"border-bottom-color":o.tipcolor})},function(){o.autoleft(),o.tiptop=o.top+o.height+10,p.removeclass("layertipst").addclass("layertipsb").css({"border-right-color":o.tipcolor})},function(){o.tipleft=o.left-m[0]+10,o.tiptop=o.top,p.removeclass("layertipsr").addclass("layertipsl").css({"border-bottom-color":o.tipcolor})}],o.where[e.tips.guide](),0===e.tips.guide?o.top-(d.scrolltop()+m[1]+16)<0&&o.where[2]():1===e.tips.guide?d.width()-(o.left+o.width+m[0]+16)>0||o.where[3]():2===e.tips.guide?o.top-d.scrolltop()+o.height+m[1]+16-d.height()>0&&o.where[0]():3===e.tips.guide?m[0]+16-o.left>0&&o.where[1]():4===e.tips.guide,i.css({left:o.tipleft,top:o.tiptop})}e.fadein&&(f.fade(i,e.fadein,1),f.fade(c("#xubox_shade"+a),e.fadein,e.shade[0])),e.fix&&""===e.offset[0]&&!e.shift&&d.on("resize",function(){i.css({top:(d.height()-i.outerheight())/2})}),b.move()},h.pt.shift=function(a,b,c){var e=this,f=e.config,g=e.layere,h=0,i=d.width(),j=d.height()+(f.fix?0:d.scrolltop());h="50%"==f.offset[1]||""==f.offset[1]?g.outerwidth()/2:g.outerwidth();var k={t:{top:e.offsettop},b:{top:j-g.outerheight()-f.border[0]},cl:h+f.border[0],ct:-g.outerheight(),cr:i-h-f.border[0]};switch(a){case"left-top":g.css({left:k.cl,top:k.ct}).animate(k.t,b);break;case"top":g.css({top:k.ct}).animate(k.t,b);break;case"right-top":g.css({left:k.cr,top:k.ct}).animate(k.t,b);break;case"right-bottom":g.css({left:k.cr,top:j}).animate(c?k.t:k.b,b);break;case"bottom":g.css({top:j}).animate(c?k.t:k.b,b);break;case"left-bottom":g.css({left:k.cl,top:j}).animate(c?k.t:k.b,b);break;case"left":g.css({left:-g.outerwidth()}).animate({left:e.offsetleft},b)}},h.pt.autoarea=function(a){var b,d=this,a=a||d.index,e=d.config,f=e.page,h=c("#"+g[0]+a),i=h.find(g[2]),j=h.find(g[5]),k=e.title?i.innerheight():0,l=0;switch("auto"===e.area[0]&&j.outerwidth()>=e.maxwidth&&h.css({width:e.maxwidth}),e.type){case 0:var m=h.find(".xubox_botton>a");b=h.find(g[3]).outerheight()+20,m.length>0&&(l=m.outerheight()+20);break;case 1:var n=h.find(g[4]);b=c(f.dom).outerheight(),"auto"===e.area[0]&&h.css({width:n.outerwidth()}),(""!==f.html||""!==f.url)&&(b=n.outerheight());break;case 2:h.find("iframe").css({width:h.outerwidth(),height:h.outerheight()-(e.title?i.innerheight():0)});break;case 3:var o=h.find(".xubox_loading");b=o.outerheight(),j.css({width:o.width()})}"auto"===e.area[1]&&j.css({height:k+b+l}),c("#xubox_border"+a).css({width:h.outerwidth()+2*e.border[0],height:h.outerheight()+2*e.border[0]}),layer.ie6&&"auto"!==e.area[0]&&j.css({width:h.outerwidth()}),h.css("50%"!==e.offset[1]&&""!=e.offset[1]||4===e.type?{marginleft:0}:{marginleft:-h.outerwidth()/2})},h.pt.move=function(){var a=this,b=a.config,e={sety:0,movelayer:function(){if(0==parseint(e.layere.css("margin-left")))var a=parseint(e.move.css("left"));else var a=parseint(e.move.css("left"))+-parseint(e.layere.css("margin-left"));"fixed"!==e.layere.css("position")&&(a-=e.layere.parent().offset().left,e.sety=0),e.layere.css({left:a,top:parseint(e.move.css("top"))-e.sety})}},f=a.layere.find(b.move);b.move&&f.attr("move","ok"),f.css(b.move?{cursor:"move"}:{cursor:"auto"}),c(b.move).on("mousedown",function(a){if(a.preventdefault(),"ok"===c(this).attr("move")){e.ismove=!0,e.layere=c(this).parents("."+g[0]);var f=e.layere.offset().left,h=e.layere.offset().top,i=e.layere.width()-6,j=e.layere.height()-6;c("#xubox_moves")[0]||c("body").append('
'),e.move=c("#xubox_moves"),b.movetype&&e.move.css({opacity:0}),e.movex=a.pagex-e.move.position().left,e.movey=a.pagey-e.move.position().top,"fixed"!==e.layere.css("position")||(e.sety=d.scrolltop())}}),c(document).mousemove(function(a){if(e.ismove){var c=a.pagex-e.movex,f=a.pagey-e.movey;if(a.preventdefault(),!b.moveout){e.sety=d.scrolltop();var g=d.width()-e.move.outerwidth()-b.border[0],h=b.border[0]+e.sety;cg&&(c=g),h>f&&(f=h),f>d.height()-e.move.outerheight()-b.border[0]+e.sety&&(f=d.height()-e.move.outerheight()-b.border[0]+e.sety)}e.move.css({left:c,top:f}),b.movetype&&e.movelayer(),c=null,f=null,g=null,h=null}}).mouseup(function(){try{e.ismove&&(e.movelayer(),e.move.remove()),e.ismove=!1}catch(a){e.ismove=!1}b.moveend&&b.moveend()})},h.pt.autoclose=function(){var a=this,b=a.config.time,c=function(){b--,0===b&&(layer.close(a.index),clearinterval(a.autotime))};a.autotime=setinterval(c,1e3)},f.config={end:{}},h.pt.callback=function(){var a=this,b=a.layere,d=a.config,e=d.dialog;a.openlayer(),a.config.success(b),layer.ie6&&a.ie6(b),b.find(".xubox_close").on("click",function(){d.close(a.index),layer.close(a.index)}),b.find(".xubox_yes").on("click",function(){d.yes?d.yes(a.index):e.yes(a.index)}),b.find(".xubox_no").on("click",function(){d.no?d.no(a.index):e.no(a.index),layer.close(a.index)}),a.config.shadeclose&&c("#xubox_shade"+a.index).on("click",function(){layer.close(a.index)}),b.find(".xubox_min").on("click",function(){layer.min(a.index,d),d.min&&d.min(b)}),b.find(".xubox_max").on("click",function(){c(this).hasclass("xubox_maxmin")?(layer.restore(a.index),d.restore&&d.restore(b)):(layer.full(a.index,d),d.full&&d.full(b))}),f.config.end[a.index]=d.end},f.reselect=function(){c.each(c("select"),function(){var a=c(this);a.parents("."+g[0])[0]||1==a.attr("layer")&&c("."+g[0]).length<1&&a.removeattr("layer").show(),a=null})},h.pt.ie6=function(a){var b=this,e=a.offset().top;if(b.config.fix)var f=function(){a.css({top:d.scrolltop()+e})};else var f=function(){a.css({top:e})};f(),d.scroll(f),c.each(c("select"),function(){var a=c(this);a.parents("."+g[0])[0]||"none"==a.css("display")||a.attr({layer:"1"}).hide(),a=null})},h.pt.openlayer=function(){{var a=this;a.layere}layer.autoarea=function(b){return a.autoarea(b)},layer.shift=function(b,c,d){a.shift(b,c,d)},layer.setmove=function(){return a.move()},layer.zindex=a.config.zindex,layer.settop=function(a){var b=function(){layer.zindex++,a.css("z-index",layer.zindex+1)};return layer.zindex=parseint(a[0].style.zindex),a.on("mousedown",b),layer.zindex}},f.isauto=function(a,b,c){"auto"===b.area[0]&&(b.area[0]=a.outerwidth()),"auto"===b.area[1]&&(b.area[1]=a.outerheight()),a.attr({area:b.area+","+c}),a.find(".xubox_max").addclass("xubox_maxmin")},f.rescollbar=function(a){g.html.attr("layer-full")==a&&(g.html[0].style.removeproperty?g.html[0].style.removeproperty("overflow"):g.html[0].style.removeattribute("overflow"),g.html.removeattr("layer-full"))},layer.getindex=function(a){return c(a).parents("."+g[0]).attr("times")},layer.getchildframe=function(a,b){return b=b||c("."+g[1]).parents("."+g[0]).attr("times"),c("#"+g[0]+b).find("."+g[1]).contents().find(a)},layer.getframeindex=function(a){return c(a?"#"+a:"."+g[1]).parents("."+g[0]).attr("times")},layer.iframeauto=function(a){a=a||c("."+g[1]).parents("."+g[0]).attr("times");var b=layer.getchildframe("body",a).outerheight(),d=c("#"+g[0]+a),e=d.find(g[2]),f=0;e&&(f=e.height()),d.css({height:b+f});var h=-parseint(c("#xubox_border"+a).css("top"));c("#xubox_border"+a).css({height:b+2*h+f}),c("#"+g[1]+a).css({height:b})},layer.iframesrc=function(a,b){c("#"+g[0]+a).find("iframe").attr("src",b)},layer.area=function(a,b){var d=[c("#"+g[0]+a),c("#xubox_border"+a)],e=d[0].attr("type"),h=d[0].find(g[5]),i=d[0].find(g[2]);if(e===f.type[1]||e===f.type[2]){if(d[0].css(b),h.css({width:b.width,height:b.height}),e===f.type[2]){var j=d[0].find("iframe");j.css({width:b.width,height:i?b.height-i.innerheight():b.height})}"0px"!==d[0].css("margin-left")&&(b.hasownproperty("top")&&d[0].css({top:b.top-(d[1][0]?parsefloat(d[1].css("top")):0)}),b.hasownproperty("left")&&d[0].css({left:b.left+d[0].outerwidth()/2-(d[1][0]?parsefloat(d[1].css("left")):0)}),d[0].css({marginleft:-d[0].outerwidth()/2})),d[1][0]&&d[1].css({width:parsefloat(b.width)-2*parsefloat(d[1].css("left")),height:parsefloat(b.height)-2*parsefloat(d[1].css("top"))})}},layer.min=function(a,b){var d=c("#"+g[0]+a),e=[d.position().top,d.position().left+parsefloat(d.css("margin-left"))];f.isauto(d,b,e),layer.area(a,{width:180,height:35}),d.find(".xubox_min").hide(),"page"===d.attr("type")&&d.find(g[4]).hide(),f.rescollbar(a)},layer.restore=function(a){{var b=c("#"+g[0]+a),d=b.attr("area").split(",");b.attr("type")}layer.area(a,{width:parsefloat(d[0]),height:parsefloat(d[1]),top:parsefloat(d[2]),left:parsefloat(d[3])}),b.find(".xubox_max").removeclass("xubox_maxmin"),b.find(".xubox_min").show(),"page"===b.attr("type")&&b.find(g[4]).show(),f.rescollbar(a)},layer.full=function(a,b){var e,h=c("#"+g[0]+a),i=2*b.border[0]||6,j=[h.position().top,h.position().left+parsefloat(h.css("margin-left"))];f.isauto(h,b,j),g.html.attr("layer-full")||g.html.css("overflow","hidden").attr("layer-full",a),cleartimeout(e),e=settimeout(function(){layer.area(a,{top:"fixed"===h.css("position")?0:d.scrolltop(),left:"fixed"===h.css("position")?0:d.scrollleft(),width:d.width()-i,height:d.height()-i})},100)},layer.title=function(a,b){var d=c("#"+g[0]+(b||layer.index)).find(".xubox_title>em");d.html(a)},layer.close=function(a){var b=c("#"+g[0]+a),d=b.attr("type"),e=c("#xubox_moves, #xubox_shade"+a);if(b[0]){if(d==f.type[1])if(b.find(".xuboxpagehtml")[0])b[0].innerhtml="",b.remove();else{b.find(".xubox_setwin,.xubox_close,.xubox_botton,.xubox_title,.xubox_border").remove();for(var h=0;3>h;h++)b.find(".layer_pagecontent").unwrap().hide()}else b[0].innerhtml="",b.remove();e.remove(),layer.ie6&&f.reselect(),f.rescollbar(a),"function"==typeof f.config.end[a]&&f.config.end[a](),delete f.config.end[a]}},layer.closeload=function(){layer.close(c(".xubox_loading").parents("."+g[0]).attr("times"))},layer.closetips=function(){layer.closeall("tips")},layer.closeall=function(a){c.each(c("."+g[0]),function(){var b=c(this),d=a?b.attr("type")===a:1;d&&layer.close(b.attr("times")),d=null})},f.run=function(){c=jquery,d=c(a),g.html=c("html"),layer.use("skin/layer.css"),c.layer=function(a){var b=new h(a);return b.index},(new image).src=window["p_basepath"] + "/res/plugin/layer/skin/default/xubox_ico0.png"},"function"==typeof define?define(function(){return f.run(),layer}):f.run()}(window);