function IsEmpty(data) {  //½ºÆäÀÌ½º¹Ùµµ °ø¹éÀ¸·Î Ã³¸®
  for (var i=0;i<data.length;i++) { if (data.substring(i,i+1) != " ") return false;  }
  return true;
}

function cart_in() {
	var frmname = document.frm;

	if (IsEmpty(frmname.cnum.value) == true || isNaN(frmname.cnum.value)==true) {
         alert("Input the Quantity content with number");
         frmname.cnum.focus();
         return;
    }

frmname.submit();
}

function cart_del(num,cartoption_size,cartoption){
	if(num==""){
		alert('error');
	}else{
		window.location.href="./cart_in.asp?cartType=del&num="+num+"&set_option_size="+cartoption_size+"&set_option="+cartoption;
	}
}

function cart_edit(num,cartoption_size,cartoption,cnum){
	if(num==""){
		alert('error');
	}else{
		window.location.href="./cart_in.asp?cartType=mod&num="+num+"&set_option_size="+cartoption_size+"&set_option="+cartoption+"&cnum="+cnum;
	}
}

function cart_pack(num,cartoption_size,cartoption,cnum){
	if(num==""){
		alert('error');
	}else{
		window.location.href="./cart_in.asp?cartType=mod&num="+num+"&set_option_size="+cartoption_size+"&set_option="+cartoption+"&cnum="+cnum;
	}

}

function cart_input(num,cartType,store,pname,price,i,cnum,pNum){
	if(num=="" || cartType==""){
		alert('error');
	}else{

//		if (set_option_size.value) == '0') {
//	         alert("you should be Select Size ");
//	         set_option_size.focus();
//	         return;
//	   }


   	document.frm.num.value = num;
		document.frm.cartType.value = cartType;
		document.frm.store.value = store;
		document.frm.pname.value = pname;
		document.frm.price.value = price;
		prdt1 = eval('document.frmproduct'+i+'.cnum.value');
//		alert(prdt1);
		document.frm.cnum.value = prdt1;
		document.frm.pNum.value = pNum;
		document.frm.submit();
	}
}

//¿É¼Ç°ª³Ö±â
function set_optionIn(set_optionValue){

	document.frm.set_option.value = set_optionValue;

}
function trim (strSource) { re = /^\s+|\s+$/g; return strSource.replace(re, ''); } 

function set_optionIn_size(set_option_sizeValue){
//	alert(set_option_sizeValue);
/*
	if (set_option_sizeValue == null || set_option_sizeValue =="")
		return;
		
	temp = set_option_sizeValue.split(',');

	set_option_sizeValue1 = temp[0];
	set_option_sizeValue2 = temp[1];
	set_option_sizeValue3 = trim(temp[2]);

	document.frm.set_option_size.value = set_option_sizeValue1;
	prdt1 = eval('document.getElementById("Showprice'+set_option_sizeValue3+'").innerHTML=\"Unit price $'+set_option_sizeValue2+'\"');
	document.frm.price.value = set_option_sizeValue2;
	prdt2 = eval('document.frmproduct'+set_option_sizeValue3+'.price.value= '+set_option_sizeValue2);
*/
}


function set_Change_size(set_Change_sizeValue){
	alert(set_Change_sizeValue);


	temp = set_Change_sizeValue.split(',');

	set_option_sizeValue1 = temp[0];
	set_option_sizeValue2 = temp[1];
	set_option_sizeValue3 = trim(temp[2]);

	prdt2 = eval('document.cartFrm.price'+set_option_sizeValue3+'.value= '+set_option_sizeValue2);
}

function login_in(){
	frmname = document.frm;
	if (IsEmpty(frmname.id.value) == true) {
         alert("Input the Email Address");
         frmname.id.focus();
         return;
    }

    if((frmname.id.value.indexOf("@")==-1) || (frmname.id.value.indexOf(".")==-1))
		{
		alert("The E-mail type is incorrect.\n \n ex> junebody@gmail.com")
		frmname.id.focus();
		return;
	}


	if (IsEmpty(frmname.pwd.value) == true) {
         alert("Input the Password");
         frmname.pwd.focus();
         return;
    }
    
      
	
	


	frmname.submit();
}

