var Dialog={};
Dialog.dialogName="dialogName";
Dialog.init=function(src,h,w){
	    var dialogName=this.dialogName;
		//var h=document.body.clientHeight;
		this.dialogBgDiv=document.createElement("div");
		this.rootDiv=document.createElement("div");
		this.src=src;
		this.bgZIndex=100;
		this.dialogBgDiv.id=dialogName;
		this.dialogBgDiv.style.position="absolute";
		this.dialogBgDiv.style.top="0px";
		this.dialogBgDiv.style.left="0px";
		this.dialogBgDiv.style.height=((document.body.clientHeight>document.body.scrollHeight)?document.body.clientHeight:document.body.scrollHeight)+"px";
		this.dialogBgDiv.style.width="100%"
		this.dialogBgDiv.style.zIndex=this.bgZIndex;
		this.dialogBgDiv.style.background="#000";
		this.dialogBgDiv.style.padding="0px";
		this.dialogBgDiv.style.display="block"; 
		this.dialogBgDiv.style.textAlign="center";
		this.dialogBgDiv.style.filter="alpha(opacity=60)";
		this.dialogBgDiv.style.opacity=50/100;
		document.body.appendChild(this.dialogBgDiv);
		
		//操作的DIV
		this.rootDiv.style.border=" 1px solid #477291";
		this.rootDiv.style.clear="both";
		this.rootDiv.style.padding="0px";
		this.rootDiv.style.background="#3A6EA5";
		this.rootDiv.style.height=(h+20)+"px";
		this.rootDiv.style.width=(w+20)+"px";
		this.rootDiv.style.zIndex=this.bgZIndex+10;
		this.rootDiv.style.position="absolute";	
		this.rootDiv.id=dialogName+"Box";
		this.rootDiv.style.left=(document.body.clientWidth/2-w/2)+"px";
		this.rootDiv.style.top=this.getScrollTop()+100+"px";
		document.body.appendChild(this.rootDiv);
		//关闭
		closeDiv=document.createElement("div");
		closeDiv.style.background="url(../images/login1.png)";
		//closeDiv.style.background="#828BCA";
		closeDiv.style.clear="both";
		closeDiv.style.color="#FFFFFF";
		closeDiv.style.textAlign="right";
		closeDiv.style.fontSize="12px";
		closeDiv.style.lineHeight="21px";
		closeDiv.style.padding="2px 10px 0px 0px ";
		
		closeDiv.innerHTML='<a href=\"#\" onclick=\"Dialog.close();\" style=\"color:#cccccc;font-weight:bold;text-decoration:none;\">关闭</a>';
		this.rootDiv.appendChild(closeDiv);
		//主体
		frameDiv=document.createElement("div");
		frameDiv.style.padding="4px 4px 4px 10px";
		frameDiv.style.clear="both";
		frameDiv.style.height=h+"px";
		frameDiv.style.width=w+"px";
		iframe=document.createElement("iframe");
		iframe.frameBorder="0";
		iframe.hspace="0";
		iframe.vspace="0";
		iframe.width=w+"px";
		iframe.height=h+"px";
		iframe.src=this.src;
		iframe.style.border="0px";
		iframe.scrolling="yes";		
		frameDiv.appendChild(iframe);
		frameDiv.focus();
		this.rootDiv.appendChild(frameDiv);
	}
	
	Dialog.close=function(){
	document.body.removeChild(document.getElementById(this.dialogName));
	document.body.removeChild(document.getElementById(this.dialogName+"Box"));
	}	
	
	Dialog.getScrollTop=function(){
	var w3c=(document.getElementById)? true: false;
	var agt=navigator.userAgent.toLowerCase();
	var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
	return ie?((document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body).scrollTop:window.pageYOffset;
	
	//自适应高度iframe	
	
}


