function num_plus(ths , danwee , jaego)
{
	var fnum = parseInt(ths.value);
	ths.value = fnum + parseInt(danwee);

	if (jaego != "No") {
		if (fnum > parseInt(jaego)-1)
		{
			alert('\nÀç°í¼ö·®À» ÃÊ°úÇÏ¿´½À´Ï´Ù.          \n');
			ths.value = jaego;
			return false;
		}
	}
}
function num_minus(ths , danwee , jaego)
{
	var fnum = parseInt(ths.value);
	ths.value = (fnum > parseInt(danwee)) ? fnum - parseInt(danwee) : parseInt(danwee);
}
function jaego_ment(jaego)
{
	alert('º» ¿É¼ÇÀÇ ÇöÀç Àç°í¼ö·®Àº ['+jaego+']ÀÔ´Ï´Ù.        ');
}
function cart_update(num,value,step)
{
	if (!confirm('\nÁ¤¸»·Î ¼ö·®À» º¯°æÇÏ½Ã°Ú½À´Ï±î?          \n'))
	{
		return false;
	}
	location.href = "./cart.php?action=cart_update&buy_num="+ num.value +"&step=" + step + "&value=" + value;
}
function cart_del(value,step)
{
	if (!confirm('\nÁ¤¸»·Î Àå¹Ù±¸´Ï¿¡°Ô Á¦°ÅÇÏ½Ã°Ú½À´Ï±î?          \n'))
	{
		return false;
	}
	location.href = "./cart.php?action=cart_del&step=" + step + "&value=" + value;
}
function cart_op_del(value,step,op_num)
{
	if (!confirm('\nÁ¤¸»·Î ¼±ÅÃÇÏ½Å ¿É¼ÇÀ» Á¦¿ÜÇÏ½Ã°Ú½À´Ï±î?          \n'))
	{
		return false;
	}
	location.href = "./cart.php?action=cart_op_del&op_num="+ op_num +"&step=" + step + "&value=" + value;
}
function cart_wish(uid,id)
{
	if (!id)
	{
		if (!confirm('\n\nÈ¸¿øÀ¸·Î ·Î±×ÀÎÇÏ¼Å¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.           \n\nÁö±Ý ·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?'))
		{
			return false;
		}
		else {
			location.href = "./login.php?pwd=cart.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 cart_empty(step)
{
	if (!confirm('\nÁ¤¸»·Î Àå¹Ù±¸´Ï¸¦ ºñ¿ì½Ã°Ú½À´Ï±î?          \n'))
	{
		return false;
	}
	location.href = "./cart.php?action=cart_empty&step=" + step;
}
function shop_continue()
{
	location.href = "./index.php";
}
function shop_buy(step)
{
	location.href = "./cart.php?query=" + step;
}
function cart_view()
{
	var ly = document.all.cart_layer;
	if (ly.style.display == "none")
	{
		ly.style.display = "block";
	}
	else {
		ly.style.display = "none";
	}
}
function info_same(ths)
{
	var f = document.order_form;
	if (ths.checked == true)
	{
		f.BY_TO_NAME.value = f.BY_BY_NAME.value;
		f.BY_TO_HOME_TEL_1.value = f.BY_BY_HOME_TEL_1.value;
		f.BY_TO_HOME_TEL_2.value = f.BY_BY_HOME_TEL_2.value;
		f.BY_TO_HOME_TEL_3.value = f.BY_BY_HOME_TEL_3.value;
		f.BY_TO_HAND_TEL_1.value = f.BY_BY_HAND_TEL_1.value;
		f.BY_TO_HAND_TEL_2.value = f.BY_BY_HAND_TEL_2.value;
		f.BY_TO_HAND_TEL_3.value = f.BY_BY_HAND_TEL_3.value;
		f.BY_TO_ZIP1.value = f.BY_BY_ZIP1.value;
		f.BY_TO_ZIP2.value = f.BY_BY_ZIP2.value;
		f.BY_TO_ADDR1.value = f.BY_BY_ADDR1.value;
		f.BY_TO_ADDR2.value = f.BY_BY_ADDR2.value;
	}
	else {
		f.BY_TO_NAME.value = '';
		f.BY_TO_HOME_TEL_1.value = '';
		f.BY_TO_HOME_TEL_2.value = '';
		f.BY_TO_HOME_TEL_3.value = '';
		f.BY_TO_HAND_TEL_1.value = '';
		f.BY_TO_HAND_TEL_2.value = '';
		f.BY_TO_HAND_TEL_3.value = '';
		f.BY_TO_ZIP1.value = '';
		f.BY_TO_ZIP2.value = '';
		f.BY_TO_ADDR1.value = '';
		f.BY_TO_ADDR2.value = '';
	}
	f.BY_TO_ADDR2.focus();
}
function pay_lay_hide()
{
	var ly = document.all;
	ly.pay_online_lay.style.display = "none";
	ly.pay_card_lay.style.display = "none";
	ly.pay_mobile_lay.style.display = "none";
	ly.pay_ziro_lay.style.display = "none";
	ly.pay_ziro_lay1.style.display = "none";
	ly.pay_point_lay.style.display = "none";
	ly.pay_multi_lay.style.display = "none";
	ly.pay_multi_lay1.style.display = "none";
	ly.pay_multi_lay2.style.display = "none";
	ly.pay_online_sub_lay.style.display = "none";
}
function pay_reset()
{
	var f  = document.order_form;
	var f1 = document.pay_select;
	for(var i = 0; i < f1.pay_type.length; i++)
	{
		if(f1.pay_type[i].value == f.BY_PAY_TYPE.value) {
			f1.pay_type[i].checked = true;
		}
	}
}
function pay_drop(ths,halin)
{
	var f  = document.order_form;
	var f1 = document.pay_select;
	var ly = document.all;

	if (ths.value == "Àû¸³±Ý")
	{
		if (!f1.member_id.value)
		{
			alert('È¸¿øÀ¸·Î ·Î±×ÀÎÇÏ¼Å¾ß »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.          ');
			ths.checked = false;
			pay_reset();
			return false;
		}
		if (parseInt(f1.member_point.value) < parseInt(f1.enable_point.value))
		{
			alert('\nÀû¸³±ÝÀº ÃÖ¼Ò '+commaSplit(f1.enable_point.value)+'¿ø ÀÌ»óÀÌ¾î¾ß »ç¿ëÀÌ °¡´ÉÇÕ´Ï´Ù.              \n\nÇöÀç °í°´´ÔÀÇ º¸À¯Àû¸³±ÝÀº '+commaSplit(f1.member_point.value)+'¿øÀÔ´Ï´Ù.');
			ths.checked = false;
			pay_reset();
			return false;
		}
		if (parseInt(filterNum(f1.price_total2.value.replace("¿ø" , ""))) > parseInt(f1.member_point.value))
		{
			alert('\nÁ¦Ç°±¸¸Å¾×('+f1.price_total2.value+')ÀÌ °í°´´ÔÀÇ º¸À¯Àû¸³±Ýº¸´Ù ¸¹½À´Ï´Ù.             \n\nÇöÀç °í°´´ÔÀÇ º¸À¯Àû¸³±ÝÀº '+commaSplit(f1.member_point.value)+'¿øÀÔ´Ï´Ù.');
			ths.checked = false;
			pay_reset();
			return false;
		}
	}

	var pr_total = (f1.pr_total.value) ? parseInt(f1.pr_total.value) : 0;
	var ha_total = (f1.ha_total.value) ? parseInt(f1.ha_total.value) : 0;

	if (f1.price_tack.value != "- ¹«·á -" && f1.price_tack.value != "- ÂøºÒ -" && f1.price_tack.value != "- º°µµ -")
	{
		var ta_total = parseInt(filterNum(f1.price_tack.value.replace("¿ø" , "")));
	}
	else {
		var ta_total = parseInt(f1.ta_total.value);
	}
	var jeolsa	 = parseInt(f1.jeolsa.value);

	ha_total  = ha_total + (pr_total*(halin/100));
	pr_total2 = pr_total - ha_total + ta_total;
	pr_total3 = getJeolsa(''+pr_total2+'' , jeolsa , false);

	if ( ths.value == "´ÙÁß°áÁ¦")
	{
		f1.halin_total.value  = commaSplit(parseInt(ha_total)) + "¿ø";
		f1.price_total2.value = commaSplit(pr_total3) + "¿ø";
		f1.price_jeolsa.value = commaSplit(pr_total2 - pr_total3) + "¿ø";
		f.BY_ONLINE_PRICE.value = f1.price_total2.value;
		f.BY_CARD_PRICE.value   = "0¿ø";
		f.BY_POINT_PRICE.value  = "0¿ø";
	}
	else {
		f1.halin_total.value  = commaSplit(parseInt(ha_total)) + "¿ø";
		f1.price_total2.value = commaSplit(pr_total3) + "¿ø";
		f1.price_jeolsa.value = commaSplit(pr_total2 - pr_total3) + "¿ø";
	}

	f.BY_PAY_TYPE.value = ths.value;
	pay_lay_hide();

	switch (ths.value)
	{
		case "¿Â¶óÀÎ" :
		ly.pay_online_lay.style.display = "block";
	    ly.pay_online_sub_lay.style.display = "block";
		break;

		case "½Å¿ëÄ«µå" :
		ly.pay_card_lay.style.display = "block";
		break;

		case "¸ð¹ÙÀÏ" :
		ly.pay_mobile_lay.style.display = "block";
		break;

		case "°èÁÂÀÌÃ¼" :
		ly.pay_ziro_lay.style.display = "block";
		ly.pay_ziro_lay1.style.display = "block";
		break;

		case "Àû¸³±Ý" :
		ly.pay_point_lay.style.display = "block";
		break;

		case "´ÙÁß°áÁ¦" :
		ly.pay_multi_lay.style.display = "block";
		ly.pay_multi_lay1.style.display = "block";
		ly.pay_multi_lay2.style.display = "block";
		break;
	}
}
function multi_price(type, money)
{
	var f  = document.order_form;
	var f1 = document.pay_select;
	
	var halin_online = (f1.halin_online_percent.value)  ? f1.halin_online_percent.value : 0;
	var halin_card   = (f1.halin_card_percent.value)	? f1.halin_card_percent.value : 0;

	var pr_total = (f1.pr_total.value) ? parseInt(f1.pr_total.value) : 0;
	var ha_total = (f1.ha_total.value) ? parseInt(f1.ha_total.value) : 0;

	if (f1.price_tack.value != "- ¹«·á -" && f1.price_tack.value != "- ÂøºÒ -" && f1.price_tack.value != "- º°µµ -")
	{
		var ta_total = parseInt(filterNum(f1.price_tack.value.replace("¿ø" , "")));
	}
	else {
		var ta_total = parseInt(f1.ta_total.value);
	}

	var jeolsa	 = (f1.jeolsa.value) ? parseInt(f1.jeolsa.value) : 0;
	var member_point = (f1.member_point.value) ? parseInt(f1.member_point.value) : 0;

	var card_enable_money  = parseInt(f1.enable_card.value);
	var point_enable_money = parseInt(f1.enable_point.value);

	var element_money= parseInt(filterNum(f1.price_total2.value.replace("¿ø", "")));
	var online_money = parseInt(filterNum(f.BY_ONLINE_PRICE.value.replace("¿ø", "")));
	var card_money   = parseInt(filterNum(f.BY_CARD_PRICE.value.replace("¿ø", "")));
	var point_money  = parseInt(filterNum(f.BY_POINT_PRICE.value.replace("¿ø", "")));

	if (type == 'card')
	{
		if (money == 0)
		{

			var ha_online_money = ((pr_total - point_money) * (halin_online/100));				
			var ha_card_money   = 0;
			var ha_sum_money    = ha_online_money;
			var ha_total_money  = ha_total + ha_sum_money;
			var by_online_money = (pr_total + ta_total) - (ha_total_money + point_money);

			f.BY_CARD_PRICE.value   = "0¿ø";
			f1.halin_total.value    = commaSplit(parseInt(ha_total_money)) + "¿ø";
			f1.price_total2.value   = commaSplit(getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false)) + "¿ø";
			f1.price_jeolsa.value   = commaSplit(parseInt((pr_total + ta_total - ha_total_money) - getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false))) + "¿ø";
			f.BY_ONLINE_PRICE.value = commaSplit(getJeolsa(''+by_online_money+'',jeolsa,false)) + "¿ø";
			
			return false;
		}
		if (money > online_money)
		{
			return false;
		}
		if (card_money + money < card_enable_money)
		{
			alert('½Å¿ëÄ«µå´Â ÃÖ¼Ò '+commaSplit(card_enable_money)+'¿øºÎÅÍ °áÁ¦°¡´ÉÇÕ´Ï´Ù.            ');
			
			var ha_card_money   = (card_enable_money * (halin_card/100));
			var ha_online_money = ((pr_total - (card_enable_money + point_money)) * (halin_online/100));	
			var ha_sum_money    = ha_online_money + ha_card_money;
			var ha_total_money  = ha_total + ha_sum_money;
			var by_online_money = (pr_total + ta_total) - (card_enable_money + point_money + ha_total_money);

			f.BY_CARD_PRICE.value   = commaSplit(card_enable_money) + "¿ø";
			f1.halin_total.value    = commaSplit(parseInt(ha_total_money)) + "¿ø";
			f1.price_total2.value   = commaSplit(getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false)) + "¿ø";
			f1.price_jeolsa.value   = commaSplit(parseInt((pr_total + ta_total - ha_total_money) - getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false))) + "¿ø";
			f.BY_ONLINE_PRICE.value = commaSplit(getJeolsa(''+by_online_money+'',jeolsa,false)) + "¿ø";

			return false;
		}

		var ha_card_money   = ((card_money + money) * (halin_card/100));
		var ha_online_money = ((pr_total - (card_money + point_money + money)) * (halin_online/100));	
		var ha_sum_money    = ha_online_money + ha_card_money;
		var ha_total_money  = ha_total + ha_sum_money;
		var by_online_money = (pr_total + ta_total) - (card_money + point_money + money + ha_total_money);

		f.BY_CARD_PRICE.value   = commaSplit(card_money + money) + "¿ø";
		f1.halin_total.value    = commaSplit(parseInt(ha_total_money)) + "¿ø";
		f1.price_total2.value   = commaSplit(getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false)) + "¿ø";
		f1.price_jeolsa.value   = commaSplit(parseInt((pr_total + ta_total - ha_total_money) - getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false))) + "¿ø";
		f.BY_ONLINE_PRICE.value = commaSplit(getJeolsa(''+by_online_money+'',jeolsa,false)) + "¿ø";
	}

	if (type == 'point')
	{
		if (money == 0)
		{

			var ha_online_money = ((pr_total - card_money) * (halin_online/100));				
			var ha_card_money   = (card_money * (halin_card/100));
			var ha_sum_money    = ha_online_money + ha_card_money;
			var ha_total_money  = ha_total + ha_sum_money;
			var by_online_money = ((pr_total + ta_total) - card_money) - ha_total_money;

			f.BY_POINT_PRICE.value  = "0¿ø";
			f1.halin_total.value    = commaSplit(parseInt(ha_total_money)) + "¿ø";
			f1.price_total2.value   = commaSplit(getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false)) + "¿ø";
			f1.price_jeolsa.value   = commaSplit(((pr_total + ta_total - ha_total_money) - getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false))) + "¿ø";
			f.BY_ONLINE_PRICE.value = commaSplit(getJeolsa(''+by_online_money+'',jeolsa,false)) + "¿ø";
			
			return false;
		}
		if (money > online_money)
		{
			return false;
		}
		if (point_money + money < point_enable_money)
		{
			alert('Àû¸³±ÝÀº ÃÖ¼Ò '+commaSplit(point_enable_money)+'¿øºÎÅÍ »ç¿ë°¡´ÉÇÕ´Ï´Ù.            ');

			var ha_online_money = ((pr_total - (card_money + point_enable_money)) * (halin_online/100));				
			var ha_card_money   = (card_money * (halin_card/100));
			var ha_sum_money    = ha_online_money + ha_card_money;
			var ha_total_money  = ha_total + ha_sum_money;
			var by_online_money = (pr_total + ta_total) - (card_money + point_enable_money + ha_total_money);

			f.BY_POINT_PRICE.value  = commaSplit(point_enable_money) + "¿ø";
			f1.halin_total.value    = commaSplit(parseInt(ha_total_money)) + "¿ø";
			f1.price_total2.value   = commaSplit(getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false)) + "¿ø";
			f1.price_jeolsa.value   = commaSplit(parseInt((pr_total + ta_total - ha_total_money) - getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false))) + "¿ø";
			f.BY_ONLINE_PRICE.value = commaSplit(getJeolsa(''+by_online_money+'',jeolsa,false)) + "¿ø";
		
			return false;
		}
		if (point_money + money > member_point)
		{
			alert('°í°´´Ô²²¼­ º¸À¯ÇÏ°í °è½Å Àû¸³±ÝÀº '+commaSplit(member_point)+'¿ø ÀÔ´Ï´Ù.            ');
			var ha_online_money = ((pr_total - (card_money + member_point)) * (halin_online/100));				
			var ha_card_money   = (card_money * (halin_card/100));
			var ha_sum_money    = ha_online_money + ha_card_money;
			var ha_total_money  = ha_total + ha_sum_money;
			var by_online_money = (pr_total + ta_total) - (card_money + member_point + ha_total_money);

			f.BY_POINT_PRICE.value  = commaSplit(member_point) + "¿ø";
			f1.halin_total.value    = commaSplit(parseInt(ha_total_money)) + "¿ø";
			f1.price_total2.value   = commaSplit(getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false)) + "¿ø";
			f1.price_jeolsa.value   = commaSplit(parseInt((pr_total + ta_total - ha_total_money) - getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false))) + "¿ø";
			f.BY_ONLINE_PRICE.value = commaSplit(getJeolsa(''+by_online_money+'',jeolsa,false)) + "¿ø";

			return false;
		}

		var ha_card_money   = (card_money * (halin_card/100));
		var ha_online_money = ((pr_total - (card_money + point_money + money)) * (halin_online/100));
		var ha_sum_money    = ha_online_money + ha_card_money;
		var ha_total_money  = ha_total + ha_sum_money;
		var by_online_money = (pr_total + ta_total) - (card_money + point_money + money + ha_total_money);

		f.BY_POINT_PRICE.value  = commaSplit(point_money + money) + "¿ø";
		f1.halin_total.value    = commaSplit(parseInt(ha_total_money)) + "¿ø";
		f1.price_total2.value   = commaSplit(getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false)) + "¿ø";
		f1.price_jeolsa.value   = commaSplit(parseInt((pr_total + ta_total - ha_total_money) - getJeolsa(''+(pr_total + ta_total - ha_total_money)+'',jeolsa,false))) + "¿ø";
		f.BY_ONLINE_PRICE.value = commaSplit(getJeolsa(''+by_online_money+'',jeolsa,false)) + "¿ø";
	}
}

