// CMS Dialog 1.1

	function OpenDialogWindow(IframeWidth,IframeHeight,IframeSrc,DialogTitle)
	{  
	   //获取常量
	   var IE = (navigator.appName=="Microsoft Internet Explorer"); 
	   var LIE = (navigator.appVersion.indexOf("MSIE 6")>0 || navigator.appVersion.indexOf("MSIE 5")>0); 
	   
	   var ElementOffsetHeight = document.documentElement.offsetHeight;
	   var ElementOffsetWidth = document.documentElement.offsetWidth;
	   var ElementClientHeight = document.documentElement.clientHeight;
	   var ElementClientWidth = document.documentElement.clientWidth;
	   var ElementScrollHeight = document.documentElement.scrollHeight;
	   var ElementScrollWidth = document.documentElement.scrollWidth;
	   
	   var BodyOffsetHeight = document.body.offsetHeight;
	   var BodyOffsetWidth = document.body.offsetWidth;
	   var BodyClientHeight = document.body.clientHeight;
	   var BodyClientWidth = document.body.clientWidth;
	   var BodyScrollHeight = document.body.scrollHeight;
	   var BodyScrollWidth = document.body.scrollWidth;
	   
	   var BodyHeight;
	   var BodyWidth;
	   
	   var NavigatorHeight;
	   var NavigatorWidth;
	   
	   //设置框架参数
	   if(IE)
	   {
		 if(ElementClientHeight==0)
		 {
		   BodyHeight=BodyClientHeight;
		   BodyWidth=BodyClientWidth;
		   
		   NavigatorHeight=BodyScrollHeight;
		   NavigatorWidth=BodyScrollWidth;
		 }
		 else
		 {
		   BodyHeight=ElementClientHeight;
		   BodyWidth=ElementClientWidth;
		   
		   NavigatorHeight=ElementScrollHeight;
		   NavigatorWidth=ElementScrollWidth;
		 }
	   }
	   else
	   {
		 BodyHeight=(ElementClientHeight>=BodyClientHeight)?ElementClientHeight:BodyClientHeight;
		 BodyWidth=(ElementClientWidth>=BodyClientWidth)?ElementClientWidth:BodyClientWidth;
		   
		 if(ElementOffsetHeight != ElementClientHeight)
		   BodyHeight=ElementClientHeight;
		 if(BodyOffsetHeight != BodyClientHeight)
		   BodyHeight=BodyClientHeight;
		   
		 NavigatorHeight=(ElementScrollHeight>=BodyScrollHeight)?ElementScrollHeight:BodyScrollHeight;
		 NavigatorWidth=(ElementScrollWidth>=BodyScrollWidth)?ElementScrollWidth:BodyScrollWidth;
	   }
		  
	   //屏蔽页面
	   var bgObj=document.createElement("div"); 
	   bgObj.setAttribute('id','bgDiv'); 
	   bgObj.style.position="absolute"; 
	   bgObj.style.top="0";   
	   bgObj.style.left="0"; 
	   bgObj.style.width=NavigatorWidth + "px"; 
	   bgObj.style.height=NavigatorHeight + "px"; 
	   bgObj.style.zIndex = "10000";
	   
	   if(LIE)
	   {
		 var iframeObj=document.createElement("iframe"); 
		 iframeObj.setAttribute('id','bodyIframe'); 
		 iframeObj.src="/images/DBG.gif";
		 iframeObj.frameBorder=0;
		 iframeObj.scrolling="no";
		 iframeObj.style.width=NavigatorWidth + "px";
		 iframeObj.style.height=NavigatorHeight + "px";
		 iframeObj.style.opacity="0.75";
		 iframeObj.style.filter="Alpha(opacity=75)";
		 bgObj.appendChild(iframeObj);
	   }
	   else
	   {
		 var imgObj=document.createElement("img"); 
		 imgObj.setAttribute('id','bodyImg'); 
		 imgObj.src="/images/DBG.gif";
		 imgObj.style.width=NavigatorWidth + "px";
		 imgObj.style.height=NavigatorHeight + "px";
		 imgObj.style.opacity="0.75";
		 if(IE)
		   imgObj.style.filter="Alpha(opacity=75)";   
		 bgObj.appendChild(imgObj); 
	   }
	   document.body.appendChild(bgObj); 
	   
	   //对话框
	   var dialogObj=document.createElement("div"); 
	   dialogObj.setAttribute('id','dialogDiv'); 
	   dialogObj.style.position="absolute"; 
	   dialogObj.style.top="0px";   
	   dialogObj.style.left="0px";  
	   dialogObj.style.zIndex = "10002";
	   if(LIE)
	   {
		 dialogObj.innerHTML = "<table border=0 cellspacing=0 cellpadding=0><tr><td class=TopDIV style='background:#F2F2F2; font-family: Arial; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 1px; border-left-width: 2px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #A5A5A5; border-right-color: #A5A5A5; border-bottom-color: #A5A5A5; border-left-color: #A5A5A5;' valign=top><table width=100% border=0 cellspacing=2 cellpadding=4 id=DialogTitle style='cursor:move'><tr><td class=DialogTitle style='color:#888888; font-size: 16px; text-align: left; padding-bottom: 16px; font-weight: bold;'>"+ DialogTitle +"</td><td class=CloseButton style='text-align: right; vertical-align: top;'><a href=\"javascript:CloseDialogWindow();\"><img src=/images/CLB.gif height=12 width=12 border=0 /></a></td></tr></table></td></tr><tr><td class=BottomDIV style='border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-right-color: #A5A5A5; border-bottom-color: #A5A5A5; border-left-color: #A5A5A5; background:#FFFFFF;'><iframe src="+ IframeSrc +" width="+ IframeWidth +" height="+ IframeHeight +" frameborder=0 scrolling=auto></iframe></td></tr></table>";
	   }
	   else
	   {
		 dialogObj.innerHTML = "<table border=0 cellspacing=0 cellpadding=0><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=TopDIV style='background:#F2F2F2; font-family: Arial; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 1px; border-left-width: 2px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #A5A5A5; border-right-color: #A5A5A5; border-bottom-color: #A5A5A5; border-left-color: #A5A5A5;' valign=top><table width=100% border=0 cellspacing=2 cellpadding=4 id=DialogTitle style='cursor:move'><tr><td class=DialogTitle style='color:#888888; font-size: 16px; text-align: left; padding-bottom: 16px; font-weight: bold;'>"+ DialogTitle +"</td><td class=CloseButton style='text-align: right; vertical-align: top;'><a href=\"javascript:CloseDialogWindow();\"><img src=/images/CLB.gif height=12 width=12 border=0 /></a></td></tr></table></td></tr><tr><td class=BottomDIV style='border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-right-color: #A5A5A5; border-bottom-color: #A5A5A5; border-left-color: #A5A5A5; background:#FFFFFF;'><iframe src="+ IframeSrc +" width="+ IframeWidth +" height="+ IframeHeight +" frameborder=0 scrolling=auto></iframe></td></tr></table></td><td style='background-image:url(/images/DS5.png);background-repeat:no-repeat;'></td></tr><tr><td style='background-image:url(/images/DS7.png);background-repeat:no-repeat;'></td><td width=20 height=20><img src=/images/DS8.png width=20 height=20 /></td></tr></table>";
	   }
	   document.body.appendChild(dialogObj); 
		  
	   //后期处理   
	   var ObjHeight = dialogObj.offsetHeight;
	   var ObjWidth = dialogObj.offsetWidth;
	   var ObjTop = (BodyHeight - ObjHeight) / 2;
	   var ObjLeft = (BodyWidth - ObjWidth) / 2;
	   
	   dialogObj.style.top=ObjTop + "px";   
	   dialogObj.style.left=ObjLeft + "px";  
	   dialogObj.style.width=ObjWidth + "px";  
	   dialogObj.style.height=ObjHeight + "px";
	   
	   //阴影处理
	   if(LIE)
	   {     
		 var shadowObj=document.createElement("div"); 
		 shadowObj.setAttribute('id','shadowDiv'); 
		 shadowObj.style.position="absolute"; 
		 shadowObj.style.top=ObjTop + "px";   
		 shadowObj.style.left=ObjLeft + "px";   
		 shadowObj.style.width=ObjWidth + "px";  
		 shadowObj.style.height=ObjHeight + "px";  
		 shadowObj.style.zIndex = "10001";
		 shadowObj.innerHTML = "<table style='filter : progid:DXImageTransform.Microsoft.Blur(makeShadow=true,pixelRadius=5.0,shadowOpacity=0.50);' width="+ObjWidth+" height="+ObjHeight+" border=0 cellspacing=0 cellpadding=0 bgcolor=#000000><tr><td></td></tr></table>";
		 document.body.appendChild(shadowObj);
	   } 
		 
	   //处理拖动
	   var posX;
	   var posY;                
	
	   document.getElementById("DialogTitle").onmousedown=function(e)
	   {
		 if(!e) e = window.event;            
		 posX = e.clientX - parseInt(dialogObj.style.left);
		 posY = e.clientY - parseInt(dialogObj.style.top);
		 document.onmousemove = mousemove;            
	   }
	   document.getElementById("DialogTitle").onselectstart=function()
	   {
		 return false;          
	   }   
	   document.onmouseup = function()
	   {
		 document.onmousemove = null;
	   }
	   function mousemove(ev)
	   {
		 if(ev==null) ev = window.event;
		 dialogObj.style.top = (ev.clientY - posY) + "px";
		 dialogObj.style.left = (ev.clientX - posX) + "px"; 
		 if(LIE)
		 {
		   shadowObj.style.top=dialogObj.style.top;
		   shadowObj.style.left=dialogObj.style.left;      
		 }
	   }
	}
	function CloseDialogWindow()
	{
	   document.body.removeChild(document.getElementById('bgDiv'));
	   document.body.removeChild(document.getElementById('dialogDiv'));
	   if(document.getElementById('shadowDiv'))
		 document.body.removeChild(document.getElementById('shadowDiv'));
	}
