function addCart() {
		if(getCountChecked(document.frmOption.goods_cd)==0) {
			alert("¿É¼ÇÀ» ¼±ÅÃÇØÁÖ¼¼¿ä");
			return;
		}
//alert(document.frmGoods.qty.value);
	if (document.frmGoods.qty.value==0){
			alert("ÁË¼ÛÇÕ´Ï´Ù. Ç°Àý »óÇ°ÀÔ´Ï´Ù.\n\n´ÙÀ½¿¡ ±¸¸ÅÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù");
		return;
	}
	document.frmGoods.action = "/onshop/cart_add.jsp";
	document.frmGoods.submit();
}
	function getCountChecked(obj) {
		if(typeof(obj) == 'undefined') return 0;
		if(typeof(obj.length) == 'undefined') {
			if(obj.checked) return 1;
		}
		else {
			cnt = 0;
			for(i=0; i<obj.length; i++) {
				if(obj[i].checked) cnt++;
			}
			return cnt;
		}
	}

	/** 
	** Àå¹Ù±¸´Ï¿¡ÀÖ´Â°Å ÁÖ¹®ÇÏ±â 
	**/		
	function GoCartOrder(thisform) {
		thisform.method="post";
		thisform.action = "/onshop/cart_order.jsp";
		thisform.submit();
	}

	/** 
	** Á÷Á¢±¸¸Å
	**/		
	function GoDirectOrder(thisform) {
//		document.form1.action = "/shopcart/member_order_pay.jsp";
		if (thisform.qty.value==0){
			alert("ÁË¼ÛÇÕ´Ï´Ù. Ç°Àý »óÇ°ÀÔ´Ï´Ù.\n\n´ÙÀ½¿¡ ±¸¸ÅÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù");
			return;
		}
		thisform.method="post";
		thisform.action = "/onshop/direct_order.jsp";
		thisform.submit();
	}


	function goRelationOrder(thisform){
		if(getCountChecked(thisform.goods_cd) < 1) {
			alert("°ü·Ã»óÇ°À» ¼±ÅÃÇØÁÖ¼¼¿ä");
					
			return;
		}
		thisform.method="post";
		thisform.qty.value =frmGoods.qty.value;
		thisform.action = "/onshop/direct_order.jsp";
		thisform.submit();
	}

	function goBuy(goods_cd,b_class_code,class_code){
//		alert(goods_cd + "\n" + b_class_code +"\n" + class_code);
 		document.location.href="/product/product_detail.jsp?goods_cd="+goods_cd+"&b_class_code="+b_class_code+"&class_code="+class_code + "&temp=onshop";
	}

 	function godetail(goods_cd,b_class_code,class_code,temp){
 		if(temp!="onshop" && temp!="product") temp="onshop";
 		document.location.href="/product/product_detail.jsp?goods_cd="+goods_cd+"&b_class_code="+b_class_code+"&class_code="+class_code + "&temp=" + temp;
 	}
 	function goList(b_class_code,class_code){
 		document.location.href="/product/product_list.jsp?b_class_code="+b_class_code+"&class_code="+class_code+"&temp=onshop";
 	}
	function ReCal(thisform) {   
//		alert(0);
//		var	thisform = document.frmOrder;
//		alert(thisform.name);
		thisform.method="post";
		thisform.action = "cart_recal_proc.jsp";
		thisform.submit();
	}
function checkQty(obj) {
	var qty = parseInt(obj.value);
	var max_quantity = parseInt(document.frmGoods.max_quantity.value);
//	alert(obj.value+1);
	if(qty > max_quantity) {
		alert("ÇöÀç " + max_quantity + " ±îÁö ±¸¸Å ÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.");
		obj.value=max_quantity;
	}
	document.frmGoods.qty.value=obj.value;
}


