function getCookie( name ){
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length )
        {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                        break;
        }
        return "";
}
function doBlink() 
{
	var blink = document.all.tags("BLINK");
	for (var i=0; i<blink.length; i++) {
		if (blink[i].style.filter != "gray()")
		{
			blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "";
		}
		else {
			blink[i].style.visibility = "";
		}
	}
}
function startBlink() 
{
	if (document.all) {
		setInterval("doBlink()",500);
	}
}
window.onLoad = startBlink();

function getMallHref(cat,uid)
{
	var url;
	
	url  = "./mall.php?cat=" + cat;
	url += (uid) ? "&query=view&no=" + uid : "";
	location.href = url;
	return false;
}
function faq_content(a,b,c,d)
{
	location.href = "./bbs.php?table=" + a + "&p=" + b + "&faq_uid=" + c +  "#faq" + c;
}
function getGroupbuyHref(cat,uid)
{
	var url;
	
	url  = "./groupbuy.php?";
	url += (cat) ? "&cat=" + cat : "";
	url += (uid) ? "&query=view&no=" + uid : "";
	location.href = url;
	return false;
}
function getAuctionHref(cat,uid)
{
	var url;
	
	url  = "./auction.php?";
	url += (cat) ? "&cat=" + cat : "";
	url += (uid) ? "&query=view&no=" + uid : "";
	location.href = url;
	return false;
}
function getBbsHref(table,query,uid,p,option)
{
	switch	(query) 
	{		
		case "delete" :
		if (!confirm('\n[È®ÀÎ]À» ¼±ÅÃÇÏ½Ã¸é °ð¹Ù·Î »èÁ¦µË´Ï´Ù.\n\nÁ¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?                           \n')) return;
		break;
	}

	var url;
	
	url  = "./bbs.php?table=" + table;
	url += (query)	? "&query=" + query : "";
	url += (uid)	? "&uid=" + uid : "";
	url += (p)		? "&p=" + p : "";
	url += (option)	? option : "";
	location.href = url;
}
function cafe_getBbsHref(table,query,uid,p,option,cafe,my)
{
	switch	(query) 
	{		
		case "delete" :
		if (!confirm('\n[È®ÀÎ]À» ¼±ÅÃÇÏ½Ã¸é °ð¹Ù·Î »èÁ¦µË´Ï´Ù.\n\nÁ¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?                           \n')) return;
		break;
	}

	var url;
	
	url  = "./cafe_bbs.php?table=" + table;
	url += (query)	? "&query=" + query : "";
	url += (uid)	? "&uid=" + uid : "";
	url += (p)		? "&p=" + p : "";
	url += (cafe)		? "&cafe=" + cafe : "";
	url += (my)		? "&menu_uid=" + my : "";
	url += (option)	? option : "";
	location.href = url;
}
function getBbsWin(table,query,uid)
{
	var url;
	
	url  = "./bbs.php?table=" + table;
	url += (query)	? "&query=" + query : "";
	url += (uid)	? "&uid=" + uid : "";
	window.open(url, 'printwin' , 'width=750,height=650,scrollbars=yes');
}
function getBbsDown(table,type,uid,no)
{
	window.open('./bbs.php?action=down_data&table=' + table + '&type=' + type + '&uid=' + uid + '&no=' + no , 'downwin' , 'scrollbars=yes,width=100,height=100,top=3000,left=0');
}
function Get_MainLayerHeight(fix)
{
	var gheight = (fix) ? fix : document.body.scrollHeight;
	top.document.all['main_iframe'].style.height = gheight + 50;
	
	top.document.all['main_iframe'].style.width = '100%';
	if (document.body.scrollWidth > 1024)
	{
		top.document.all['main_iframe'].style.width = document.body.scrollWidth;
	}
}
function Get_WindowHeight(width,height)
{
	resizeTo(width,document.body.scrollHeight + height);
}
function OpenZipcode(pwd,fname,z1,z2,ad,ad1) 
{
	var gpwd = (pwd) ? pwd : '.';
	var url = gpwd+'/pack/zipsearch/zipcode.php?form='+fname+'&zip1='+z1+'&zip2='+z2+'&address='+ad+'&address1='+ad1;
	window.open(url,'zip_win','width=460,height=550,statusbar=no,scrollbars=yes,toolbar=no');
}
function commaSplit(srcNumber) 
{ 
	var txtNumber = '' + srcNumber; 

	var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])'); 
	var arrNumber = txtNumber.split('.'); 
	arrNumber[0] += '.'; 
	do { 
		arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2'); 
	} 
	while (rxSplit.test(arrNumber[0])); 
	if (arrNumber.length > 1) { 
		return arrNumber.join(''); 
	} 
	else { 
		return arrNumber[0].split('.')[0]; 
	} 
}
function commaInsert(field)
{
	field.value = commaSplit(filterNum(field.value));
}
function filterNum(str) 
{ 
	re = /^\$|,/g; 
	return str.replace(re, ""); 
}
function TypeCheck (s, spc) 
{
	var i;

	for(i=0; i< s.length; i++) 
	{
		if (spc.indexOf(s.substring(i, i+1)) < 0) 
		{
			return false;
		}
	}        
	return true;
}
function clearField(field)
{
	if (field.value == field.defaultValue) {
		field.value = "";
	}
}
function checkField(field)
{
	if (!field.value) {
		field.value = field.defaultValue;
	}
}
function getSort(f,new_sort,new_orderby)
{
	f.sort.value = new_sort;
	f.orderby.value = new_orderby;
	f.submit();
}
function getPageGo(f,new_p)
{
	f.p.value = new_p;
	f.submit();
}
function is_number(){
	if ((event.keyCode<48)||(event.keyCode>57)){
		alert("\n¼ýÀÚ¸¸ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.             \n");
		event.returnValue=false;
	}
}
function view_pic(uid,skin,type)
{
	var url = "./instance/picviewer/" + skin + "/viewer.php?type=" + type + "&uid=" + uid;
	window.open(url,'pic_win','scrollbars=no,width=750,height=550');
}
function view_movie(url)
{
	window.open(url,'movie_win', 'width=600,height=400,scrollbars=no');
	return false;
}
function OpenZipcode(pwd,fname,z1,z2,ad,ad1) 
{
	var gpwd = (pwd) ? pwd : '.';
	var url = gpwd+'/pack/zipsearch/zipcode.php?form='+fname+'&zip1='+z1+'&zip2='+z2+'&address='+ad+'&address1='+ad1;
	window.open(url,'zip_win','width=460,height=550,statusbar=no,scrollbars=yes,toolbar=no');
}
function getJeolsa(money , num , alt)
{
	var money = ''+parseInt(money)+'';
	var jeolsa = money.substr(money.length - num , num);
	var rmoney = money - jeolsa;
	if (alt && jeolsa != '0')
	{
		alert(jeolsa + '¿øÀÌ Àý»çµÇ¾ú½À´Ï´Ù.       ');
	}
	return rmoney;
}
function menulog_check()
{
	var f = document.menulog_form;

	if (!f.MB_ID.value)
	{
		alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä              ');
		f.MB_ID.focus();
		return false;
	}
	if (!f.MB_PW.value)
	{
		alert('ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä              ');
		f.MB_PW.focus();
		return false;
	}
}
function mb_check(ths)
{
	if (ths.checked == true)
	{
		if (!confirm('\n\nÆÐ½º¿öµåÁ¤º¸¸¦ ÀúÀåÇÒ °æ¿ì ´ÙÀ½Á¢¼Ó½Ã \n\nÆÐ½º¿öµå¸¦ ÀÔ·ÂÇÏÁö ¾ÊÀ¸¼Åµµ µË´Ï´Ù.\n\n±×·¯³ª, °³ÀÎPC°¡ ¾Æ´Ò °æ¿ì Å¸ÀÎÀÌ ·Î±×ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.     \n\nPC¸¦ ¿©·¯»ç¶÷ÀÌ »ç¿ëÇÏ´Â °ø°øÀå¼Ò¿¡¼­´Â Ã¼Å©ÇÏÁö ¸¶¼¼¿ä.\n\nÁ¤¸»·Î ÆÐ½º¿öµå¸¦ ±â¾ï½ÃÅ°°Ú½À´Ï±î?\n\n'))
		{
			ths.checked = false;
		}
	}
}


