isIE=document.all; 
isNN=!document.all&&document.getElementById; 
isN4=document.layers; 
isHot=false; 

function ddInit(e){ 
  topDog=isIE ? "BODY" : "HTML"; 
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){ 
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode; 
  }  
  if (hotDog.id=="titleBar"){ 
    offsetx=isIE ? event.clientX : e.clientX; 
    offsety=isIE ? event.clientY : e.clientY; 
    nowX=parseInt(whichDog.style.left); 
    nowY=parseInt(whichDog.style.top); 
    ddEnabled=true; 
    document.onmousemove=dd; 
  } 
} 

function dd(e){ 
  if (!ddEnabled) return; 
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety; 
  return false;  
} 

function ddN4(whatDog){ 
  if (!isN4) return; 
  N4=eval(whatDog); 
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP); 

N4.onmousedown=function(e){ 
    N4.captureEvents(Event.MOUSEMOVE); 
    N4x=e.x; 
    N4y=e.y; 
  } 
  N4.onmousemove=function(e){ 
    if (isHot){ 
      N4.moveBy(e.x-N4x,e.y-N4y); 
      return false; 
    } 
  } 
  N4.onmouseup=function(){ 
    N4.releaseEvents(Event.MOUSEMOVE); 
  } 
} 

function hideMe(){ 
        document.all.theLayer.style.display = ""; 
        document.all.theLayer.style.display = "none"; 
} 

function showMe(){ 
        document.all.theLayer.style.display = "none"; 
        document.all.theLayer.style.display = ""; 
} 

document.onmousedown=ddInit; 
document.onmouseup=Function("ddEnabled=false"); 


function _ID(obj){return document.getElementById(obj)}

function popupLayer(s,w,h)
{
	if (!w) w = 600;
	if (!h) h = 400;

	var pixelBorder = 3;
	var titleHeight = 12;
	w += pixelBorder * 2;
	h += pixelBorder * 2 + titleHeight;

	var bodyW = document.body.clientWidth;
	var bodyH = document.body.clientHeight;

	var posX = (bodyW - w) / 2;
	var posY = (bodyH - h) / 2;

	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = 0;
		top = 0;
		width = "100%";
		height = document.body.scrollHeight;
		backgroundColor = "#000000";
		filter = "Alpha(Opacity=50)";
		opacity = "0.5";
	}
	obj.id = "objPopupLayerBg";
	document.body.appendChild(obj);

	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = posX + document.body.scrollLeft;
		top = posY + document.body.scrollTop;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = "3px solid #000000";
	}
	obj.id = "objPopupLayer";
	document.body.appendChild(obj);

	var bottom = document.createElement("div");
	with (bottom.style){
		position = "absolute";
		width = w - pixelBorder * 2;
		height = titleHeight;
		left = 0;
		top = h - titleHeight - pixelBorder * 3;
		padding = "2px 0 0 0";
		textAlign = "right";
		backgroundColor = "#000000";
		color = "#ffffff";
		font = "bold 11px tahoma";
	}
	bottom.innerHTML = "<a href='javascript:closeLayer()'><font color='#FFFFFF'>Ã¢´Ý±â</font></a>&nbsp;&nbsp;&nbsp;";
	obj.appendChild(bottom);

	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w - 6;
		height = h - pixelBorder * 2 - titleHeight - 3;
	}
	ifrm.frameBorder = 0;
	ifrm.src = s;
	obj.appendChild(ifrm);
}

function closeLayer(){
	_ID('objPopupLayer').parentNode.removeChild( _ID('objPopupLayer') );
	_ID('objPopupLayerBg').parentNode.removeChild( _ID('objPopupLayerBg') );
}