function qty_change(thisform,num){
	var quantity , total ,max_quantity;
	var qty = parseInt(thisform.qty[num].value);
	var max_quantity = parseInt(thisform.max_quantity[num].value);
		if (qty < 1) {
			alert("¼ö·®Àº 1°³ÀÌÇÏ·Î Àû¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
			thisform.qty[num].value = 1;
			thisform.qty[num].focus;
			return
		}
		if (qty > max_quantity) {
			alert("ÇöÀç " + max_quantity + " ±îÁö ±¸¸Å ÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.");
			thisform.qty[num].value = max_quantity;
			thisform.qty[num].focus;
			return
		}
		document.getElementById("total"+ num).innerText= crrenConvert(thisform.price[num].value * qty);
		thisform.goods_info[num].value = thisform.goods_cd[num].value + "=" + thisform.price[num].value + "=" + thisform.qty[num].value;
//		alert(thisform.goods_info[num].value);
		price_total(thisform);
}
function price_total(thisform){
	var total = 0
	var num = 0;
	var qty = 1;

	num = thisform.totalcnt.value
	for(i=0 ; i < num ; i++) {
		qty = 	thisform.qty[i].value
		total	= total + thisform.price[i].value * qty;
	}
//	total_price.innerText = crrenConvert(total);
		document.getElementById("sum").innerText= crrenConvert(total);
//		alert(total);
//		alert(crrenConvert(total));
}

function GoDelCart(order_id) {
	var gourl = "del_cart.jsp?order_id=" + order_id;
 	document.location.href=gourl;
}

function GoWish(goods_cd) {
	var gourl = "/mypage/wish_add.jsp?goods_cd="+goods_cd+"";
 	document.location.href=gourl;
}

	function GoWishDel(goods_cd) {
		var gourl = "wish_del.jsp?goods_cd=" + goods_cd;
	 	document.location.href=gourl;
	}

function assign (thisform) {
//alert(thisform.email.value);
//	alert(thisform.allcheck.checked);
	if (thisform.allcheck.checked) {
		thisform.ship_cust_nm.value = thisform.name.value;
		thisform.ship_email.value = thisform.email.value;
		thisform.ship_home_tel1.value = thisform.tel1.value;
		thisform.ship_home_tel2.value = thisform.tel2.value;
		thisform.ship_home_tel3.value = thisform.tel3.value;
		thisform.ship_hand_tel1.value = thisform.hp1.value;
		thisform.ship_hand_tel2.value = thisform.hp2.value;
		thisform.ship_hand_tel3.value = thisform.hp3.value;
		thisform.ship_home_zip1.value = thisform.zip1.value;
		thisform.ship_home_zip2.value = thisform.zip2.value;
		thisform.ship_home_addr1.value = thisform.addr1.value;
		thisform.ship_home_addr2.value = thisform.addr2.value;
	} else {
			thisform.ship_cust_nm.value = "";
		thisform.ship_email.value = "";
		thisform.ship_home_tel1.value = "";
		thisform.ship_home_tel2.value = "";
		thisform.ship_home_tel3.value = "";
		thisform.ship_hand_tel1.value = "";
		thisform.ship_hand_tel2.value = "";
		thisform.ship_hand_tel3.value = "";
		thisform.ship_home_zip1.value = "";
		thisform.ship_home_zip2.value = "";
		thisform.ship_home_addr1.value ="";
		thisform.ship_home_addr2.value ="";

	}
}
function openzip(type) {
	var urlname = "/member/search_zip.jsp?open="+type;	//-	toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no"--%>
	window.open(urlname, "browse_org","height=420, width=510, menubar=no,directories=no,resizable=no,status=no,scrollbars=yes");
}

function GoOrder() {
	if (document.form1.ship_cust_nm.value == "") {
		document.form1.ship_cust_nm.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ¼ºÇÔÀ» ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_home_tel1.value == "") {
		document.form1.ship_home_tel1.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ÀüÈ­¹øÈ£¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_home_tel2.value == "") {
		document.form1.ship_home_tel2.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ÀüÈ­¹øÈ£¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_home_tel3.value == "") {
		document.form1.ship_home_tel3.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ÀüÈ­¹øÈ£¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_hand_tel1.value == "") {
		document.form1.ship_hand_tel1.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ÈÞ´ëÆù ¹øÈ£¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_hand_tel2.value == "") {
		document.form1.ship_hand_tel2.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ÈÞ´ëÆù ¹øÈ£¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_hand_tel3.value == "") {
		document.form1.ship_hand_tel3.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ÈÞ´ëÆù ¹øÈ£¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_home_zip1.value == "") {
		document.form1.ship_home_zip1.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ¿ìÆí¹øÈ£¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_home_zip2.value == "") {
		document.form1.ship_home_zip2.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ¿ìÆí¹øÈ£¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_home_addr1.value == "") {
		document.form1.ship_home_addr1.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ÁÖ¼Ò¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	if (document.form1.ship_home_addr2.value == "") {
		document.form1.ship_home_addr2.focus ();
		alert ("¼ö·ÉÇÏ½ÇºÐÀÇ ÁÖ¼Ò¸¦ ¹Ýµå½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false;
	}
	
//	document.form1.action = "/shopcart/cart_order_pay.jsp";
	document.form1.method = "post";
	document.form1.action = "order_confirm.jsp";
	document.form1.submit();
}

function usePoint(thisform){
		var used_point = parseInt(thisform.used_point.value);
		var max_point = parseInt(thisform.max_point.value);
		var realprice = parseInt(thisform.sum.value)  + parseInt(thisform.ship_fee.value);
		if (used_point > max_point) {
			thisform.used_point.value = max_point;
//			alert(used_point);		
		}
		if(thisform.usePointYN.checked) {
			document.getElementById("real_price").innerText= crrenConvert(realprice - parseInt(thisform.used_point.value));
		}else{
			document.getElementById("real_price").innerText= crrenConvert(realprice);
		}
}