function mypage_view(n)
{
	var l = document.all.kims_mypage_lay;
	
	if (n)
	{
		var x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX;
		var y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY;
		
		l.style.top = y;
		l.style.left = x + 20;
		l.style.visibility = "visible";
	}
	else {
		l.style.top = 0;
		l.style.left = -500;
		l.style.visibility = "hidden";
	}
}
function mouse_over(t)
{
	t.style.backgroundColor='#21558C';
	t.style.color='FFFFFF';
}
function mouse_out(t)
{
	t.style.backgroundColor='FFFFFF';
	t.style.color='000000';
}
function idpass_search() 
{
	window.open('./include/lib/idpass_search.php', 'passsearch','width=450,height=262,statusbar=no,scrollbars=no,toolbar=no');
}

/********************************************************************* ¼­ºê¸Þ´º ·¹ÀÌ¾î */
function sub_MenuShow(cat)
{
	eval("document.all.sub_menu_" + cat).style.visibility = "visible";
}

function sub_MenuHide(cat)
{
	eval("document.all.sub_menu_" + cat).style.visibility = "hidden";
}
/********************************************************************* ¼­ºê¸Þ´º Åä±Û */
function submenu_togle_on(num,sj)
{
	var gnum = parseInt(num) + 1;
	for (var j = 1; j < gnum; j++ ){
		eval("document.all.sub_menu_" + j).style.display = "none";
	}
	eval("document.all.sub_menu_" + sj).style.display = "block";
}
function emotion_change(i)
{
	var j;

	for(j = 1; j < 19; j++) {
		if (i != j)
		{
			eval("document.all.emotion_img_" + j).style.filter = "gray()";
			eval("document.all.emotion_lay_" + j).style.filter = "gray()";
			eval("document.all.emotion_tbl_" + j).style.background = "";
			eval("document.all.emotion_tbl_" + j).style.border = "1 solid efefef";
		}
		else {
			eval("document.all.emotion_img_" + j).style.filter = "";
			eval("document.all.emotion_lay_" + j).style.filter = "";
			eval("document.all.emotion_tbl_" + j).style.background = "ffffff";
			eval("document.all.emotion_tbl_" + j).style.border = "1 solid c0c0c0";
		}
	}
	document.WriteForm.BB_EMOTION.value = i;
}

