
function up(no){
  var fm=document.fm;
  var n=eval("fm."+"c"+no+".value");
  if(n < 999){
  	n2=eval("fm."+"c"+no+".value="+(Number(n)+1));
  }
}

function dw(no){
  var fm=document.fm;
  var n=eval("fm."+"c"+no+".value");
  if(n > 1){
    n2=eval("fm."+"c"+no+".value="+(Number(n)-1));
  }
}

function shop_perv(){
  this.location.replace(document.referrer);
}

function next(){
	var cfm=document.cbox;
	var j = 0;
	
	if(cfm.cno == null){
		alert("»óÇ°ÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.");
		return;
	}else{
	  //»óÇ°ÀÌ ÇÑ°³ÀÏ °æ¿ì
		if(cfm.cno.length == null){
			if(cfm.cno.checked){
				var cf=confirm("¼±ÅÃÇÏ½Å »óÇ°À» ±¸¸ÅÇÏ½Ã°Ú½À´Ï±î?");
				
				if(cf > 0){
					var cno=cfm.cno.value + "^";	
					var spec = cfm.spec.value + "^";			
					cfm.prod_id_list.value = cno;
					cfm.spec_list.value = spec;
					cfm.action ="/store/product/order_con.jsp";
					cfm.submit();
				}
			}else{
				alert("ÁÖ¹®ÇÏ½Ç »óÇ°À» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
				return;			
			}
		}else{
		  
			for(i = 0; i < cfm.cno.length; i++){
				if(cfm.cno[i].checked){
					j++;
				}
			}
			
			if(j == 0){
				alert("ÁÖ¹®ÇÏ½Ç »óÇ°À» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
				return;
			}else{
				var cf=confirm("¼±ÅÃÇÏ½Å »óÇ°À» ±¸¸ÅÇÏ½Ã°Ú½À´Ï±î?");
				var cno="";
				var spec="";
				
				if(cf > 0){
					for(j = 0; j < cfm.cno.length; j++){
						if(cfm.cno[j].checked){
							cno += cfm.cno[j].value + "^";
							spec += cfm.spec[j].value + "^";
						}
					}
					
					cfm.prod_id_list.value = cno;
					cfm.spec_list.value = spec;
					cfm.action ="/store/product/order_con.jsp";
					cfm.submit();
				}
			}		
		}//»óÇ°ÀÌ ¿©·¯°³ÀÏ °æ¿ì.
	}//»óÇ°ÀÌ Á¸ÀçÇÒ °æ¿ì.
}
  
function openDetail(prod_cat_id,prod_id){
	var fm = document.idFm;
	
	fm.prod_id.value=prod_id;
	fm.cat_id.value = prod_cat_id;
	/*fm.target="_self";	
	fm.action = "/store/product/product_view.jsp"*/
	
	fm.target = "prod";
	fm.action = "/store/product/product_cnt_check.jsp";
	fm.submit();
}

function openZoom(prod_cat_id,prod_id){
	var fm = document.idFm;
	
	fm.prod_id.value=prod_id;
	fm.cat_id.value = prod_cat_id;
	fm.action = "product_zoom.jsp";
	fm.target = "zoom"
	
	var win = open('','zoom','width=670,height=500,scrollbars=yes, resizable=no');
	fm.submit();
}

function allChk(){
	var cfm = document.cbox;

	if(cfm.cno == null){
  
	}else{
		for(i=0; i < cfm.cno.length; i++){
				cfm.cno[i].checked = true;
		}
    if(cfm.cno.length == undefined){ //°Ô½Ã¹°ÀÌ ÇÏ³ªÀÏ ¶§
			  cfm.cno.checked = true;
	  }
	}
}

function canChk(){
	var cfm = document.cbox;

	if(cfm.cno == null){
  
	}else{
		for(i=0; i < cfm.cno.length; i++){
				cfm.cno[i].checked = false;
		}
    if(cfm.cno.length == undefined){ //°Ô½Ã¹°ÀÌ ÇÏ³ªÀÏ ¶§
			  cfm.cno.checked = false;
	  }
	}
}


/* ±ÇÁ¾º° ±¸¸Å ¼ö·®º° ±¸¸Å±Ý¾× ÀÔ·Â 
 * ÁöÁ¤¼® : 80000 TB0003
 * ÀÏ¹Ý¼® : 50000 TB0002
 * ÀÀ¿ø¼® : 40000 TB0001
 * */
function priceChange(){
	var fm = document.fm;
	var prodId = fm.prod_id.value;
	var Qty    = fm.qty.value;
	if(prodId == 'TB0001'){
		fm.price.value = 40000 * Qty;
	}else if(prodId == 'TB0002'){
		fm.price.value = 50000 * Qty;
	}else if(prodId == 'TB0003'){
		fm.price.value = 80000* Qty;
	}
	document.getElementById("qtCnt").innerText = Qty * 5;
}

function buyNow(){
	var fm = document.fm;
		
	var sum_amt = (fm.qty.value) * (fm.price.value);
	if(fm.qty.value == 0){
		alert('±¸¸Å¼ö·®À» 1±Ç ÀÌ»ó ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.');
		return;
	}
	if(sum_amt == 0){
		alert('±¸¸Å±Ý¾×Àº 0ÀÌ µÉ ¼ö ¾ø½À´Ï´Ù.');
		return;
	}
	if(fm.donate_qty.value == 0){
		alert('±âºÎ¼ö·®À» 1Àå ÀÌ»ó ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.');
		return;
	}
	fm.sum_amt.value = sum_amt;
	fm.buy.value = "buyNow";
	fm.action = "/store/product/order_con.jsp";
	fm.submit();
}

function sBag(grade){
	var ifm = document.idFm;
	var fm = document.fm;
	var sfm = document.shopFm;
	var i = 0; var j = 0;
	
  if(grade == "null"){
  	alert("È¸¿øÀü¿ë ÄÚ³ÊÀÔ´Ï´Ù. \n\n·Î±×ÀÎÀ» ¸ÕÀú ÇØÁÖ½Ê½Ã¿À.");
    location.href="/member/login.jsp";	
  }else{
    //¼îÇÎ¹é¿¡ °°Àº »óÇ° ÀÖÀ» °æ¿ì.
    if((sfm.shop_spec.value == fm.select_size.value) && (sfm.shop_prod_id.value == ifm.prod_id.value)){
      if(Number(fm.c1.value) < 1){
	
				alert("¼ö·®Àº 1°³ ÀÌ»óÀÌ¿©¾ß ÇÕ´Ï´Ù.");
				fm.c1.focus();
				return;
		  }else{
    
	    	var cf=confirm("ÀÌ¹Ì °°Àº »óÇ°ÀÌ ¼îÇÎ¹é¿¡ Á¸ÀçÇÕ´Ï´Ù. \n\n ¼ö·®À» Ãß°¡ ÇÏ½Ã°Ú½À´Ï±î?");
	    	
	    	if(cf > 0){
	
	    		ifm.seq.value = sfm.shop_seq.value;
	    		i = sfm.shop_qty.value;
	    		j = fm.c1.value;
	    		ifm.qty.value = Number(i) + Number(j);
	    		ifm.sum_amt.value = (ifm.price.value) * (ifm.qty.value);
	    		ifm.aT.value = "update";
	    		
	    		ifm.action = "/store/product/shopping_reg.jsp";
	    		ifm.submit();
	    	}
    	}
    }else{
      if(Number(fm.c1.value) < 1){
	
				alert("¼ö·®Àº 1°³ ÀÌ»óÀÌ¿©¾ß ÇÕ´Ï´Ù.");
				fm.c1.focus();
				return;
		  }else{
				var sum_amt = (fm.c1.value) * (ifm.price.value);
				ifm.spec.value = fm.select_size.value;
				ifm.qty.value = fm.c1.value;
				ifm.sum_amt.value = sum_amt;
				ifm.aT.value = "insert";
				
				ifm.action = "/store/product/shopping_reg.jsp";
				ifm.submit();
			}
		}//¼îÇÎ¹é¿¡ °°Àº »óÇ° ¾øÀ» °æ¿ì.
	}//·Î±×ÀÎ ÇßÀ» ¶§.
}

function prod_del(prod_id, seq){
	var fm = document.idFm;
	
	var cf=confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?");
  
  if(cf > 0){
	  fm.prod_id.value = prod_id;
	  fm.seq.value = seq;
	  fm.aT.value = "delete";
	  
	  fm.action = "/store/product/shopping_reg.jsp";
	  fm.submit();
  }
  
}

function qty_mod(prod_id, no, seq){
	var fm = document.cbox;
	var ifm = document.idFm;
	var qty_num = document.getElementsByName("qty_num");	
	
	var cf=confirm("¼öÁ¤ÇÏ½Ã°Ú½À´Ï±î?");
  
  if(cf > 0){  	
  	if(fm.Cnt.value > 1){
  	
	 		if(Number(fm.qty_num[no].value) < 1){
	 			alert('¼ö·®Àº 1°³ ÀÌ»óÀÌ¿©¾ß ÇÕ´Ï´Ù.');
	 			ifm.action = "/store/product/shopping_bag.jsp";
  	    ifm.submit();
	 			return;
	 		}	  	
			 ifm.prod_id.value = prod_id;
			 ifm.seq.value = seq;
			 ifm.price.value = fm.price_num[no].value;
			 ifm.qty.value = fm.qty_num[no].value;
		   ifm.sum_amt.value = (ifm.price.value) * (ifm.qty.value);
			 ifm.aT.value = "update";
			
			 ifm.action = "/store/product/shopping_reg.jsp";
		   ifm.submit();
		   
		 }if(fm.Cnt.value == 1){
		 
	 		 if(Number(fm.qty_num.value) < 1){
	 			 alert('¼ö·®Àº 1°³ ÀÌ»óÀÌ¿©¾ß ÇÕ´Ï´Ù.');
	 			 ifm.action = "/store/product/shopping_bag.jsp";
  	     ifm.submit();
	 			 return;
	 		 }		 
		   ifm.prod_id.value = prod_id;
			 ifm.seq.value = seq;
			 ifm.price.value = fm.price_num.value;
			 ifm.qty.value = fm.qty_num.value;
		   ifm.sum_amt.value = (ifm.price.value) * (ifm.qty.value);
			 ifm.aT.value = "update";
			
			 ifm.action = "/store/product/shopping_reg.jsp";
		   ifm.submit();
		 }
  }else{
  	ifm.action = "/store/product/shopping_bag.jsp";
  	ifm.submit();
  }
}

function next_con(){
	var fm=document.fm;
	
	fm.aT.value = "insert_buy";
	fm.action = "/store/product/order_temp_reg.jsp";
	fm.submit();
} 
























