/****************************************
@name:layer v1.8.5 弹层组件压缩版
@author:贤心
@date:2014-08-13
@blog:http://sentsin.com
@copyright:sentsin xu(贤心)
@官网:http://sentsin.com/jquery/layer
*/
;!function(a,b){
"use strict";
var d,e,g,h,i,
c="", //组件存放目录,为空表示自动获取(不用填写host,相对站点的根目录即可)。
f={host:"http://"+location.host,getpath:function(){var a=document.scripts,b=a[a.length-1].src;return c?f.host+c:b.substring(0,b.lastindexof("/")+1)},type:["dialog","page","iframe","loading","tips"]};a.layer={v:"1.8.5",ie6:!-[1,]&&!a.xmlhttprequest,index:0,path:f.getpath(),use:function(a,b){var f,g,h,e=d("head")[0];a=a.replace(/\s/g,""),f=/\.css$/.test(a),g=document.createelement(f?"link":"script"),h=a.replace(/\.|\//g,""),f&&(g.type="text/css",g.rel="stylesheet"),g[f?"href":"src"]=/^http:\/\//.test(a)?a:layer.path+a,g.id=h,d("#"+h)[0]||e.appendchild(g),b&&(document.all?d(g).ready(b):d(g).load(b))},alert:function(a,b,c,e){var f="function"==typeof c,g={dialog:{msg:a,type:b,yes:f?c:e},area:["auto","auto"]};return f||(g.title=c),d.layer(g)},confirm:function(a,b,c,e){var f="function"==typeof c,g={dialog:{msg:a,type:4,btns:2,yes:b,no:f?c:e}};return f||(g.title=c),d.layer(g)},msg:function(a,c,e,f){var g={title:!1,closebtn:!1,time:c===b?2:c,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,d.layer(g)},load:function(a,b){return"string"==typeof a?layer.msg(a,b||0,16):d.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,c,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 c?c.time:0|c,c=c||{},h.closebtn=c.closebtn||!1,h.maxwidth=c.maxwidth||e,h.tips.guide=c.guide||f,h.tips.style=c.style||g,h.tips.more=c.more,d.layer(h)}},g=["xubox_layer","xubox_iframe",".xubox_title",".xubox_text",".xubox_page",".xubox_main"],h=function(a){var b=this,c=b.config;layer.index++,b.index=layer.index,b.config=d.extend({},c,a),b.config.dialog=d.extend({},c.dialog,a.dialog),b.config.page=d.extend({},c.page,a.page),b.config.iframe=d.extend({},c.iframe,a.iframe),b.config.loading=d.extend({},c.loading,a.loading),b.config.tips=d.extend({},c.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 c,d,e,f,h,i,j,k,l,m,n,o,p,b=this;return a=a||"",c=b.index,d=b.config,e=d.dialog,f=-1===e.type?"":'',h=['
'+f+''+e.msg+"
",''+a+"
",'','',''],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,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+=''),p="object"==typeof d.title,d.title&&(m=''+(p?d.title[0]:d.title)+"
"),[i,''+'
'+h[d.type]+m+''+n+""+''+"
"+j+"
"]},h.pt.creat=function(){var k,l,m,a=this,b="",c=a.config,e=c.dialog,f=a.index,h=c.page,i=d("body"),j=function(c){var c=c||"";b=a.space(c),i.append(d(b[0]))};switch(c.type){case 0:c.title||(c.area=["auto","auto"]),d(".xubox_dialog")[0]&&layer.close(d(".xubox_dialog").parents("."+g[0]).attr("times"));break;case 1:if(""!==h.html)j(''+h.html+"
"),i.append(d(b[1]));else if(""!==h.url)j(''+h.html+"
"),i.append(d(b[1])),d.get(h.url,function(a){d("#xuboxpagehtml"+f).html(a.tostring()),h.ok&&h.ok(a)});else{if(0!=d(h.dom).parents(g[4]).length)return;j(),d(h.dom).show().wrap(d(b[1]))}break;case 3:c.title=!1,c.area=["auto","auto"],c.closebtn=["",!1],d(".xubox_loading")[0]&&layer.closeload();break;case 4:c.title=!1,c.area=["auto","auto"],c.fix=!1,c.border=[0],c.tips.more||layer.closetips()}if(1!==c.type&&(j(),i.append(d(b[1]))),k=a.layere=d("#"+g[0]+f),k.css({width:c.area[0],height:c.area[1]}),c.fix||k.css({position:"absolute"}),c.title&&(3!==c.type||4!==c.type))switch(l=0===c.type?e:c,m=k.find(".xubox_botton"),l.btn=c.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),c.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,d=c.outerheight();a.offsettop=""===b.offset[0]&&dc.maxwidth&&k.width(c.maxwidth),q.tipcolor=c.tips.style[1],o[0]=k.outerwidth(),q.autoleft=function(){q.left+o[0]-e.width()>0?(q.tipleft=q.left+q.width-o[0],r.css({right:12,left:"auto"})):q.tipleft=q.left},q.where=[function(){q.autoleft(),q.tiptop=q.top-o[1]-10,r.removeclass("layertipsb").addclass("layertipst").css({"border-right-color":q.tipcolor})},function(){q.tipleft=q.left+q.width+10,q.tiptop=q.top,r.removeclass("layertipsl").addclass("layertipsr").css({"border-bottom-color":q.tipcolor})},function(){q.autoleft(),q.tiptop=q.top+q.height+10,r.removeclass("layertipst").addclass("layertipsb").css({"border-right-color":q.tipcolor})},function(){q.tipleft=q.left-o[0]+10,q.tiptop=q.top,r.removeclass("layertipsr").addclass("layertipsl").css({"border-bottom-color":q.tipcolor})}],q.where[c.tips.guide](),0===c.tips.guide?q.top-(e.scrolltop()+o[1]+16)<0&&q.where[2]():1===c.tips.guide?e.width()-(q.left+q.width+o[0]+16)>0||q.where[3]():2===c.tips.guide?q.top-e.scrolltop()+q.height+o[1]+16-e.height()>0&&q.where[0]():3===c.tips.guide?o[0]+16-q.left>0&&q.where[1]():4===c.tips.guide,k.css({left:q.tipleft,top:q.tiptop})}c.fadein&&(f.fade(k,c.fadein,1),f.fade(d("#xubox_shade"+a),c.fadein,c.shade[0])),c.fix&&""===c.offset[0]&&!c.shift&&e.on("resize",function(){k.css({top:(e.height()-k.outerheight())/2})}),b.move()},h.pt.shift=function(a,b,c){var k,d=this,f=d.config,g=d.layere,h=0,i=e.width(),j=e.height()+(f.fix?0:e.scrolltop());switch(h="50%"==f.offset[1]||""==f.offset[1]?g.outerwidth()/2:g.outerwidth(),k={t:{top:d.offsettop},b:{top:j-g.outerheight()-f.border[0]},cl:h+f.border[0],ct:-g.outerheight(),cr:i-h-f.border[0]},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:d.offsetleft},b)}},h.pt.autoarea=function(a){var c,e,f,h,i,k,j,l,m,n,o,b=this;switch(a=a||b.index,c=b.config,e=c.page,f=d("#"+g[0]+a),h=f.find(g[2]),i=f.find(g[5]),j=c.title?h.innerheight():0,l=0,"auto"===c.area[0]&&i.outerwidth()>=c.maxwidth&&f.css({width:c.maxwidth}),c.type){case 0:m=f.find(".xubox_botton>a"),k=f.find(g[3]).outerheight()+20,m.length>0&&(l=m.outerheight()+20);break;case 1:n=f.find(g[4]),k=d(e.dom).outerheight(),"auto"===c.area[0]&&f.css({width:n.outerwidth()}),(""!==e.html||""!==e.url)&&(k=n.outerheight());break;case 2:f.find("iframe").css({width:f.outerwidth(),height:f.outerheight()-(c.title?h.innerheight():0)});break;case 3:o=f.find(".xubox_loading"),k=o.outerheight(),i.css({width:o.width()})}"auto"===c.area[1]&&i.css({height:j+k+l}),d("#xubox_border"+a).css({width:f.outerwidth()+2*c.border[0],height:f.outerheight()+2*c.border[0]}),layer.ie6&&"auto"!==c.area[0]&&i.css({width:f.outerwidth()}),"50%"!==c.offset[1]&&""!=c.offset[1]||4===c.type?f.css({marginleft:0}):f.css({marginleft:-f.outerwidth()/2})},h.pt.move=function(){var a=this,b=a.config,c={sety:0,movelayer:function(){var a;a=0==parseint(c.layere.css("margin-left"))?parseint(c.move.css("left")):parseint(c.move.css("left"))+-parseint(c.layere.css("margin-left")),"fixed"!==c.layere.css("position")&&(a-=c.layere.parent().offset().left,c.sety=0),c.layere.css({left:a,top:parseint(c.move.css("top"))-c.sety})}},f=a.layere.find(b.move);b.move&&f.attr("move","ok"),b.move?f.css({cursor:"move"}):f.css({cursor:"auto"}),d(b.move).on("mousedown",function(a){if(a.preventdefault(),"ok"===d(this).attr("move")){c.ismove=!0,c.layere=d(this).parents("."+g[0]);var f=c.layere.offset().left,h=c.layere.offset().top,i=c.layere.width()-6,j=c.layere.height()-6;d("#xubox_moves")[0]||d("body").append(''),c.move=d("#xubox_moves"),b.movetype&&c.move.css({opacity:0}),c.movex=a.pagex-c.move.position().left,c.movey=a.pagey-c.move.position().top,"fixed"!==c.layere.css("position")||(c.sety=e.scrolltop())}}),d(document).mousemove(function(a){var d,f,g,h;c.ismove&&(d=a.pagex-c.movex,f=a.pagey-c.movey,a.preventdefault(),b.moveout||(c.sety=e.scrolltop(),g=e.width()-c.move.outerwidth()-b.border[0],h=b.border[0]+c.sety,dg&&(d=g),h>f&&(f=h),f>e.height()-c.move.outerheight()-b.border[0]+c.sety&&(f=e.height()-c.move.outerheight()-b.border[0]+c.sety)),c.move.css({left:d,top:f}),b.movetype&&c.movelayer(),d=null,f=null,g=null,h=null)}).mouseup(function(){try{c.ismove&&(c.movelayer(),c.move.remove()),c.ismove=!1}catch(a){c.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,c=a.config,e=c.dialog;a.openlayer(),a.config.success(b),layer.ie6&&a.ie6(b),b.find(".xubox_close").on("click",function(){c.close(a.index),layer.close(a.index)}),b.find(".xubox_yes").on("click",function(){c.yes?c.yes(a.index):e.yes(a.index)}),b.find(".xubox_no").on("click",function(){c.no?c.no(a.index):e.no(a.index),layer.close(a.index)}),a.config.shadeclose&&d("#xubox_shade"+a.index).on("click",function(){layer.close(a.index)}),b.find(".xubox_min").on("click",function(){layer.min(a.index,c),c.min&&c.min(b)}),b.find(".xubox_max").on("click",function(){d(this).hasclass("xubox_maxmin")?(layer.restore(a.index),c.restore&&c.restore(b)):(layer.full(a.index,c),c.full&&c.full(b))}),f.config.end[a.index]=c.end},f.reselect=function(){d.each(d("select"),function(){var c=d(this);c.parents("."+g[0])[0]||1==c.attr("layer")&&d("."+g[0]).length<1&&c.removeattr("layer").show(),c=null})},h.pt.ie6=function(a){var f,b=this,c=a.offset().top;f=b.config.fix?function(){a.css({top:e.scrolltop()+c})}:function(){a.css({top:c})},f(),e.scroll(f),d.each(d("select"),function(){var c=d(this);c.parents("."+g[0])[0]||"none"==c.css("display")||c.attr({layer:"1"}).hide(),c=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 d(a).parents("."+g[0]).attr("times")},layer.getchildframe=function(a,b){return b=b||d("."+g[1]).parents("."+g[0]).attr("times"),d("#"+g[0]+b).find("."+g[1]).contents().find(a)},layer.getframeindex=function(a){return d(a?"#"+a:"."+g[1]).parents("."+g[0]).attr("times")},layer.iframeauto=function(a){var b,c,e,f,h;a=a||d("."+g[1]).parents("."+g[0]).attr("times"),b=layer.getchildframe("body",a).outerheight(),c=d("#"+g[0]+a),e=c.find(g[2]),f=0,e&&(f=e.height()),c.css({height:b+f}),h=-parseint(d("#xubox_border"+a).css("top")),d("#xubox_border"+a).css({height:b+2*h+f}),d("#"+g[1]+a).css({height:b})},layer.iframesrc=function(a,b){d("#"+g[0]+a).find("iframe").attr("src",b)},layer.area=function(a,b){var j,c=[d("#"+g[0]+a),d("#xubox_border"+a)],e=c[0].attr("type"),h=c[0].find(g[5]),i=c[0].find(g[2]);(e===f.type[1]||e===f.type[2])&&(c[0].css(b),h.css({width:b.width,height:b.height}),e===f.type[2]&&(j=c[0].find("iframe"),j.css({width:b.width,height:i?b.height-i.innerheight():b.height})),"0px"!==c[0].css("margin-left")&&(b.hasownproperty("top")&&c[0].css({top:b.top-(c[1][0]?parsefloat(c[1].css("top")):0)}),b.hasownproperty("left")&&c[0].css({left:b.left+c[0].outerwidth()/2-(c[1][0]?parsefloat(c[1].css("left")):0)}),c[0].css({marginleft:-c[0].outerwidth()/2})),c[1][0]&&c[1].css({width:parsefloat(b.width)-2*parsefloat(c[1].css("left")),height:parsefloat(b.height)-2*parsefloat(c[1].css("top"))}))},layer.min=function(a,b){var c=d("#"+g[0]+a),e=[c.position().top,c.position().left+parsefloat(c.css("margin-left"))];f.isauto(c,b,e),layer.area(a,{width:180,height:35}),c.find(".xubox_min").hide(),"page"===c.attr("type")&&c.find(g[4]).hide(),f.rescollbar(a)},layer.restore=function(a){var b=d("#"+g[0]+a),c=b.attr("area").split(",");b.attr("type"),layer.area(a,{width:parsefloat(c[0]),height:parsefloat(c[1]),top:parsefloat(c[2]),left:parsefloat(c[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 i,c=d("#"+g[0]+a),h=2*b.border[0]||6,j=[c.position().top,c.position().left+parsefloat(c.css("margin-left"))];f.isauto(c,b,j),g.html.attr("layer-full")||g.html.css("overflow","hidden").attr("layer-full",a),cleartimeout(i),i=settimeout(function(){layer.area(a,{top:"fixed"===c.css("position")?0:e.scrolltop(),left:"fixed"===c.css("position")?0:e.scrollleft(),width:e.width()-h,height:e.height()-h})},100)},layer.title=function(a,b){var c=d("#"+g[0]+(b||layer.index)).find(".xubox_title>em");c.html(a)},layer.close=function(a){var h,b=d("#"+g[0]+a),c=b.attr("type"),e=d("#xubox_moves, #xubox_shade"+a);if(b[0]){if(c==f.type[1])if(b.find(".xuboxpagehtml")[0])b[0].innerhtml="",b.remove();else for(b.find(".xubox_setwin,.xubox_close,.xubox_botton,.xubox_title,.xubox_border").remove(),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(d(".xubox_loading").parents("."+g[0]).attr("times"))},layer.closetips=function(){layer.closeall("tips")},layer.closeall=function(a){d.each(d("."+g[0]),function(){var b=d(this),c=a?b.attr("type")===a:1;c&&layer.close(b.attr("times")),c=null})},f.run=function(){d=jquery,e=d(a),g.html=d("html"),layer.use("skin/layer.css"),d.layer=function(a){var b=new h(a);return b.index},(new image).src=layer.path+"skin/default/xubox_ico0.png"},i="../../init/jquery",a.seajs?define([i],function(a,b,c){f.run(),c.exports=layer}):f.run()}(window);