/*** ÆË¾÷À» ·¹ÀÌ¾î·Î ¶ç¿ì±â ***/
function PopupLayer(target,wid,hei,scroll)
{
	wid = parseInt(wid);
	hei = parseInt(hei);

	if(!wid) wid = 650;
	if(!hei) hei = 480;

	var pixelBorder = 3;
	var titleHeight = 20;
	wid = wid + pixelBorder * 2;
	hei = hei + pixelBorder * 2 ;

	var BodyWidth = document.body.clientWidth;
	var BodyHeight = document.body.clientHeight;

	var posX = (BodyWidth - wid) / 2;
	var posY = (BodyHeight - hei) / 2;

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

	/*** TITLE VAR ***/
	/*var bottom = document.createElement("div");
	with (bottom.style){
		position = "absolute";
		width = wid - pixelBorder * 2;
		height = titleHeight;
		left = 0;
		top = hei - titleHeight - pixelBorder * 3;
		padding = "10px 0 0 0";
		textAlign = "right";
		backgroundColor = "#FFFFFF";
		color = "#ffffff";
		font = "bold 11px tahoma";

	}
	bottom.innerHTML = "<a href='javascript:CloseLayer()'><font color=155284>ClOSE</font></a>";
	Obj.appendChild(bottom);
*/

	/*** Content Frame ***/

	var Obj = document.createElement("div");
	with (Obj.style){
		position = "absolute";
		left = posX + document.body.scrollLeft;
		top = posY + document.body.scrollTop + titleHeight;
		width = wid;
		height = hei;
		border = "3px solid #FFF";
	}
	Obj.id = "ObjLayer";
	document.body.appendChild(Obj);





	/*** IFRAME ***/
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = wid - 6;
		height = hei - pixelBorder * 2;
	}

	ifrm.frameBorder = 0;
	ifrm.src = target;
	ifrm.scrolling = scroll;
	//ifrm.className = "scroll";
	Obj.appendChild(ifrm);
}
function CloseLayer()
{
	document.getElementById('ObjLayer').removeNode(true);
	document.getElementById('ObjBackGroud').removeNode(true);
}


function ShowAcessMsg(){
	document.write("<iframe name='noshow' frameborder='0' height='0' leftmargin='0' marginheight='0' marginwidth='0' scrolling='no' src='blank.html' topmargin='0' width='0'></iframe>");
	document.write("<div id='incn_waiting' style='position:absolute; left:450px; top:220px; width:292; height: 91; z-index:2; visibility: show'>");
	document.write("<table border=0 width=98% height=10 cellspacing=1 cellpadding=0>");
	document.write("<form name=waiting_form>");
	document.write("<tr>");
	document.write("<td>");
	document.write("<table border=0 cellspacing=0 cellpadding=0 width=100%>");
	document.write("<tr>");
	document.write("<td align=center><b>Á¢±Ù±ÇÇÑÀÌ ¾ø½À´Ï´Ù</b></td>");
	document.write("</table>");
	document.write("</td>");
	document.write("</tr>");
	document.write("</form>");
	document.write("</table>");
	document.write("</div>");
}


function Apt_Gu_list(){
	var obj = document.apt_reg;


	var msg = "mode=gu_list";
	AJAX.create(); 
	AJAX.openXML('POST','intranet/functions/request.php', true);
	AJAX.setStatusSuccessHandler(apt_gu_proc);
	AJAX.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	AJAX.send(msg);
}



function apt_gu_proc(xmlDoc){
	try{
		var obj = document.getElementById("gulist");
		var lst = xmlDoc.getElementsByTagName("list");

		for(var i=0; i<lst.length; i++){
			var val = lst[i].childNodes[0].firstChild.nodeValue;
			var key = lst[i].childNodes[1].firstChild.nodeValue;
			createOptions(obj, val, key);
		}
	}
	catch(e){
		alert(e);
	}
}

function createOptions(sel, val, key){
	if(val == null || val.length==0) return;
	opt = document.createElement("option");
	opt.value = key;
	opt.appendChild(document.createTextNode(val));
	sel.appendChild(opt);

}

function Next_List(f){
	var obj = document.apt_reg;
	var tobj = obj.gulist.options;
	var key = f.value;
	var val = tobj[f.selectedIndex].text;
	Dong_list(key);
}

function Dong_list(key){
	var msg = "mode=dong_list&key="+key;

	AJAX.create(); 
	AJAX.openXML('POST','intranet/functions/request.php', true);
	AJAX.setStatusSuccessHandler(dong_proc);
	AJAX.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	AJAX.send(msg);
}

// 2Â÷ Áö¿ª¸®½ºÆÃ
function dong_proc(xmlDoc){
	try{
		var obj = document.getElementById("donglist");

		while(obj.hasChildNodes()){
			for(var i=0; i<obj.childNodes.length; i++){
				obj.removeChild(obj.firstChild);
			}
		}

		var lst = xmlDoc.getElementsByTagName("list");
		for(var i=0; i<lst.length; i++){
			var val = lst[i].childNodes[0].firstChild.nodeValue;
			var key = lst[i].childNodes[1].firstChild.nodeValue;
			createOptions(obj, val, key);
		}
	}
	catch(e){
		alert(e);
	}
}
