bit.popUp={};
bit.popUp.coping={
	buildTag:function(object,tagName){
		var obj=document.createElement(tagName);
		object.appendChild(obj);
		return obj;
	}
	,base:bit.base
	,layerIdArr:[]
	,rollObj:{}
	,load:function(showId,name,width,height,bgId,bgColor,zIndex,diaphaneity,css,fun,returnFun){
		this.bgLayer(bgId,bgColor,zIndex,diaphaneity);
		this.showLayer(bgId,showId,name,width,height,zIndex+1,css,fun,returnFun);
		this.layerIdArr[this.layerIdArr.length]={'showId':showId,'bgId':bgId};
	}
	,bgLayer:function(bgId,bgColor,zIndex,diaphaneity){
		var obj=this.base.$(bgId),width=this.base.dElement().scrollWidth >this.base.dElement().clientWidth?this.base.dElement().scrollWidth :this.base.dElement().clientWidth,height=this.base.dElement().scrollHeight>this.base.dElement().clientHeight?this.base.dElement().scrollHeight:this.base.dElement().clientHeight;
		obj=this.html(obj,bgId,width,height,bgColor,zIndex,0,0,diaphaneity);
		obj.innerHTML='<iframe style="width:100%;height:'+height+'px;filter:alpha(opacity=0);opacity:0"></iframe>';
	}
	,showLayer:function(bgId,showId,name,width,height,zIndex,css,fun,returnFun){
		var obj=this.base.$(showId),left=(this.base.dElement().clientWidth-width)/2,top=(this.base.dElement().clientHeight-height)/2+this.base.dElement().scrollTop;
		obj=this.html(obj,showId,width,height,'',zIndex,left,top,'');
		obj.className=css;
		var str='',pro=this;
		str+='	<div class="title">';
		str+='	<label class="name">'+name+'</label>';
		str+='	<label class="clear" onmouseover="this.className=\'clear on\';" onmouseout="this.className=\'clear\';"></label>';
		str+='	</div>';
		str+='	<div class="content" style="height:'+(height-25)+'px;">';
		str+=fun;
		str+='	</div>';
		obj.innerHTML=str;
		this.base.tagArr(obj,'label')[1].onclick=function(){
			pro.clear(bgId,showId,returnFun);
		};	
		clearTimeout(this.rollObj[showId]);
		//this.roll(showId,(this.base.dElement().clientHeight-height)/2);
	}
	,html:function(obj,id,width,height,bgColor,zIndex,left,top,diaphaneity){
		if(!obj){
			obj=this.buildTag(document.body,'div');
			obj.id=id;
		}else{
			obj.style.display='block';
		}
		obj.style.width=width+'px';
		obj.style.height=height+'px';
		if(bgColor){obj.style.backgroundColor=bgColor;}		
		obj.style.position='absolute';
		obj.style.zIndex=zIndex;
		obj.style.left=left+'px';
		obj.style.top=top+'px';
		if(diaphaneity){this.base.alpha(obj,diaphaneity);}
		return obj;
	}
	,clear:function(bgId,showId,returnFun){
		if(returnFun){returnFun(this.layerIdArr[this.layerIdArr.length-2]?this.layerIdArr[this.layerIdArr.length-2]:document);}
		this.base.$(bgId).style.display='none';
		this.base.$(bgId).innerHTML='';
		this.base.$(showId).style.display='none';		
		this.layerIdArr.pop();
		clearTimeout(this.rollObj[showId]);
	}
	,roll:function(id,top){
		var obj=this.base.$(id);
		var space=top+this.base.dElement().scrollTop,objTop=parseInt(this.base.style(obj).top),pro=this,a;
		if(objTop<space){
			a=(space-objTop)*0.01;
			obj.style.top=objTop+a*10+'px';
		}else if(objTop>space){
			a=(objTop-space)*0.01;
			obj.style.top=objTop-a*10+'px';
		}
		this.rollObj[id]=setTimeout(function(){pro.roll(id,top)},10);
	}
};