function sorry_comment()
{
	alert('\nÈ¸¿øÀ¸·Î ·Î±×ÀÎÇÏ¼Å¾ß µî·ÏÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.        \n');
	return false;
}
function sorry_qna()
{
	alert('\nÈ¸¿øÀ¸·Î ·Î±×ÀÎÇÏ¼Å¾ß µî·ÏÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.        \n');
	return false;
}
function comment_submit_check()
{
	var f = document.WriteForm;

	if (!f.member_id.value)
	{
		if (!f.VT_NAME.value)
		{
			alert('\nÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.           \n');
			f.VT_NAME.focus();
			return false;
		}
	}
	if (!f.VT_VOTE.value)
	{
		alert('\nÆò°¡Á¡¼ö¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.           \n');
		f.VT_VOTE.focus();
		return false;
	}
	if (!f.VT_CONTENT.value)
	{
		alert('\nÆò°¡³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.           \n');
		f.VT_CONTENT.focus();
		return false;
	}
}

function comment_del(vid)
{
	var f = document.WriteForm;
	if (!confirm('\nÁ¤¸»·Î Æò°¡±ÛÀ» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?           \n'))
	{
		return false;
	}
	f.action.value = "comment_delete";
	f.vid.value = vid;
	f.submit();
}
function comment_del_1(vid,p)
{
	if (!confirm('\nÁ¤¸»·Î Æò°¡±ÛÀ» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?           \n'))
	{
		return false;
	}
	location.href = "./mall.php?action=comment_delete&where=mypage&vid=" + vid + "&p=" + p;
}

function comment_write(type,no,enable,id)
{
	if (enable == "checked" && id == '')
	{
		alert('\nÈ¸¿øÀ¸·Î ·Î±×ÀÎÇÏ¼Å¾ß µî·ÏÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.        \n');
		return false;
	}
	document.all.mall_comment_lay.style.display = "block";
}


