
j.overLayer=new j.Class().extend({option:{Lay:null,color:"#fff",Opacity:50,zIndex:1000},initialize:function(options){this.SetOption(options);var body=document.body||document.documentElement;this.Lay=j.$(this.option.Lay)||body.insertBefore(document.createElement("div"),body.childNodes[0]);this.Opacity=parseInt(this.option.Opacity);this.zIndex=parseInt(this.option.zIndex);with(this.Lay.style){display="none";zIndex=this.zIndex;left=top=0;position="fixed";width=height="100%";}
if(j.Browser.isIE6){this.Lay.style.position="absolute";this._resize=j.bind(this,function(){this.Lay.style.width=Math.max(document.documentElement.scrollWidth,document.documentElement.clientWidth)+"px";this.Lay.style.height=Math.max(document.documentElement.scrollHeight,document.documentElement.clientHeight)+"px";});this.Lay.innerHTML='<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);"></iframe>'}},show:function(){if(j.Browser.isIE6){this._resize();window.attachEvent("onresize",this._resize);}
with(this.Lay.style){j.Browser.isIE?filter="alpha(opacity:"+this.Opacity+")":opacity=this.Opacity/100;backgroundColor=this.option.color;display="block";}},hide:function(){this.Lay.style.display="none";if(j.Browser.isIE6){window.detachEvent("onresize",this._resize);}}});j.layer=new j.Class().extend({option:{Over:true,Fixed:false,Center:false,onShow:function(){}},initialize:function(layer,options){this.Box=j.$(layer);this.OverLay=new j.overLayer(options);this.SetOption(options);this.Fixed=!!this.option.Fixed;this.Over=!!this.option.Over;this.Center=!!this.option.Center;this.onShow=this.option.onShow;this.Box.style.zIndex=this.OverLay.zIndex+1;this.Box.style.display="none";if(j.Browser.isIE6){this._top=this._left=0;this._select=[];this._fixed=j.bind(this,function(){this.Center?this.SetCenter():this.SetFixed();});}},show:function(options){j.extend(this.option,options||{});this.Fixed=!!this.option.Fixed;this.Over=!!this.option.Over;this.Center=!!this.option.Center;this.Box.style.position=this.Fixed&&!j.Browser.isIE6?"fixed":"absolute";this.Over&&this.OverLay.show();this.Box.style.display="block";if(this.Center){this.Box.style.top=this.Box.style.left="50%";if(this.Fixed){this.Box.style.marginTop=-this.Box.offsetHeight/2+"px";this.Box.style.marginLeft=-this.Box.offsetWidth/2+"px";}else{this.SetCenter();}}
if(j.Browser.isIE6){if(!this.Over){this._select.length=0;j.each(document.getElementsByTagName("select"),j.bind(this,function(o){if(!Contains(this.Box,o)){o.style.visibility="hidden";this._select.push(o);}}))}
this.Center?this.SetCenter():this.Fixed&&this.SetFixed();this.Fixed&&window.attachEvent("onscroll",this._fixed);}
this.onShow();},hide:function(){this.Box.style.display="none";this.OverLay.hide();if(j.Browser.isIE6){window.detachEvent("onscroll",this._fixed);j.each(this._select,function(o){o.style.visibility="visible";});}},SetFixed:function(){this.Box.style.top=document.documentElement.scrollTop-this._top+this.Box.offsetTop+"px";this.Box.style.left=document.documentElement.scrollLeft-this._left+this.Box.offsetLeft+"px";this._top=document.documentElement.scrollTop;this._left=document.documentElement.scrollLeft;},SetCenter:function(){this.Box.style.marginTop=document.documentElement.scrollTop-this.Box.offsetHeight/2+"px";this.Box.style.marginLeft=document.documentElement.scrollLeft-this.Box.offsetWidth/2+"px";}});