function popuplayer(t,s,w,h)
{
	if (!w) w = 600;
	if (!h) h = 400;
	if (!t) t = "POPUP WINDOWS";
	var pixelBorder = 3;
	var titleHeight = 15;
	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 obj = document.createElement("DIV");
	with (obj.style){
		position = "absolute";
		left = 0;
		top = 0;
		width = "100%";
		height = document.body.scrollHeight;
		backgroundColor = "#CCCCCC";
		filter = "Alpha(Opacity=70)";
		opacity = "0.5";
	}
	obj.id = "objPopupLayerBg";
	document.body.appendChild(obj);

	/*** ³»¿ëÇÁ·¹ÀÓ ·¹ÀÌ¾î ***/
	var obj = document.createElement("SPAN");
	obj_top = posY + document.body.scrollTop;
	if( eval(obj_top)<=0 ){ obj_top = 0; }
	with (obj.style){
		position = "absolute";
		left = posX + document.body.scrollLeft;
		top = obj_top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = "3px solid #000000";
	}
	obj.id = "objPopupLayer";
	document.body.appendChild(obj);

	/*** Å¸ÀÌÆ²¹Ù ·¹ÀÌ¾î ***/
	var top = document.createElement("SPAN");
	with (top.style){
		position = "absolute";
		width = w - pixelBorder * 2;
		height = titleHeight;
		left = 0;
		top = 0;
		padding = "0px 0px 2px 0px";
		textAlign = "left";
		backgroundColor = "#000000";
		color = "#ffffff";
		font = "bold 11px tahoma";
	}
	top.innerHTML = "<table width='100%' cellspacing='0' cellpadding='0' style='table-layout:fixed;'><tr><td align='left' valign='top' style='padding-left:5px;' width='100%' nowrap><b style='color:#FFFFFF;font-family:Tahoma Dotum;font-size:11px;'>"+t+"<b></td><td align='center' valign='top' style='padding:2px 5px 2px 5px;cursor:hand;color:#DDDDDD;' title='Close' width='18' onclick='javascript:closeLayer()' onmouseover=\"this.style.backgroundColor='#cccccc';this.style.color='#000000';\"  onmouseout=\"this.style.backgroundColor='#000000';this.style.color='#DDDDDD';\" nowrap><b style='font-family:Verdana;font-size:7px;'>X</b></td></tr></table>";
	obj.appendChild(top);
/*
	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 0px 0px 0px";
		textAlign = "right";
		backgroundColor = "#333333";
		color = "#ffffff";
		font = "bold 11px tahoma";
	}
	bottom.innerHTML = "<a href='javascript:closeLayer()' style='color:#ffffff;'>close</a>&nbsp;&nbsp;&nbsp;";
	obj.appendChild(bottom);
/*
	/*** ¾ÆÀÌÇÁ·¹ÀÓ ***/
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w - 6;
		height = h;
		backgroundColor = "#FFFFFF";
		paddingTop = titleHeight;
	}
	ifrm.frameBorder = 0;
	ifrm.src = s;
	obj.appendChild(ifrm);
}

function hiddenSelectBox(mode)
{
	var obj = document.getElementsByTagName('select');
	for (i=0;i<obj.length;i++){
//		obj[i].style.visibility = mode;
	}
}

function closeLayer()
{
	hiddenSelectBox('visible');
	getID('objPopupLayer').parentNode.removeChild( getID('objPopupLayer') );
	getID('objPopupLayerBg').parentNode.removeChild( getID('objPopupLayerBg') );
}
function getID(obj){return document.getElementById(obj)}




/*-------------------------------------
ÀÚ¹Ù½ºÅ©¸³Æ® µ¿Àû ·Îµù
-------------------------------------*/
function exec_script(src)
{
	var scriptEl = document.createElement("script");
	scriptEl.src = src;
	getID('dynamic').appendChild(scriptEl);
}