function qna_write(type,no,enable,id)
{
	if (enable == "checked" && id == '')
	{
		alert('\nÈ¸¿øÀ¸·Î ·Î±×ÀÎÇÏ¼Å¾ß µî·ÏÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.        \n');
		return false;
	}
	document.all.mall_qna_lay.style.display = "block";
}
function qna_all(type,no)
{
	window.open('');
}
function qna_submit_check()
{
	var f = document.QnaForm;
	if (!f.QA_SUBJECT.value)
	{
		alert('\n¹®ÀÇÁ¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.         \n');
		f.QA_SUBJECT.focus();
		return false;
	}
	if (!f.member_id.value)
	{
		if (!f.QA_NAME.value)
		{
			alert('\nÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.           \n');
			f.QA_NAME.focus();
			return false;
		}
	}
	if (!f.QA_CONTENT.value)
	{
		alert('\n¹®ÀÇ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.           \n');
		f.QA_CONTENT.focus();
		return false;
	}
}
function gQnaView(cat,no,qa_uid,qa_reply,type)
{
	location.href = "./"+type+".php?cat=" + cat + "&query=view&no=" + no + "&qa_uid=" + qa_uid + "&qa_reply=" + qa_reply + "#opq";
}
function gQnaView_1(qa_uid,qa_reply,p)
{
	location.href = "./mypage.php?query=myqna&p=" + p + "&qa_uid=" + qa_uid + "&qa_reply=" + qa_reply + "#opq";
}
function goods_cmp()
{
	var f = document.goods_list;
	var i;
	var chk = 0;
	var gg_que = "";
	
	for (i = 0; i < f.length; i++)
	{
		if (f[i].name.substring(0,6) == "multi_" && f[i].checked == true)
		{
			chk++;
			gg_que += "&" + f[i].name + "=" + f[i].value;
		}
	}
	if (!chk)
	{
		alert('\nºñ±³ÇÒ »óÇ°À» ¼±ÅÃÇØ ÁÖ¼¼¿ä.            \n');
		return false;
	}
	if (chk < 2)
	{
		alert('\n»óÇ°ºñ±³´Â Àû¾îµµ 2°³ ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.           \n');
		return false;
	}
	if (chk > 5)
	{
		alert('\n»óÇ°ºñ±³´Â 5°³ÀÌ³»·Î ¼±ÅÃÇØ ÁÖ¼¼¿ä.           \n');
		return false;
	}
	location.href = "./search.php?query=multi" + gg_que;
}
function n_order_view()
{
	var f = document.order_form;
	var oid  = f.oid.value;
	var name = f.name.value;
	var type = f.type.value;

	if (!oid || !name)
	{
		alert('\nÁÖ¹®¹øÈ£È­ ÁÖ¹®ÀÚÀÌ¸§À» Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼Å¾ß              \n\nÁÖ¹®,¹è¼Û»óÅÂ Á¶È¸°¡ °¡´ÉÇÕ´Ï´Ù \n');
		return false;
	}
	window.open('./include/lib/order_'+type+'.php?oid=' + oid + '&name=' + name,'order_win','scrollbars=yes,width=700,height=650');
}
function sub_category_open()
{
	var ly = document.all.sub_category_list.style.display;
	document.all.sub_category_list.style.display = (ly == 'none') ? 'block' : 'none';
}
function num_plus(ths , danwee , f)
{
	var f = (!f) ? document.view_form : f;
	var jaego = parseInt(filterNum(f.jaego.value));
	var ipgo = parseInt(f.ipgo.value);
	var fnum = parseInt(ths.value);
	ths.value = fnum + parseInt(danwee);
	ths.focus();

	if (ipgo != 0) {
		if (fnum > jaego-1)
		{
			alert('\nÀç°í¼ö·®À» ÃÊ°úÇÏ¿´½À´Ï´Ù.          \n');
			ths.value = fnum;
			return false;
		}
	}
}
function num_minus(ths , danwee , f)
{
	var f = (!f) ? document.view_form : f;
	var jaego = parseInt(filterNum(f.jaego.value));
	var ipgo = parseInt(f.ipgo.value);
	var fnum = parseInt(ths.value);
	
	ths.value = (fnum > parseInt(danwee)) ? fnum - parseInt(danwee) : parseInt(danwee);
	ths.focus();
}
function jaego_check(ths , danwee, f)
{
	var f = (!f) ? document.view_form : f;
	var jaego = parseInt(filterNum(f.jaego.value));
	var ipgo = parseInt(f.ipgo.value);
	var fnum = parseInt(ths.value);
	var i;
	if (ipgo != 0) {
		if (ths.value % parseInt(danwee))
		{
			alert('\nº» Á¦Ç°Àº '+danwee+'ÀÇ ¹è¼ö·Î¸¸ ÁÖ¹®ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.           \n');
			ths.value = danwee;
			return false;
		}
		if (fnum > jaego+1)
		{
			alert('\nÀç°í¼ö·®À» ÃÊ°úÇÏ¿´½À´Ï´Ù.          \n');
			ths.value = parseInt(jaego/parseInt(danwee))*parseInt(danwee);
			return false;
		}
	}
}
function chadung_insert(ths,f)
{
	if (!ths.value)
	{
		return false;
	}
	var f = (!f) ? document.view_form : f;
	var cha = ths.value.split('|');
	var j;
	var y = 0;
	
	if (cha[3] != '0' && parseInt(cha[3]) - (parseInt(cha[4]) + parseInt(cha[5])) < 1)
	{
		alert('\nÁË¼ÛÇÕ´Ï´Ù. ¼±ÅÃÇÏ½Å Á¦Ç°Àº Ç°Àý»óÅÂÀÔ´Ï´Ù.           \n');

		for(j = 0; j < ths.options.length; j++) {
			var scha = ths.options[j].value.split('|');
			if (!ths.options[j].value || scha[3] == '0' || parseInt(scha[3]) - (parseInt(scha[4]) + parseInt(scha[5])) > 0)
			{ 
				y++;
				if (y == 1)
				{
					ths.options[j].selected = true;
				}
			}
		}
	}

	var jx = f.js.value;
	view_page_setup(f,jx);

}
function option_insert(ths,f)
{
	if (!ths.value)
	{
		return false;
	}
	var f = (!f) ? document.view_form : f;
	var cha = ths.value.split('|');
	var j;
	var y = 0;
	
	if (cha[4] != '0' && parseInt(cha[4]) - (parseInt(cha[5]) + parseInt(cha[6])) < 1)
	{
		alert('\nÁË¼ÛÇÕ´Ï´Ù. ¼±ÅÃÇÏ½Å ¿É¼ÇÀº Ç°Àý»óÅÂÀÔ´Ï´Ù.           \n');
		if(ths.type == 'radio') {
			ths.checked = false;
		}
		if(ths.type == 'select-one') {
			for(j = 0; j < ths.options.length; j++) {
				var scha = ths.options[j].value.split('|');
				if (!ths.options[j].value || scha[4] == '0' || parseInt(scha[4]) - (parseInt(scha[5]) + parseInt(scha[6])) > 0)
				{ 
					y++;
					if (y == 1)
					{
						ths.options[j].selected = true;
					}
				}
			}
		}
	}
	var jx = f.js.value;
	view_page_setup(f,jx);

	var jaego_tmp = parseInt(cha[4]) - (parseInt(cha[5]) + parseInt(cha[6]));
	f.jaego_option.value = jaego_tmp;
	f.ipgo_option.value  = cha[4];
}


