
var createDiv=new Object();
var x1=0;
var y1=0;
var x2=0;
var y2=0;
var x3=0;
var y3=0;
createDiv.createBgDiv=function(obj,Opacity){//创建遮罩 obj对象  Opacity透明度
	if($("createOverDiv")){
		return $("createOverDiv");
	}
	var ofWidth=obj.clientWidth+document.body.scrollLeft+"px";//或者要遮盖元素的宽度
	var ofHeight=obj.clientHeight+document.body.scrollTop+"px";//获取要遮盖元素的高度
	var ofTop=obj.offsetTop+"px";//当前的距离顶点的高度
	var ofLeft=obj.offsetLeft+"px";//当前元素距离左边的宽度
	var cDiv=document.createElement("div");
	cDiv.setAttribute("id","createOverDiv")
	cDiv.style.cssText="width:"+ofWidth+";height:"+ofHeight+";left:0px;top:0px;border:solid 1px #cccccc;position:absolute;filter:Alpha(Opacity:"+Opacity+");z-index:100;background-color:#cccccc;";
	var addDiv=obj.appendChild(cDiv);
	return addDiv;
}
createDiv.closeElement=function(obj){//关闭层
	createDiv.createBgDiv().removeNode(true);
	obj.removeNode(true);
	menuLst.readMenu(menuLst.menuid);
}
createDiv.ifirmClose=function(){//关闭
	parent.bClose.click();
}
createDiv.addElementContent=function(obj,Opacity,width,height,src){//创建实体 obj对象  Opacity透明度 width 宽度 height 高度
	if(src==null||src==""){
		return false;
	}
	var addDiv=createDiv.createBgDiv(obj,Opacity);//创建遮罩
	var creDiv=document.createElement("div");
	var divLeft=document.body.clientWidth/2-width/2;
	var divTop=document.body.clientHeight/2-height/2;
	creDiv.style.cssText="width:"+width+"px;height:"+height+"px;left:"+divLeft+"px;top:"+divTop+"px;border:solid 1px #ffffff;position:absolute;z-index:200;background-color:#a8c1dd;vertical-align:top;text-align:center;filter:Alpha(Opacity:100);";
	creDiv.setAttribute("id","winBigDiv");
	creDiv.onmousedown=function(){
		this.style.cursor="move";
		var bodyContentDiv=$("bodyContentDiv");	
		var bodyWidth=bodyContentDiv.clientWidth;
		var bodyHeight=bodyContentDiv.clientHeight;
		var bodyTop=bodyContentDiv.offsetTop;
		var bodyLeft=bodyContentDiv.offsetLeft;
		var creOverDiv=document.createElement("div");
		creOverDiv.setAttribute("id","twoOverDiv")
		creOverDiv.style.cssText="width:"+bodyWidth+"px;height:"+bodyHeight+"px;left:"+bodyLeft+"px;top:"+bodyTop+"px;border:solid 1px #ffffff;position:absolute;z-index:230;background-color:#e3e3e3;filter:Alpha(Opacity:50);";
		$("winBigDiv").appendChild(creOverDiv);
        x1=getmouseX()-getLeft($("winBigDiv"));
        y1=getmouseY()-getTop($("winBigDiv"));
		if(window.attachEvent){
			 document.body.attachEvent("onmousemove",addDivMove);
			 document.body.attachEvent("onmouseup",addDivUp);
		}else if(window.addEventListener){
			 document.body.addEventListener("mousemove",addDivMove,false);
			 document.body.addEventListener("mouseup",addDivUp,false);
		}else{
			 document.body["onmousemove"]= addDivMove;
			 document.body["onmouseup"]= addDivUp; 
		}		
	}
	var txtMainDiv=document.body.appendChild(creDiv);
	creDiv=document.createElement("div");//头部div
	creDiv.setAttribute("id","titleHeadDiv");
	creDiv.style.cssText="width:100%;height:30px;z-index:249;background-color:#a8c1dd;text-align:right;padding-right:5px;";
	var closeDiv=document.createElement("div");//关闭按钮
	closeDiv.className="bClose_1";
	closeDiv.setAttribute("id","bClose");
	closeDiv.title='关闭';
	closeDiv.onmouseover=function(){
	    this.className="bClose_1";	
	}
	closeDiv.onmouseout=function(){
		this.className="bClose";	
	}
	closeDiv.onclick=function(){//关闭按钮
		createDiv.closeElement(txtMainDiv);
	}
	creDiv.appendChild(closeDiv);
	txtMainDiv.appendChild(creDiv);	
	creDiv=document.createElement("div");//内容div
	var bodyWidth=width-20;
	var bodyHeight=height-50;
	creDiv.style.cssText="width:"+bodyWidth+";height:"+bodyHeight+";z-index:249;margin:0px;";
	creDiv.setAttribute("id","bodyContentDiv")
	var txtNode=document.createElement("iframe");
	txtNode.style.cssText="width:100%;height:100%;margin:0px;";
	txtNode.setAttribute("id","bodyiframe");
	txtNode.setAttribute("frameborder","0");
	if(src.indexOf('?')>-1){
		src+="&t="+create_id();
	}else{
		src+="?t="+create_id();
	}
	txtNode.setAttribute("src",src);
	creDiv.appendChild(txtNode);
	txtMainDiv.appendChild(creDiv);
}
function addDivMove(){//鼠标移动时间
    var winBigDiv=$("winBigDiv");
    x=getmouseX()-x1
    y=getmouseY()-y1
    winBigDiv.style.left=x;
    winBigDiv.style.top=y;
}
function addDivUp(){//鼠标弹起事件
	var bodyContentDiv=$("bodyContentDiv");
	$("winBigDiv").style.cursor="default";
	$("twoOverDiv").removeNode(true);
	if(window.detachEvent){
		  document.body.detachEvent("onmousemove",addDivMove);
		  document.body.detachEvent("onmouseup",addDivUp);
	}else if(window.removeEventListener){
		  document.body.removeEventListener("mousemove",addDivMove,false);
		  document.body.removeEventListener("mouseup",addDivUp,false);
	}else{
		  document.body["onmousemove"]= null;
		  document.body["onmouseup"]= null; 
	}
}