function categoryBox(name,idx,val,type,formnm,id)
{

	var id = (id)?id:'';
	var formnm = (formnm)?formnm:'';
	if (!idx) idx = 1;
	if (type=="multiple") type = "multiple size='7' style='width:160px;' ";
	for (i=0;i<idx;i++) document.write("<select " + type + "  style='font-size:11px;font-family:Verdana;' idx=" + i + " name='" + name + "' onchange=\"categoryBox_request(this,'','"+id+"')\" class='select'></select>");

	oForm = eval("document.forms['" + formnm + "']");
	if ( oForm == null ) this.oCate = eval("document.forms[0]['" + name + "']");
	else{ this.oCate = eval("document." + oForm.name + "['" + name + "']"); }

	if (idx==1) this.oCate = new Array(this.oCate);

	this.categoryBox_init = categoryBox_init;
	this.categoryBox_build = categoryBox_build;
	this.categoryBox_init();

	function categoryBox_init()
	{
		this.categoryBox_build();
		categoryBox_request(this.oCate[0],val,id);
	}

	function categoryBox_build()
	{
		for (i=0;i<idx;i++){
			if (this.oCate[i]){
				this.oCate[i].options[0] = new Option("- "+(i+1)+"Â÷ ºÐ·ù -","");
			}
		}
	}

}

function categoryBox_request(obj,val,id)
{
	var id = (id)?id:'';
	if (!val) val = "";
	if (!id) id = "";
	var idx = obj.getAttribute('idx');
	exec_script("../admins/category.script.php?mode=admin&idx=" + idx + "&obj=" + obj.name + "&formnm=" + obj.form.name + "&val=" + val + "&category=" + obj.value + "&id=" + id);
/*
	if ( document.location.href.indexOf("/admin") == -1 ){
		exec_script("../admins/category.script.php?mode=admin&idx=" + idx + "&obj=" + obj.name + "&formnm=" + obj.form.name + "&val=" + val + "&category=" + obj.value + "&id=" + id);
	}
	else {
		exec_script("../admins/category.script.php?mode=admin&idx=" + idx + "&obj=" + obj.name + "&formnm=" + obj.form.name + "&val=" + val + "&category=" + obj.value + "&id=" + id);
	}
*/
}








var isGecko = 0;
var isIE5 = 0;
var Agt = navigator.userAgent.toLowerCase();
if ( navigator.product == "Gecko" )	{
	isGecko = 1;
} else if( Agt.indexOf("msie") != -1 && Agt.indexOf("opera") == -1 ) {
	if( Agt.indexOf("msie 5.0") != -1 ) isIE5 = 1;
}


var eko = 0;
function keyup(){
	if( !isGecko ) {
		var ekey = window.event.keyCode;
		if( ekey == 16 ) { eko=0; }
		keydown();
	}
}
function keydown(){
	var ekey = window.event.keyCode;
	var search_display = document.getElementById('SEARCH_AUTO_KEYWORD_TABLE').style.display;
	var search_frm = document.search_form;
		switch(ekey){
		case 27:
			try{top.closeLayer();}catch(e){}
			try{parent.closeLayer();}catch(e){}
			try{closeLayer();}catch(e){}
		break;
		case(38):
						search_list_move('up');
		break;
		case(40):
						search_list_move('dn'); 
		break;
		default:
//						alert(document.search_form.st.onfocusin);
//						if(  ) {
					 		//search_frm.search_word.style.imeMode = 'active';
							search_keyword(); 
//						} else {
//							search_auto_open('img');
//						}
		break;}

/* == Shift + ¹öÆ° Å¬¸¯ÀÌº¥Æ®
	if( ekey == 16 ) { eko=16; }
	if( eko==16 ) {
		switch(ekey){
		case 65:
			option_popup('product/option_popup.php?type=image');
		break;
		case 83:
			option_popup('product/option_popup.php?type=kada');
		break;
		case 68:
			option_popup('product/option_popup.php?type=rsize');
		break;
		case 70:
			option_popup('product/option_popup.php?type=busok');
		break;}
	}
*/
}

document.onkeydown=keydown;
document.onkeyup=keyup;