function view_page_setup(f,js)
{
	var f  = (!f)  ? document.view_form : f;
	var js = (!js) ? f.js.value : js;

	var i,j;
	var y = 0;
	var z = 0;
	var g_original = 0;
	var g_price = 0;
	var g_point = 0;
	var g_jaego = (f.price_type.value != "2") ? parseInt(filterNum(f.jaego.value)) : 0;
	var g_ipgo  = (f.price_type.value != "2") ? parseInt(filterNum(f.ipgo.value))  : 0;
	
	if (f.price_type.value == "3")
	{
		f.price.value = "º°µµÇùÀÇ";
		f.point.value = "¹ÌÁ¤";

		if (g_ipgo)
		{	
			eval("document.all.jaego_span"+js).style.visibility = "visible";
			f.jaego.size  = commaSplit(g_jaego).length;
			f.jaego.value = commaSplit(g_jaego);
		}
		else {
			eval("document.all.jaego_span"+js).style.visibility = "hidden";
		}
		
		if (g_ipgo)
		{
			var jaego = parseInt(filterNum(f.jaego.value));
			var fnum = parseInt(f.buy_num.value);
			if (fnum > jaego)
			{
				//alert('\nÁÖ¹®¼ö·®ÀÌ Àç°í¼ö·®º¸´Ù ¸¹¾Æ ÁÖ¹®¼ö·®À»        \n\nÇöÀç Àç°í¼ö·®À¸·Î º¯°æÇÏ¿´½À´Ï´Ù.          \n');
				f.buy_num.value = jaego;
				return false;
			}
		}
		return false;
	}

	for(i = 0; i < f.length; i++)
	{
		if(f[i].name.substr(0,9) == 'tmp_price' && f[i].value)
		{
			var cha = f[i].value.split('|');
			g_original += parseInt(cha[1]);
			g_price += parseInt(cha[1]);
			g_point += parseInt(cha[2]);
			g_ipgo  += parseInt(cha[3]);
			g_jaego += parseInt(cha[3]) - (parseInt(cha[4])+parseInt(cha[5]));
			f.ipgo.value = cha[3];
		}
		if(f[i].name.substr(0,9) == 'tmp_optio' && f[i].value)
		{
			if (f[i].type == 'radio')
			{
				var opt = f[i].value.split('|');
				if (opt[4] != '0' && parseInt(opt[4]) - (parseInt(opt[5]) + parseInt(opt[6])) < 1)
				{
					f[i].checked = false;
				}
				if(f[i].checked == true) {
					g_price += parseInt(opt[2]);
					g_point += parseInt(opt[3]);
				}
			}
			else {
				var opt = f[i].value.split('|');
				if (opt[4] != '0' && parseInt(opt[4]) - (parseInt(opt[5]) + parseInt(opt[6])) < 1)
				{
					for(j = 0; j < f[i].options.length; j++) {
						var scha = f[i].options[j].value.split('|');
						if (scha[4] == '0' || parseInt(scha[4]) - (parseInt(scha[5]) + parseInt(scha[6])) > 0)
						{ 
							y++;
							if (y == 1)
							{
								f[i].options[j].selected = true;
								g_price += parseInt(scha[2]);
								g_point += parseInt(scha[3]);
							}
						}
					}
				}
				else {
					g_price += parseInt(opt[2]);
					g_point += parseInt(opt[3]);
				}
			}
		}
	}
	if (f.price_type.value == "1")
	{
		g_original += parseInt(f.price_original.value);
		g_price += parseInt(f.price_original.value);
		g_point += parseInt(f.point_original.value);
	}

	if (parseInt(f.halin_event_tmp.value))
	{
		var event_halin_price = parseInt(g_original * (parseInt(f.halin_event_tmp.value)/100));
		f.original_price.value = commaSplit(g_original) + "¿ø";
		f.halin_event.value = commaSplit(event_halin_price) + "¿ø ("+f.halin_event_tmp.value+"%)";
		g_price -= event_halin_price;
	}
	if (parseInt(f.halin_member_tmp.value))
	{
		var event_halin_price1 = parseInt(g_original * (parseInt(f.halin_member_tmp.value)/100));
		f.halin_member.value = commaSplit(event_halin_price1) + "¿ø ("+f.halin_member_tmp.value+"%)";
		g_price -= event_halin_price1;
	}


	f.price.value = commaSplit(g_price) + "¿ø";
	f.point.value = commaSplit(g_point) + "¿ø";

	if (g_ipgo)
	{	
		eval("document.all.jaego_span"+js).style.visibility = "visible";
		f.jaego.size  = commaSplit(g_jaego).length;
		f.jaego.value = commaSplit(g_jaego);
	}
	else {
		eval("document.all.jaego_span"+js).style.visibility = "hidden";
	}
	
	if (g_ipgo)
	{
		var jaego = parseInt(filterNum(f.jaego.value));
		var fnum = parseInt(f.buy_num.value);
		if (fnum > jaego)
		{
			//alert('\nÁÖ¹®¼ö·®ÀÌ Àç°í¼ö·®º¸´Ù ¸¹¾Æ ÁÖ¹®¼ö·®À»        \n\nÇöÀç Àç°í¼ö·®À¸·Î º¯°æÇÏ¿´½À´Ï´Ù.          \n');
			f.buy_num.value = jaego;
			return false;
		}
	}

}
function goods_buy(uid,type,skin,f)
{
	var f = (!f) ? document.view_form : f;
	var jx = f.js.value;
	view_page_setup(f,jx);

	if( type == 'buy' || type == 'cart' || type == 'hyup')
	{
		if(parseInt(f.buy_num.value) < 1)
		{
			alert('\nÁË¼ÛÇÕ´Ï´Ù.\n\nº» »óÇ°Àº Ç°Àý»óÅÂÀÔ´Ï´Ù..        \n');
			return false;
		}
	} 

	if ( type == 'buy')
	{
		if (!confirm('Á¤¸»·Î ¹Ù·Î ±¸¸ÅÇÏ½Ã°Ú½À´Ï±î?             '))
		{
			return false;
		}
		f.action.value = type;
		f.submit();
	}
	if ( type == 'cart')
	{
		if (!confirm('Á¤¸»·Î Àå¹Ù±¸´Ï¿¡ ´ãÀ¸½Ã°Ú½À´Ï±î?             '))
		{
			return false;
		}
		f.action.value = type;
		f.submit();
	}
	if ( type == 'hyup')
	{
		if (!confirm('Á¤¸»·Î Á¦Ç°±¸ÀÔÀ» ÀÇ·ÚÇÏ½Ã°Ú½À´Ï±î?             '))
		{
			return false;
		}
		f.action.value = type;
		f.submit();
	}
	if ( type == 'wish')
	{
		if (!f.member_id.value)
		{
			if (!confirm('\n\nÈ¸¿øÀ¸·Î ·Î±×ÀÎÇÏ¼Å¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.           \n\nÁö±Ý ·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?'))
			{
				return false;
			}
			else {
				location.href = "./login.php?pwd="+location.href;
				return false;
			}
		}
		if (!confirm('Á¤¸»·Î À§½Ã¸®½ºÆ®¿¡ ´ãÀ¸½Ã°Ú½À´Ï±î?             '))
		{
			return false;
		}
		var url = "cart.php?action=wish&type=mall&uid=" + uid;
		window.open(url , 'wishwin' , 'top=3000,left=0,width=100,height=100');
	}
	if ( type == 'mail')
	{
		var uid_exp = uid.split(':');
		var url = "./instance/mailer/"+skin+"/mailer.php?type=mall&uid="+uid_exp[0]+"&cat="+uid_exp[1];
		window.open(url,'mail_win', 'width=500,height=500,scrollbars=no');
	}
}
function wish_save(uid,f)
{
	if (!f.member_id.value)
	{
		if (!confirm('\n\nÈ¸¿øÀ¸·Î ·Î±×ÀÎÇÏ¼Å¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.           \n\nÁö±Ý ·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?'))
		{
			return false;
		}
		else {
			location.href = "./login.php?pwd="+location.href;
			return false;
		}
	}
	if (!confirm('Á¤¸»·Î À§½Ã¸®½ºÆ®¿¡ ´ãÀ¸½Ã°Ú½À´Ï±î?             '))
	{
		return false;
	}
	var url = "cart.php?action=wish&type=mall&uid=" + uid;
	window.open(url , 'wishwin' , 'top=3000,left=0,width=100,height=100');
}
function search_win(skin)
{
	window.open('./template/search/'+skin+'/search.php','search_win','width=457,height=360,scrollbars=no');
}