function tack_price(ths)
{
	var f  = document.order_form;
	var f1 = document.pay_select;	

	if (f.BY_PAY_TYPE.value)
	{
		alert('\nÆ¯º° ¹è¼Û¿É¼ÇÀº °áÁ¦¼ö´Ü ¼±ÅÃÀü¿¡ ¼±ÅÃÇÏ¼Å¾ß ÇÕ´Ï´Ù.               \n');
		var doseo_tack_tmp1 = f1.doseo_tack_tmp.value;
		f1.reset();
		f1.doseo_tack_tmp.value = doseo_tack_tmp1;

		if (f1.price_tack.value != "- ¹«·á -" && f1.price_tack.value != "- ÂøºÒ -" && f1.price_tack.value != "- º°µµ -")
		{
			var ta_total = parseInt(filterNum(f1.price_tack.value.replace("¿ø" , "")));
		}
		else {
			var ta_total = parseInt(f1.ta_total.value);
		}
		var element_money = parseInt(filterNum(f1.price_total2.value.replace("¿ø", "")));
		var element_tack  = ta_total;

		f1.price_total2.value = commaSplit(element_money + parseInt(doseo_tack_tmp1)) + "¿ø";
		if (element_tack + parseInt(doseo_tack_tmp1) == 0)
		{
			f1.price_tack.value  = "- ¹«·á -";
		}
		else {
			f1.price_tack.value = commaSplit(element_tack + parseInt(doseo_tack_tmp1)) + "¿ø";
		}
		f.BY_PAY_TYPE.value   = "";

		pay_lay_hide();
		return false;
	}

	var ta_total   = parseInt(f1.ta_total.value);
	if (ths.value)
	{
		var ggval = ths.value;
		var doseo_tack_tmp1 = f1.doseo_tack_tmp.value;
		f1.reset();
		f1.BY_SPECIAL_TACK_1.value = ggval;
		var spe_tack  = ggval.split('|');
		var spe_name  = spe_tack[0];
		var spe_price = parseInt(spe_tack[1]);
		var doseo_tack= parseInt(doseo_tack_tmp1);
		var element_money = parseInt(filterNum(f1.price_total2.value.replace("¿ø", "")));
		
		f1.price_total2.value = commaSplit(element_money + spe_price + doseo_tack) + "¿ø";
		if (ta_total + spe_price + doseo_tack == 0)
		{
			f1.price_tack.value  = "- ¹«·á -";
		}
		else {
			f1.price_tack.value = commaSplit(ta_total + spe_price + doseo_tack) + "¿ø";
		}
		f1.doseo_tack_tmp.value = doseo_tack_tmp1;
	}
	else {
		var doseo_tack_tmp1 = f1.doseo_tack_tmp.value;
		f1.reset();

		var doseo_tack= parseInt(doseo_tack_tmp1);
		var element_money = parseInt(filterNum(f1.price_total2.value.replace("¿ø", "")));
		
		f1.price_total2.value = commaSplit(element_money + doseo_tack) + "¿ø";
		if (ta_total + doseo_tack == 0)
		{
			f1.price_tack.value  = "- ¹«·á -";
		}
		else {
			f1.price_tack.value = commaSplit(ta_total + doseo_tack) + "¿ø";
		}
		f1.doseo_tack_tmp.value = doseo_tack_tmp1;
	}
}
function doseo_check()
{
	var f  = document.order_form;
	var f1 = document.pay_select;
	var i;
	if (f1.tack_type.value != "3")
	{
		return false;
	}

	var str = f.BY_TO_ADDR1.value;
	if (!str)
	{
		if (f1.price_tack.value != "- ¹«·á -" && f1.price_tack.value != "- ÂøºÒ -" && f1.price_tack.value != "- º°µµ -")
		{
			var ta_total = parseInt(filterNum(f1.price_tack.value.replace("¿ø" , "")));
		}
		else {
			var ta_total = parseInt(f1.ta_total.value);
		}

		var element_money = parseInt(filterNum(f1.price_total2.value.replace("¿ø", "")));
		var element_tack  = ta_total;
		
		if (parseInt(f1.doseo_tack_tmp.value) != 0)
		{
			alert('\nÆ¯¼öÁö¿ª(µµ¼­,»ê°£) ¹è¼ÛÀÌ  Ãë¼ÒµÇ¾î         \n\n¹è¼Ûºñ '+commaSplit(f1.doseo_tack_tmp.value)+'¿øÀÌ Á¦¿ÜµÇ¾ú½À´Ï´Ù.\n');
		}

		f1.price_total2.value = commaSplit(element_money - parseInt(f1.doseo_tack_tmp.value)) + "¿ø";
		if (element_tack - parseInt(f1.doseo_tack_tmp.value) == 0)
		{
			f1.price_tack.value  = "- ¹«·á -";
		}
		else {
			f1.price_tack.value  = commaSplit(element_tack - parseInt(f1.doseo_tack_tmp.value)) + "¿ø";
		}
		
		if (f.BY_PAY_TYPE.value == "´ÙÁß°áÁ¦")
		{
			f.BY_ONLINE_PRICE.value = commaSplit(parseInt(filterNum(f.BY_ONLINE_PRICE.value.replace("¿ø", ""))) - parseInt(f1.doseo_tack_tmp.value)) + "¿ø";
		}
		f1.doseo_tack_tmp.value = 0;

		return false;
	}

	if (f1.doseo_tack_tmp.value != "0" && f1.doseo_tack_tmp.value != "")
	{
		return false;
	}

	var doseo_array1 = f1.doseo_tack_1.value.split('|');
	var doseo_array2 = f1.doseo_tack_2.value.split('|');
	var doseo_array3 = f1.doseo_tack_3.value.split('|');

	var doseo_1 = doseo_array1[0].split(',');
	var doseo_2 = doseo_array2[0].split(',');
	var doseo_3 = doseo_array3[0].split(',');

	if (f1.price_tack.value != "- ¹«·á -" && f1.price_tack.value != "- ÂøºÒ -" && f1.price_tack.value != "- º°µµ -")
	{
		var ta_total = parseInt(filterNum(f1.price_tack.value.replace("¿ø" , "")));
	}
	else {
		var ta_total = parseInt(f1.ta_total.value);
	}

	var element_money = parseInt(filterNum(f1.price_total2.value.replace("¿ø", "")));
	var element_tack  = ta_total;


	for(i = 0; i < doseo_1.length; i++)
	{
		var match = str.replace(doseo_1[i] , '');
		if (str != match)
		{
			alert('\n¹è¼ÛÁö¿ªÀÌ Æ¯¼öÁö¿ª(µµ¼­,»ê°£)¿¡ Æ÷ÇÔµÇ¾î             \n\n¹è¼Ûºñ '+commaSplit(doseo_array1[1])+'¿øÀÌ Ãß°¡µÇ¾ú½À´Ï´Ù.\n');
			f1.price_total2.value = commaSplit(element_money + parseInt(doseo_array1[1])) + "¿ø";
			f1.price_tack.value   = commaSplit(element_tack + parseInt(doseo_array1[1])) + "¿ø";
			if (f.BY_PAY_TYPE.value == "´ÙÁß°áÁ¦")
			{
				f.BY_ONLINE_PRICE.value = commaSplit(parseInt(filterNum(f.BY_ONLINE_PRICE.value.replace("¿ø", ""))) + parseInt(doseo_array1[1])) + "¿ø";
			}
			f1.doseo_tack_tmp.value = doseo_array1[1];
			break;
		}
	}

	for(i = 0; i < doseo_2.length; i++)
	{
		var match1 = str.replace(doseo_2[i] , '');
		if (str != match1)
		{
			alert('\n¹è¼ÛÁö¿ªÀÌ Æ¯¼öÁö¿ª(µµ¼­,»ê°£)¿¡ Æ÷ÇÔµÇ¾î             \n\n¹è¼Ûºñ '+commaSplit(doseo_array2[1])+'¿øÀÌ Ãß°¡µÇ¾ú½À´Ï´Ù.\n');
			f1.price_total2.value = commaSplit(element_money + parseInt(doseo_array2[1])) + "¿ø";
			f1.price_tack.value   = commaSplit(element_tack + parseInt(doseo_array2[1])) + "¿ø";
			if (f.BY_PAY_TYPE.value == "´ÙÁß°áÁ¦")
			{
				f.BY_ONLINE_PRICE.value = commaSplit(parseInt(filterNum(f.BY_ONLINE_PRICE.value.replace("¿ø", ""))) + parseInt(doseo_array2[1])) + "¿ø";
			}
			f1.doseo_tack_tmp.value = doseo_array2[1];
			break;
		}
	}

	for(i = 0; i < doseo_3.length; i++)
	{
		var match2 = str.replace(doseo_3[i] , '');
		if (str != match2)
		{
			alert('\n¹è¼ÛÁö¿ªÀÌ Æ¯¼öÁö¿ª(µµ¼­,»ê°£)¿¡ Æ÷ÇÔµÇ¾î             \n\n¹è¼Ûºñ '+commaSplit(doseo_array2[1])+'¿øÀÌ Ãß°¡µÇ¾ú½À´Ï´Ù.\n');
			f1.price_total2.value = commaSplit(element_money + parseInt(doseo_array2[1])) + "¿ø";
			f1.price_tack.value   = commaSplit(element_tack + parseInt(doseo_array2[1])) + "¿ø";
			if (f.BY_PAY_TYPE.value == "´ÙÁß°áÁ¦")
			{
				f.BY_ONLINE_PRICE.value = commaSplit(parseInt(filterNum(f.BY_ONLINE_PRICE.value.replace("¿ø", ""))) + parseInt(doseo_array2[1])) + "¿ø";
			}
			f1.doseo_tack_tmp.value = doseo_array2[1];
			break;
		}
	}
	
	if (f.BY_PAY_TYPE.value == "Àû¸³±Ý")
	{
		if (parseInt(filterNum(f1.price_total2.value.replace("¿ø" , ""))) > parseInt(f1.member_point.value))
		{
			alert('\nÆ¯¼ö ¹è¼ÛºñÃß°¡·Î ÀÎÇØ Á¦Ç°±¸¸Å¾×('+f1.price_total2.value+')ÀÌ °í°´´ÔÀÇ º¸À¯Àû¸³±Ýº¸´Ù ¸¹½À´Ï´Ù.             \n\nÇöÀç °í°´´ÔÀÇ º¸À¯Àû¸³±ÝÀº '+commaSplit(f1.member_point.value)+'¿øÀÔ´Ï´Ù.');
			
			var doseo_tack_tmp1 = f1.doseo_tack_tmp.value;
			f1.reset();
			f1.doseo_tack_tmp.value = doseo_tack_tmp1;

			if (f1.price_tack.value != "- ¹«·á -" && f1.price_tack.value != "- ÂøºÒ -" && f1.price_tack.value != "- º°µµ -")
			{
				var ta_total = parseInt(filterNum(f1.price_tack.value.replace("¿ø" , "")));
			}
			else {
				var ta_total = parseInt(f1.ta_total.value);
			}
			var element_money = parseInt(filterNum(f1.price_total2.value.replace("¿ø", "")));
			var element_tack  = ta_total;

			f1.price_total2.value = commaSplit(element_money + parseInt(doseo_tack_tmp1)) + "¿ø";
			if (element_tack + parseInt(doseo_tack_tmp1) == 0)
			{
				f1.price_tack.value  = "- ¹«·á -";
			}
			else {
				f1.price_tack.value = commaSplit(element_tack + parseInt(doseo_tack_tmp1)) + "¿ø";
			}
			f.BY_PAY_TYPE.value   = "";
			return false;
		}
	}
}
function order_check()
{
	var f  = document.order_form;
	var f1 = document.pay_select;

	if (!f.BY_PAY_TYPE.value)
	{
		alert('\n°áÁ¦¼ö´ÜÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.             \n');
		location.href = "#pay_top";
		return false;
	}
	if (!f.BY_BY_NAME.value)
	{
		alert('\nÁÖ¹®ÀÎÀÇ ¼ºÇÔÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_BY_NAME.focus();
		return false;
	}
	if (!f.BY_BY_EMAIL.value)
	{
		alert('\nÁÖ¹®ÀÎÀÇ ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_BY_EMAIL.focus();
		return false;
	}
	if (!f.BY_BY_HOME_TEL_1.value || !f.BY_BY_HOME_TEL_2.value || !f.BY_BY_HOME_TEL_3.value)
	{
		alert('\nÁÖ¹®ÀÎÀÇ ÀüÈ­¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_BY_HOME_TEL_1.focus();
		return false;
	}
	if (!f.BY_BY_ZIP1.value || !f.BY_BY_ZIP2.value || !f.BY_BY_ADDR1.value)
	{
		alert('\nÁÖ¹®ÀÎÀÇ ÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_BY_ADDR2.focus();
		return false;
	}

	if (!f.BY_TO_NAME.value)
	{
		alert('\n¹è¼Û¹ÞÀ¸½Ç °í°´´ÔÀÇ ¼ºÇÔÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_TO_NAME.focus();
		return false;
	}
	if (!f.BY_TO_HOME_TEL_1.value || !f.BY_TO_HOME_TEL_2.value || !f.BY_TO_HOME_TEL_3.value)
	{
		alert('\n¹è¼Û¹ÞÀ¸½Ç °í°´´ÔÀÇ ÀüÈ­¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_TO_HOME_TEL_1.focus();
		return false;
	}
	if (!f.BY_TO_ZIP1.value || !f.BY_TO_ZIP2.value || !f.BY_TO_ADDR1.value)
	{
		alert('\n¹è¼Û¹ÞÀ¸½Ç °í°´´ÔÀÇ ÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_TO_ADDR2.focus();
		return false;
	}

	if (!confirm('\nÀÔ·ÂÇÏ½Å ÁÖ¹®Á¤º¸°¡ Á¤È®ÇÕ´Ï±î?           \n'))
	{
		return false;
	}
	
	if (f.BY_PAY_TYPE.value != "º°µµÇùÀÇ")
	{
		f.g_mby_stack.value = f1.BY_SPECIAL_TACK_1.value;
		f.g_mby_price_order.value = filterNum(f1.price_total.value.replace("¿ø", ""));

		if (f.BY_PAY_TYPE.value == "¿Â¶óÀÎ")
		{
			f.g_mby_price_online.value = filterNum(f1.price_total2.value.replace("¿ø", ""));
		}
		else {
			f.g_mby_price_online.value = (f.BY_PAY_TYPE.value == "´ÙÁß°áÁ¦") ? filterNum(f.BY_ONLINE_PRICE.value.replace("¿ø", "")) : 0;
		}

		if (f.BY_PAY_TYPE.value == "½Å¿ëÄ«µå")
		{
			f.g_mby_price_card.value = filterNum(f1.price_total2.value.replace("¿ø", ""));
		}
		else {
			f.g_mby_price_card.value = (f.BY_PAY_TYPE.value == "´ÙÁß°áÁ¦") ? filterNum(f.BY_CARD_PRICE.value.replace("¿ø", "")) : 0;
		}
		if (f.BY_PAY_TYPE.value == "Àû¸³±Ý")
		{
			f.g_mby_price_point.value = filterNum(f1.price_total2.value.replace("¿ø", ""));
		}
		else {	
			f.g_mby_price_point.value = (f.BY_PAY_TYPE.value == "´ÙÁß°áÁ¦") ? filterNum(f.BY_POINT_PRICE.value.replace("¿ø", "")) : 0;
		}
		f.g_mby_price_hand.value = (f.BY_PAY_TYPE.value == "¸ð¹ÙÀÏ") ? filterNum(f1.price_total2.value.replace("¿ø", "")) : 0;
		f.g_mby_price_ziro.value = (f.BY_PAY_TYPE.value == "°èÁÂÀÌÃ¼") ? filterNum(f1.price_total2.value.replace("¿ø", "")) : 0;
		f.g_mby_price_jeolsa.value = filterNum(f1.price_jeolsa.value.replace("¿ø", ""));
		f.g_mby_price_halin.value = filterNum(f1.halin_total.value.replace("¿ø", ""));
		
		if (f1.price_tack.value == "- ¹«·á -" || f1.price_tack.value == "- º°µµ -")
		{
			f.g_mby_price_tack.value = 0;	
		}
		else if(f1.price_tack.value == "- ÂøºÒ -")
		{
			f.g_mby_price_tack.value = -1;			
		}
		else {
			f.g_mby_price_tack.value = filterNum(f1.price_tack.value.replace("¿ø", ""));
		}
	}

	if (f.BY_PAY_TYPE.value == "¿Â¶óÀÎ")
	{
		f.BY_HOWBANK.value = f.BY_HOWBANK_1.value;
	}
	if (f.BY_PAY_TYPE.value == "°èÁÂÀÌÃ¼")
	{
		f.BY_HOWBANK.value = f.BY_HOWBANK_2.value;
	}
	if (f.BY_PAY_TYPE.value == "´ÙÁß°áÁ¦")
	{
		f.BY_HOWBANK.value = f.BY_HOWBANK_3.value;
	}
}

function order_view(id,oid,name)
{
	if (id)
	{
		location.href = "mypage.php?query=myorder";
	}
	else {
		window.open('./include/lib/order_mall.php?oid=' + oid + '&name='+name,'order_win','scrollbars=yes,width=650,height=600');
	}
}
function order_view_gr(id,oid,name)
{
	if (id)
	{
		location.href = "mypage.php?query=mygroupbuy";
	}
	else {
		window.open('./include/lib/order_groupbuy.php?oid=' + oid+ '&name='+name,'order_win','scrollbars=yes,width=650,height=600');
	}
}
function order_view_au(id,oid,name)
{
	if (id)
	{
		location.href = "mypage.php?query=myauction";
	}
	else {
		window.open('./include/lib/order_auction.php?oid=' + oid+ '&name='+name,'order_win','scrollbars=yes,width=650,height=600');
	}
}

function gr_order_check()
{
	var f  = document.order_form;

	if (!f.BY_BY_NAME.value)
	{
		alert('\nÁÖ¹®ÀÎÀÇ ¼ºÇÔÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_BY_NAME.focus();
		return false;
	}
	if (!f.BY_BY_EMAIL.value)
	{
		alert('\nÁÖ¹®ÀÎÀÇ ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_BY_EMAIL.focus();
		return false;
	}
	if (!f.BY_BY_HOME_TEL_1.value || !f.BY_BY_HOME_TEL_2.value || !f.BY_BY_HOME_TEL_3.value)
	{
		alert('\nÁÖ¹®ÀÎÀÇ ÀüÈ­¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_BY_HOME_TEL_1.focus();
		return false;
	}
	if (!f.BY_BY_ZIP1.value || !f.BY_BY_ZIP2.value || !f.BY_BY_ADDR1.value)
	{
		alert('\nÁÖ¹®ÀÎÀÇ ÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_BY_ADDR2.focus();
		return false;
	}

	if (!f.BY_TO_NAME.value)
	{
		alert('\n¹è¼Û¹ÞÀ¸½Ç °í°´´ÔÀÇ ¼ºÇÔÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_TO_NAME.focus();
		return false;
	}
	if (!f.BY_TO_HOME_TEL_1.value || !f.BY_TO_HOME_TEL_2.value || !f.BY_TO_HOME_TEL_3.value)
	{
		alert('\n¹è¼Û¹ÞÀ¸½Ç °í°´´ÔÀÇ ÀüÈ­¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_TO_HOME_TEL_1.focus();
		return false;
	}
	if (!f.BY_TO_ZIP1.value || !f.BY_TO_ZIP2.value || !f.BY_TO_ADDR1.value)
	{
		alert('\n¹è¼Û¹ÞÀ¸½Ç °í°´´ÔÀÇ ÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.             \n');
		f.BY_TO_ADDR2.focus();
		return false;
	}

	if (!confirm('\nÀÔ·ÂÇÏ½Å ½ÅÃ»Á¤º¸°¡ Á¤È®ÇÕ´Ï±î?           \n'))
	{
		return false;
	}
}
function gr_order_view(oid,name)
{
	window.open('./include/lib/order_groupbuy.php?oid=' + oid + '&name=' + name,'order_win','scrollbars=yes,width=700,height=650');
}
function au_order_view(oid,name)
{
	window.open('./include/lib/order_auction.php?oid=' + oid + '&name=' + name,'order_win','scrollbars=yes,width=700,height=650');
}

function ipchal_plus(ip,pp)
{
	var f = document.order_form;
	var price = parseInt(filterNum(f.IPCHAL_PRICE.value));

	f.IPCHAL_PRICE.value = commaSplit(price + parseInt(pp));
}
function ipchal_minus(ip,pp)
{
	var f = document.order_form;
	var price = parseInt(filterNum(f.IPCHAL_PRICE.value));
	
	if (parseInt(ip) > price - parseInt(pp))
	{
		alert('\nÀÔÂû±Ý¾×Àº ÃÖ¼Ò '+commaSplit(ip)+'¿ø ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.           \n');
		return false;
	}

	f.IPCHAL_PRICE.value = commaSplit(price - parseInt(pp));
}

