/*** ·¹ÀÌ¾î ÆË¾÷Ã¢ ¶ç¿ì±â ***/
function popupLayer(s,w,h)
{
	var type;
	if (w=="img"){
		type = "img";
		var img = document.createElement("div");
		img.innerHTML = "<img src='" + s + "' style='cursor:pointer'>";
		img.style.position = "absolute";
		img.style.top = -9999;
		img.onclick = closeLayer;
		document.body.appendChild(img);
		w = img.childNodes[0].offsetWidth;
		h = img.childNodes[0].offsetHeight;
	} else {	
		if (!w) w = 1024;
		if (!h) h = 768;
	}

	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;

	hiddenSelectBox('hidden');

	/*** ¹é±×¶ó¿îµå ·¹ÀÌ¾î ***/
	var bg = document.createElement("div");
	with (bg.style){
		position = "absolute";
		left = 0;
		top = 0;
		width = document.body.clientWidth;
		//height = document.body.scrollHeight;
		height = document.body.clientHeight;
		backgroundColor = "#000000";
		filter = "Alpha(Opacity=50)";
	}

	bg.id = "objPopupLayerBg";
	document.body.appendChild(bg);

	/*** ³»¿ëÇÁ·¹ÀÓ ·¹ÀÌ¾î ***/
	var obj = document.createElement("div");
	var _y = posY + document.body.scrollTop;
	with (obj.style){
		position = "absolute";
		background = "#ffffff";
		left = posX + document.body.scrollLeft;
		top = (_y>1) ? _y : 1;
		width = w;
		height = h;
		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>close</font></a>&nbsp;&nbsp;&nbsp;";
	obj.appendChild(bottom);

	if (type=="img"){
		img.style.position = "relative";
		img.style.top = 0;
		obj.appendChild(img);
		height = (document.body.scrollHeight>document.body.clientHeight) ? document.body.scrollHeight : document.body.clientHeight;
		bg.style.height = height;
	} else {	
		/*** ¾ÆÀÌÇÁ·¹ÀÓ ***/
		var ifrm = document.createElement("iframe");
		with (ifrm.style){
			width = w - 6;
			height = h - pixelBorder * 2 - titleHeight - 3;
			//border = "3 solid #000000";
		}
		ifrm.frameBorder = 0;
		ifrm.src = s;
		//ifrm.scrolling = (arguments[3]) ? "yes" : "no";
		ifrm.scrolling =  "yes";
		//ifrm.className = "scroll";
		obj.appendChild(ifrm);
	}
}
function closeLayer()
{
	hiddenSelectBox('visible');
	_ID('objPopupLayer').removeNode(true);
	_ID('objPopupLayerBg').removeNode(true);
}
function hiddenSelectBox(mode)
{
	var obj = document.getElementsByTagName('select');
	for (i=0;i<obj.length;i++){
		obj[i].style.visibility = mode;
	}
}