var optLay = new Object();
optLay.count = 1;
function selectLayer(obj,val,func){
        obj.style.display='none';
        optLay[optLay.count] = obj;
        objOpt = optLay[optLay.count].options;
        str = new Array();
        total = objOpt.length;
        tHeight = (16*total);
        out = "<div style='border:1px #848284 solid;width:100%'>"
        +"<table border=0 width=100% cellspacing=0 bgcolor=#ffffff height=21><tr>"
        +"<td id='title_"+optLay.count+"' class='selectTitle' onClick=\"execOpt('"+ optLay.count +"');\" valign=bottom>"+objOpt[0].text+" "
        +"</td><td width=20 align=center><img src=./image/btn_down.gif id='btnImg_"+ optLay.count +"' onClick=\"execOpt('"+ optLay.count +"');\"></td></tr></table></div>"
        +"<div id='optLay_"+optLay.count+"' style='display:none;width:100%;border:1px #848284 solid;height:"+tHeight+"px;overflow:none;background-color:white;position:absolute;width:100%;' class=optLaysub><table border=0 cellpadding=0 cellspacing=0 width=100%>";        
        for(i=0;i<total;i++){
                thisTxt = objOpt[i].text;
                thisVal = objOpt[i].value;
                if(val == thisVal) nowValIndex = i;
                str[i] = "<tr class='selectSub' height=16 onmouseover=\"style.backgroundColor='#21558C';style.color='white'\" onmouseout=\"style.backgroundColor='';style.color='black'\" onClick=\"execOpt('"+ optLay.count + "','" + i + "');"+func+"\" value='"+thisVal+"'><td>"+thisTxt+"</td></tr>";
        }
        out += str.join('');
        out += "</table>";
        document.write(out);
        if(nowValIndex){
                optLay[optLay.count].options[nowValIndex].selected = true;
                document.getElementById("title_"+optLay.count).innerHTML=optLay[optLay.count].options[nowValIndex].text;
        }
        nowValIndex='';
        optLay.count++;
}