function newMember(){

	frmname = document.newFrm;

	if (IsEmpty(frmname.newId.value) == true) {
         alert("Input the Email Address");
         frmname.newId.focus();
         return;
    }
  	  if((frmname.newId.value.indexOf("@")==-1) || (frmname.newId.value.indexOf(".")==-1))
		{
		alert("The E-mail type is incorrect.\n \n ex> june@junbody.com")
		frmname.newId.focus();
		return;
	}
	if (IsEmpty(frmname.pwd1.value) == true) {
         alert("Input the Password");
         frmname.pwd1.focus();
         return;
    }
	if (IsEmpty(frmname.pwd2.value) == true) {
         alert("Input the Password");
         frmname.pwd2.focus();
         return;
    }
	if (frmname.pwd1.value !=frmname.pwd2.value) {
         alert("The passwd does with each other same.");
         frmname.pwd1.value="";
		 frmname.pwd2.value="";
         return;
    }
	frmname.submit();
}


function orderChk(){
	frmname = document.frm;

	if (IsEmpty(frmname.ofname.value) == true) {
         alert("Input the First Name");
         frmname.ofname.focus();
         return;
    }
	if (IsEmpty(frmname.olname.value) == true) {
         alert("Input the Last Name");
         frmname.olname.focus();
         return;
    }
	if (IsEmpty(frmname.oaddress1.value) == true) {
         alert("Input the address");
         frmname.oaddress1.focus();
         return;
    }
	/*
	if (IsEmpty(frmname.oaddress2.value) == true) {
         alert("Input the address");
         frmname.oaddress2.focus();
         return;
    }
	*/

	if (IsEmpty(frmname.ocity.value) == true) {
         alert("Input the City");
         frmname.ocity.focus();
         return;
    }

	if (IsEmpty(frmname.ostate.value) == true) {
         alert("State Error1");
         frmname.ostate.focus();
         return;
    }
	if (IsEmpty(frmname.ocountry.value) == true) {
         alert("Country Error1");
         frmname.ocountry.focus();
         return;
    }
	if (IsEmpty(frmname.opost.value) == true) {
         alert("Input the Postal Code");
         frmname.opost.focus();
         return;
    }

	if (IsEmpty(frmname.otel.value) == true) {
         alert("Input the Phone Number");
         frmname.otel.focus();
         return;
    }

	if (IsEmpty(frmname.oemail.value) == true) {
         alert("Input the Email");
         frmname.oemail.focus();
         return;
    }

	if (IsEmpty(frmname.rfname.value) == true) {
         alert("Input the First Name");
         frmname.rfname.focus();
         return;
    }
	if (IsEmpty(frmname.rlname.value) == true) {
         alert("Input the Last Name");
         frmname.rlname.focus();
         return;
    }
	if (IsEmpty(frmname.raddress1.value) == true) {
         alert("Input the address");
         frmname.raddress1.focus();
         return;
    }
	/*
	if (IsEmpty(frmname.raddress2.value) == true) {
         alert("Input the address");
         frmname.raddress2.focus();
         return;
    }
	*/

	if (IsEmpty(frmname.rcity.value) == true) {
         alert("Input the City");
         frmname.rcity.focus();
         return;
    }

	if (IsEmpty(frmname.rstate.value) == true) {
         alert("State Error1");
         frmname.rstate.focus();
         return;
    }
	if (IsEmpty(frmname.rcountry.value) == true) {
         alert("Country Error1");
         frmname.rcountry.focus();
         return;
    }
	if (IsEmpty(frmname.rpost.value) == true) {
         alert("Input the Postal Code");
         frmname.rpost.focus();
         return;
    }

	if (IsEmpty(frmname.rtel.value) == true) {
         alert("Input the Phone Number");
         frmname.rtel.focus();
         return;
    }

	if (IsEmpty(frmname.remail.value) == true) {
         alert("Input the Email");
         frmname.remail.focus();
         return;
    }
	if (IsEmpty(frmname.deliveryPrice.value) == true) {
         alert("Shipping Error");
         frmname.deliveryPrice.focus();
         return;
    }
	frmname.submit();
}

