/**
 * @author	王亚飞
 * @email	ew.yafei@gmail.com
 * @version	1.2
 * @date	13/08/29
 *  
 *  使用方法：
 *  			WAY.box.show({'xxx':'yyy'});
 *  			WAY.box.hide();
 *  
 * opacity : 透明度 number 例如:30 默认70
 * mask : 是否有遮盖 boolean 默认 true
 * topsplit : 计算弹层距离顶部距离时的切割值（值越大距离顶部越近）例如：3 默认：2
 * width : 弹层宽度 number 默认：auto
 * height : 弹层高度 number 默认：auto
 * fixed : 是否使用fixed boolean 默认true
 * ismove : 是否可以移动 boolean 默认false
 * barcolor : 移动条的颜色 string 默认：#999
 * top : 距离顶部距离 number 默认：自适应
 * left : 距离左侧距离 number 默认：自适应
 * autohide : 自动隐藏时间 number 例如：3/秒
 * bkcolor : 弹出层边缘背景色 默认在有拖动条的时候颜色设置为:#fff
 * html : 直接添加html代码
 * 
 * v.12更新：
 * 1.不再使用克隆的方法，而是直接把节点呈现上来
 * 2.自动清除定位信息
 * 3.增加直接添加html代码的功能
 * 
 * 特别提醒：弹出框需要外面再空加一层div，若不是在div下边可以不加
 */
WAY={};WAY.box=(function(){var d,b,e,a=0,f,g,c=1;return{show:function(h){g={opacity:70,mask:1,topsplit:2,width:0,height:0,fixed:1,ismove:0,html:0};for(i in h){g[i]=h[i]}if(!a){d=document.createElement("div");d.className="wouter";b=document.createElement("div");b.className="winner";e=document.createElement("div");e.className="wconter";a=document.createElement("div");a.className="wmask";f=document.createElement("div");f.className="wtoolbar";f.innerHTML="<a href='javascript:void(0);' style='cursor:pointer; color:#000; float:right; text-decoration:none; padding:2px 5px 0 0; font: 24px blod;' onclick='WAY.box.hide();'>&times;</a>";document.body.appendChild(d);d.appendChild(b);b.appendChild(f);b.appendChild(e);document.body.appendChild(a);window.onresize=WAY.box.resize;WAY.box.addMove();f.style.height="30px";f.style.cursor="move";f.style.borderRadius="5px 5px 0 0";d.style.zIndex="9999";d.style.borderRadius="7px 7px 0 0";d.style.display="none";a.style.zIndex="9998";a.style.position="absolute";a.style.top=a.style.left=0;a.style.display="none";e.style.padding="10px"}else{e.innerHTML="";clearTimeout(b.timer)}if(g.ismove){f.style.display="";d.style.boder="1px solid #000"}else{f.style.display="none";d.style.background=""}f.style.background=g.barcolor||"#999";d.style.position=g.fixed?"fixed":"absolute";b.style.width=g.width?g.width+"px":"auto";b.style.height=g.height?g.height+"px":"auto";a.style.opacity=g.opacity/100;a.style.filter="alpha(opacity="+g.opacity+")";a.style.background=g.bkcolor||"#000";a.style.display=g.mask?"":"none";if(g.divid){c=document.getElementById(g.divid);if(c!=null){c.style.display="";c.style.position="static";c.style.marginLeft="0";c.style.marginRight="0";c.style.marginTop="0";c.style.marginBotton="0";c.style.top="0";c.style.left="0";e.placeholder=c.parentNode;e.appendChild(c);d.style.display="";f.style.width=0+"px"}}else{if(g.html){e.innerHTML=g.html;d.style.display=""}}WAY.box.size();if(g.autohide){b.timer=setTimeout(WAY.box.hide,g.autohide*1000)}},size:function(){var j,h;b.style.width="";b.style.height="";if(!g.width){j=parseInt(e.offsetWidth)}if(!g.height){h=parseInt(e.offsetHeight)}if(g.ismove){h+=30}f.style.width=j+"px";b.style.height=h+"px";b.style.width=j+"px";WAY.box.resize()},addMove:function(){f.onmousedown=function(j){j=WAY.util.getEvent(j);var k=j.clientX-WAY.util.delPx(d.style.left),h=j.clientY-WAY.util.delPx(d.style.top);document.onmousemove=function(l){l=WAY.util.getEvent(l);d.style.left=l.clientX-k+"px";d.style.top=l.clientY-h+"px";return false};f.onmouseup=function(){document.onmousemove=null;f.onmouseup=null;return false}}},resize:function(){WAY.box.pos();WAY.box.remask()},pos:function(){var h;if(typeof g.top!="undefined"){h=g.top}else{h=WAY.page.height()/g.topsplit-d.offsetHeight/2;h=h<20?20:h}if(!g.fixed&&!g.top){h+=WAY.page.top()}d.style.top=h+"px";d.style.left=typeof g.left!="undefined"?g.left+"px":(WAY.page.width()-d.offsetWidth)/2+"px"},remask:function(){a.style.width=WAY.page.swidth()+"px";a.style.height=WAY.page.sheight()+"px"},hide:function(){d.style.display="none";a.style.display="none";if(typeof e.placeholder!="undefined"){e.placeholder.appendChild(c);e.placeholder=undefined}}}})();WAY.page=(function(){var e,b,c;function a(){e=document,b=e.documentElement,c=e.body;return e.compatMode=="BackCompat"}return{top:function(){a();return Math.max(c.scrollTop,b.scrollTop)},width:function(){return a()?c.clientWidth:b.clientWidth},height:function(){return a()?c.clientHeight:b.clientHeight},swidth:function(){return a()?Math.max(c.clientWidth,c.scrollWidth):Math.max(b.clientWidth,b.scrollWidth)},sheight:function(){return a()?Math.max(c.clientHeight,c.scrollHeight):Math.max(b.clientHeight,b.scrollHeight)},createXHR:function(){if(typeof XMLHttpRequest!="undefined"){return new XMLHttpRequest()}else{if(typeof ActiveXObject!="undefined"){if(typeof arguments.callee.activeXString!="string"){var f=["MSXML2.XMLHttp.6.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp"],h,d;for(h=0,d=f.length;h<d;h++){try{new ActiveXObject(f[h]);arguments.callee.activeXString=f[h];break}catch(g){}}}return new ActiveXObject(arguments.callee.activeXString)}else{throw new Error("No XHR object available.")}}}}})();WAY.util=(function(){return{delPx:function(a){return parseInt(a.substring(0,a.length-2))},getEvent:function(a){return a||window.event}}})();