function execOpt(n,i){

        objoptLay = document.getElementById("optLay_"+n);
        objBtnImg = document.getElementById("btnImg_"+n);        
        if(objoptLay.style.display=='none'){
                objBtnImg.src='./image/btn_up.gif';
                objoptLay.style.display='block';
        }else{
                if(i){
					optLay[n].options[i].selected = true;
                    document.getElementById("title_"+n).innerHTML=optLay[n].options[i].text;
                        
                }
                objBtnImg.src='./image/btn_down.gif';
                objoptLay.style.display='none';        
        }
}
function roundTable(objID) {
       var obj = document.getElementById(objID);
       var Parent, objTmp, Table, TBody, TR, TD;
       var bdcolor, bgcolor, Space;
       var trIDX, tdIDX, MAX;
       var styleWidth, styleHeight;

       // get parent node
       Parent = obj.parentNode;
       objTmp = document.createElement('SPAN');
       Parent.insertBefore(objTmp, obj);
       Parent.removeChild(obj);

       // get attribute
       bdcolor = obj.getAttribute('rborder');
       bgcolor = obj.getAttribute('rbgcolor');
       radius = parseInt(obj.getAttribute('radius'));
       if (radius == null || radius < 1) radius = 1;
       else if (radius > 6) radius = 6;

       MAX = radius * 2 + 1;
       
       /*
              create table {{
       */
       Table = document.createElement('TABLE');
       TBody = document.createElement('TBODY');

       Table.cellSpacing = 0;
       Table.cellPadding = 0;

       for (trIDX=0; trIDX < MAX; trIDX++) {
              TR = document.createElement('TR');
              Space = Math.abs(trIDX - parseInt(radius));
              for (tdIDX=0; tdIDX < MAX; tdIDX++) {
                     TD = document.createElement('TD');
                     
                     styleWidth = '1px'; styleHeight = '1px';
                     if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
                     else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
                     else if (radius > 2) {
                            if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
                            if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
                     }

                     if (styleWidth != null) TD.style.width = styleWidth;
                     if (styleHeight != null) TD.style.height = styleHeight;

                     if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
                     else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;
                     
                     if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
                     TR.appendChild(TD);
              }
              TBody.appendChild(TR);
       }

       /*
              }}
       */

       Table.appendChild(TBody);
       
       // insert table and remove original table
       Parent.insertBefore(Table, objTmp);
}