function orderFormCopy(){
	frmname = document.frm
	if(frmname.same.checked==true){
		frmname.rfname.value=frmname.ofname.value;
		frmname.rlname.value=frmname.olname.value;
		frmname.rcompany.value=frmname.ocompany.value;
		frmname.rtaxid.value=frmname.otaxid.value;
		frmname.raddress1.value=frmname.oaddress1.value;
		frmname.raddress2.value=frmname.oaddress2.value;

		frmname.rstate.value=frmname.ostate.value;
		frmname.rcountry.value=frmname.ocountry.value;

		frmname.rcity.value=frmname.ocity.value;
		frmname.rpost.value=frmname.opost.value;
		frmname.rtel.value=frmname.otel.value;
		frmname.remail.value=frmname.oemail.value;
		frmname.rfax.value=frmname.ofax.value;
	}else{
		frmname.rfname.value="";
		frmname.rlname.value="";
		frmname.raddress1.value="";
		frmname.raddress2.value="";
		frmname.rcompany.value="";
		frmname.rtaxid.value="";
		frmname.rcity.value="";
		frmname.rpost.value="";
		frmname.rtel.value="";
		frmname.remail.value="";
		frmname.rfax.value="";

	}
}

function engchange(input,str){
	if(document.frm.same.checked==true){
		for (i=0;i<input.options.length;i++) {
		  if (input.options[i].value == str) input.options[i].selected=true;
		}
	}
	index = document.frm.ostate.selectedIndex;
	document.frm.stateText.value = document.frm.ostate.options[index].text;
}

function selectForm(input,str){
	for (i=0;i<input.options.length;i++) {
	  if (input.options[i].value == str) input.options[i].selected=true;
	}
}

function changeCardExp(expDate){
	document.frm.x_exp_date.value = document.frm.cardexDate.value + "/"  + document.frm.cardexYear.value ;
}

function delivery(deliveryPrice){
//	test = Math.round(100,2);
//		alert(test);
	if(deliveryPrice==""){
		alert("error delivery");
	}else{
		all_total = document.frm.all_totalprice.value;
		oldPrice = document.frm.olddeliveryPrice.value;	
		all_total = parseFloat(all_total) - parseFloat(oldPrice);
		all_total = parseFloat(all_total) + parseFloat(deliveryPrice);
		document.frm.olddeliveryPrice.value = deliveryPrice;		
		result = Math.round(all_total * 100)/100;
		document.frm.all_totalprice.value = result.toFixed(2);
		index = document.frm.deliveryPrice.selectedIndex;
		document.frm.deliveryText.value = document.frm.deliveryPrice.options[index].text;
		document.frm.x_amount.value = result.toFixed(2);
		document.frm.x_freight.value = deliveryPrice;
	}
}

function orderFrm(){
	var frmname = document.frm;
	if (IsEmpty(frmname.deliveryPrice.value) == true) {
         alert("delivery Error!");
         frmname.deliveryPrice.focus();
         return;
    }
	if (IsEmpty(frmname.cardName.value) == true) {
         alert("Name on Card");
         frmname.cardName.focus();
         return;
    }
	if (IsEmpty(frmname.x_card_num.value) == true) {
         alert("Input the Card Number");
         frmname.x_card_num.focus();
         return;
    }


	if (IsEmpty(frmname.cardexDate.value) == true) {
         alert("Exp. Date");
         frmname.cardexDate.focus();
         return;
    }

	if (IsEmpty(frmname.cardexYear.value) == true) {
         alert("Exp. Date");
         frmname.cardexYear.focus();
         return;
    }

	if (IsEmpty(frmname.x_card_code.value) == true) {
         alert("Enter your 3 or 4 digit security code here");
         frmname.x_card_code.focus();
         return;
    }
	if (IsEmpty(frmname.billingZip.value) == true) {
         alert("Billing ZIP Code");
         frmname.billingZip.focus();
         return;
    }
	frmname.submit();
}

function orderFrm2(){
	var frmname = document.frm;
	if (IsEmpty(frmname.deliveryPrice.value) == true) {
         alert("delivery Error!");
         frmname.deliveryPrice.focus();
         return;
    }	
	frmname.submit();
}