// JavaScript Document

function sm_list_theme()
{
	var tform = document.sm_order;
	var url = "index.php?orderby=theme&theme_no="+tform.theme_order.value+"&smlist=y";
	window.location = url;
}

function sm_list_dty()
{
	var tform = document.sm_order;
	var url = "index.php?orderby=dty&dty_no="+tform.group_order.value+"&smlist=y";
	window.location = url;
}

function sm_list_new_best(orderby)
{
	var tform = document.sm_order;
	var url = "index.php?orderby="+orderby+"&smlist=y";
	window.location = url;
}

function open_board09()
{
	var url = "board_list.php";
	window.open(url,"board09","width=620px; height=650px; scrollbars=yes");
}

function add_cart(buy_type)
{
	var tform = document.fcart;
	tform.buy_type.value = buy_type;
	tform.submit();
}

function del_cart(num)
{
	if(confirm("Á¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?"))
	{
		var url = "delete_cart.php?num="+num;
		window.location = url;
	}
}

function del_cart_all()
{
	if(confirm("Á¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?"))
	{
		var url = "delete_cart_all.php";
		window.location = url;
	}
}

function view_cash_info(vtype)
{
	var el = document.getElementById("cash_info");
	el.style.display = vtype;
}

function view_cash_type(vtype)
{
if(vtype == "card") {
		document.getElementById("card_div").style.display = "inline";
		document.getElementById("imgcash_div").style.display = "none";
		document.getElementById("nowcash_div").style.display = "none";
		document.getElementById("escrow_div").style.display = "none";
	} else if(vtype == "imgcash") {
		document.getElementById("card_div").style.display = "none";
		document.getElementById("imgcash_div").style.display = "inline";
		document.getElementById("nowcash_div").style.display = "none";
		document.getElementById("escrow_div").style.display = "none";
	} else if(vtype == "nowcash") {
		document.getElementById("card_div").style.display = "none";
		document.getElementById("imgcash_div").style.display = "inline";
		document.getElementById("nowcash_div").style.display = "none";
		document.getElementById("escrow_div").style.display = "none";
	} else {
		document.getElementById("card_div").style.display = "none";
		document.getElementById("imgcash_div").style.display = "none";
		document.getElementById("nowcash_div").style.display = "none";
		document.getElementById("escrow_div").style.display = "inline";
	}
}

function sync_user_info()
{
	tform = document.pay_form;
	if(tform.same_info.checked == true)
	{
		tform.d_name.value = tform.user_name.value;
		tform.d_mobile.value = tform.user_mobile.value;
		tform.d_zip.value = tform.user_zip.value;
		tform.d_addr0.value = tform.user_addr0.value;
		tform.d_addr.value = tform.user_addr.value;
		tform.email.value = tform.user_email.value;
	}
	else
	{
		tform.d_name.value = "";
		tform.d_mobile.value = "";
		tform.d_zip.value = "";
		tform.d_addr0.value = "";
		tform.d_addr.value = "";
		tform.email.value = "";
	}
}

function submit_pay_form(a)
{
	tform = document.pay_form;
	if(tform.d_name.value == "")
	{
		alert("¹ÞÀ¸½Ç ºÐÀÇ ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
		tform.d_name.focus();
		return false;
	}
	if(tform.d_mobile.value == "")
	{
		alert("¹ÞÀ¸½Ç ºÐÀÇ ¿¬¶ôÃ³¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		tform.d_mobile.focus();
		return false;
	}
	if(tform.d_zip.value == "" || tform.d_addr.value == "")
	{
		alert("¹ÞÀ¸½Ç ºÐÀÇ ÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä");
		return false;
	}
	if(a == "1") {
		if(tform.sindong.checked != true) {
			alert('Á¤º¸ ¼öÁý¿¡ µ¿ÀÇ ÇÏ¼Å¾ß ÇÕ´Ï´Ù.');
			return false;
		}
	}
	
	return true;
}

function submit_pay_form_escrow()
{
	tform = document.pay_form;
	if(tform.d_name.value == "")
	{
		alert("¹ÞÀ¸½Ç ºÐÀÇ ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
		tform.d_name.focus();
		return false;
	}
	if(tform.d_mobile.value == "")
	{
		alert("¹ÞÀ¸½Ç ºÐÀÇ ¿¬¶ôÃ³¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		tform.d_mobile.focus();
		return false;
	}
	if(tform.d_zip.value == "" || tform.d_addr.value == "")
	{
		alert("¹ÞÀ¸½Ç ºÐÀÇ ÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä");
		return false;
	}
	
	if(tform.pkind[3].checked) {
		tform.action="http://www.pcbee.co.kr/oaw/pay02_escrow.php";
		//tform.submit();
		return true;
	} else {
		tform.action="http://www.pcbee.co.kr/oaw/pay02.php";
		return true;
	}
	//tform.submit();
	//return true;
}

function alert_before_buy()
{
	alert("¸¶°¨µÈ °ø±¸´Â Àå¹Ù±¸´Ï¿¡¼­ »èÁ¦ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
}

function order_cancel_pop(odnum, odstate)
{
	var url = "order_cancel.php?odnum="+odnum+"&odstate="+odstate;
	var win = window.open(url,"order_cancel","width=350,height=270");
	win.focus();
}

function login_pop_sm()
{
	var url = "/sm/login_pop.php";
	var win = window.open(url,"login_pop","width=300,height=230");
	win.focus();
}

