$(document).ready(	function(){


	// 이미지 프리로딩 기능
	var _images2 = ["/v2/img/menu/m1.jpg", "/v2/img/menu/m2.jpg", "/v2/img/menu/m3.jpg", "/v2/img/menu/m4.jpg", "/v2/img/menu/m5.jpg", "/v2/img/menu/m6.jpg", "/v2/img/menu/m7.jpg", "/v2/img/menu/m1over.jpg", "/v2/img/menu/m2over.jpg", "/v2/img/menu/m3over.jpg", "/v2/img/menu/m4over.jpg", "/v2/img/menu/m5over.jpg", "/v2/img/menu/m6over.jpg", "/v2/img/menu/m7over.jpg", "/v2/img/menu/m1on.jpg", "/v2/img/menu/m2on.jpg", "/v2/img/menu/m3on.jpg", "/v2/img/menu/m4on.jpg", "/v2/img/menu/m5on.jpg", "/v2/img/menu/m6on.jpg", "/v2/img/menu/m7on.jpg", "/v2/img/menu/sm1.png", "/v2/img/menu/sm2.png", "/v2/img/menu/sm3.png", "/v2/img/menu/sm4.png", "/v2/img/menu/sm1on.png", "/v2/img/menu/sm2on.png", "/v2/img/menu/sm3on.png", "/v2/img/menu/sm4on.png", "/v2/img/footer/info_aboutus_on.png", "/v2/img/footer/info_style_sizes_on.png", "/v2/img/footer/info_payment_on.png", "/v2/img/footer/info_delivery_on.png", "/v2/img/footer/info_security_on.png", "/v2/img/footer/info_contactus_on.png", "/v2/img/footer/Tweeter_orange.png", "/v2/img/footer/09_Help_orange.png"];
 
	$.each(_images2,function(e) {
		// alert(this);
		$(new Image()).attr('src',this);
	});

	$(document).pngFix();





	$("#menu1").mousedown(function() { $("#menu1").css("background", "url(/v2/img/menu/m1on.jpg)"); });
	$("#menu1").mouseup(function() { $("#menu1").css("background", "url(/v2/img/menu/m1.jpg)");	
			window.location.href="http://supersuperficial.com/v2/goods/list.php?c=001000000";
	});
	
	$("#menu1").hover(
		function() {
			$("#menu_sub").show();
			$("#menu1").css("background", "url(/v2/img/menu/m1over.jpg)");				
		}, 
		function() {
			$("#menu1").css("background", "url(/v2/img/menu/m1.jpg)");
			$("#menu_sub").hide();
		}
	);
	
	$("#menu2").hover(
		function() { 
			$("#menu2").css("background", "url(/v2/img/menu/m2over.jpg)");
			$("#menu_sub").hide();
	 	},
	 	function() {
	 		$("#menu2").css("background", "url(/v2/img/menu/m2.jpg)");
	 	}
	);
	$("#menu2").mouseout(function() { $("#menu2").css("background", "url(/v2/img/menu/m2.jpg)"); });
	$("#menu2").mousedown(function() { $("#menu2").css("background", "url(/v2/img/menu/m2on.jpg)"); });
	$("#menu2").mouseup(function() { $("#menu2").css("background", "url(/v2/img/menu/m2.jpg)"); 
		window.location.href="http://supersuperficial.com/v2/goods/list.php?c=003000000";
	});	
	
	$("#menu3").hover(
		function() { 
			$("#menu3").css("background", "url(/v2/img/menu/m3over.jpg)");
	 	},
	 	function() {
	 		$("#menu3").css("background", "url(/v2/img/menu/m3.jpg)");
	 	}
	);
	$("#menu3").mouseout(function() { $("#menu3").css("background", "url(/v2/img/menu/m3.jpg)"); });
	$("#menu3").mousedown(function() { $("#menu3").css("background", "url(/v2/img/menu/m3on.jpg)"); });
	$("#menu3").mouseup(function() { $("#menu3").css("background", "url(/v2/img/menu/m3.jpg)"); 
		window.location.href="http://supersuperficial.com/v2/goods/list.php?c=004000000";
	});	
	
	$("#menu4").hover(
		function() { 
			$("#menu4").css("background", "url(/v2/img/menu/m4over.jpg)");
	 	},
	 	function() {
	 		$("#menu4").css("background", "url(/v2/img/menu/m4.jpg)");
	 	}
	);
	$("#menu4").mouseout(function() { $("#menu4").css("background", "url(/v2/img/menu/m4.jpg)"); });
	$("#menu4").mousedown(function() { $("#menu4").css("background", "url(/v2/img/menu/m4on.jpg)"); });
	$("#menu4").mouseup(function() { $("#menu4").css("background", "url(/v2/img/menu/m4.jpg)"); 
		window.location.href="http://supersuperficial.com/v2/goods/list.php?c=006000000";
	});	
	
	$("#menu5").hover(
		function() { 
			$("#menu5").css("background", "url(/v2/img/menu/m5over.jpg)");
	 	},
	 	function() {
	 		$("#menu5").css("background", "url(/v2/img/menu/m5.jpg)");
	 	}
	);
	$("#menu5").mouseout(function() { $("#menu5").css("background", "url(/v2/img/menu/m5.jpg)"); });
	$("#menu5").mousedown(function() { $("#menu5").css("background", "url(/v2/img/menu/m5on.jpg)"); });
	$("#menu5").mouseup(function() { $("#menu5").css("background", "url(/v2/img/menu/m5.jpg)"); 
		window.location.href="http://supersuperficial.com/v2/artist/";
	});		
	
	$("#menu6").hover(
		function() { 
			$("#menu6").css("background", "url(/v2/img/menu/m6over.jpg)");
	 	},
	 	function() {
	 		$("#menu6").css("background", "url(/v2/img/menu/m6.jpg)");
	 	}
	);
	$("#menu6").mouseout(function() { $("#menu6").css("background", "url(/v2/img/menu/m6.jpg)"); });
	$("#menu6").mousedown(function() { $("#menu6").css("background", "url(/v2/img/menu/m6on.jpg)"); });
	$("#menu6").mouseup(function() { $("#menu6").css("background", "url(/v2/img/menu/m6.jpg)"); 
		window.location.href="http://supersuperficial.com/v2/blog/";
	});	
	
	$("#menu7").hover(
		function() { 
			$("#menu7").css("background", "url(/v2/img/menu/m7over.jpg)");
	 	},
	 	function() {
	 		$("#menu7").css("background", "url(/v2/img/menu/m7.jpg)");
	 	}
	);
	$("#menu7").mouseout(function() { $("#menu7").css("background", "url(/v2/img/menu/m7.jpg)"); });
	$("#menu7").mousedown(function() { $("#menu7").css("background", "url(/v2/img/menu/m7on.jpg)"); });
	$("#menu7").mouseup(function() { $("#menu7").css("background", "url(/v2/img/menu/m7.jpg)"); 
		window.location.href="http://supersuperficial.com/v2/gallery7/";
	});	
	// 상단 대메뉴 조정 완료	
	
	
	// 서브 메뉴 조정
	$("#menu_sub").hover(
		function() { 
			$("#menu_sub").show(); 
		},function() { 
			$("#menu_sub").hide(); 
		} 
	);	
		

	$("#menu_sub1").hover(
		function() { 
			$("#menu_sub1").css("background", "url(/v2/img/menu/sm1on.png)");
		},function() { 
			$("#menu_sub1").css("background", "url(/v2/img/menu/sm1.png)");
		} 
	);
	
	$("#menu_sub1").click(function() {
		window.location.href="http://supersuperficial.com/v2/goods/list.php?c=001000000";
	});
	
	$("#menu_sub2").hover(
		function() { 
			$("#menu_sub2").css("background", "url(/v2/img/menu/sm2on.png)");
		},function() { 
			$("#menu_sub2").css("background", "url(/v2/img/menu/sm2.png)");
		} 
	);
	$("#menu_sub2").click(function() {
		window.location.href="http://supersuperficial.com/v2/goods/list.php?c=001000000&w=T";
	});		
	
	$("#menu_sub3").hover(
		function() { 
			$("#menu_sub3").css("background", "url(/v2/img/menu/sm3on.png)");
		},function() { 
			$("#menu_sub3").css("background", "url(/v2/img/menu/sm3.png)");
		} 
	);

	$("#menu_sub3").click(function() {
		window.location.href="http://supersuperficial.com/v2/goods/list.php?c=002000000";
	});
	
	$("#menu_sub4").hover(
		function() { 
			$("#menu_sub4").css("background", "url(/v2/img/menu/sm4on.png)");
		},function() { 
			$("#menu_sub4").css("background", "url(/v2/img/menu/sm4.png)");
		} 
	);				
	
	$("#menu_sub4").click(function() {
		window.location.href="http://supersuperficial.com/v2/goods/list.php?c=004000000";
	});		


		


	// 쿠키로 세션값, 이메일 가져오기

	var CookieSessionID = GetCookie("Cookie_Session_ID");
	var CookieMemberEmail = GetCookie("Cookie_Member_Email");
	


	function GetCookie (name) { 
	    var arg = name + "="; 
	    var alen = arg.length; 
	    var clen = document.cookie.length; 
	    var i = 0; 
	    while (i < clen) { 
	    var j = i + alen; 
	
	    if (document.cookie.substring(i, j) == arg) 
	        return getCookieVal (j); 
	            i = document.cookie.indexOf(" ", i) + 1; 
	    if (i == 0) break; 
		} 
	return null; 
	} 
	
	function getCookieVal(offset) { 
	    var endstr = document.cookie.indexOf (";", offset); 
	    if (endstr == -1) 
	        endstr = document.cookie.length; 
	        return unescape(document.cookie.substring(offset, endstr)); 
	} 


	
	var $isIE60;
	$isIE60 = false;
	
	if ($.browser.msie == true && $.browser.version == 6.0) {
		// alert('MS IE 6.0으로 접속하였습니다.');
 		$isIE60 = true;
 		$("#IE6Warning").show();
	} else {
		$("#IE6Warning").hide();
	}
	
	

	
	// 하단 info 롤오버
	$("#tail_info_0").hover(
		function () {
	    $(this).attr("src", "/v2/img/footer/09_Help_orange.png");
	  }, 
	  function () {
	    $(this).attr("src", "/v2/img/footer/09_Help_black.png");
	  }	
	);
	
	$("#tail_info_1").hover(
		function () {
	    $(this).attr("src", "/v2/img/footer/info_aboutus_on.png");
	  }, 
	  function () {
	    $(this).attr("src", "/v2/img/footer/info_aboutus.png");
	  }	
	);
	$("#tail_info_2").hover(
		function () {
	    $(this).attr("src", "/v2/img/footer/info_style_sizes_on.png");
	  }, 
	  function () {
	    $(this).attr("src", "/v2/img/footer/info_style_sizes.png");
	  }	
	);
	$("#tail_info_3").hover(
		function () {
	    $(this).attr("src", "/v2/img/footer/info_payment_on.png");
	  }, 
	  function () {
	    $(this).attr("src", "/v2/img/footer/info_payment.png");
	  }	
	);
	$("#tail_info_4").hover(
		function () {
	    $(this).attr("src", "/v2/img/footer/info_delivery_on.png");
	  }, 
	  function () {
	    $(this).attr("src", "/v2/img/footer/info_delivery.png");
	  }	
	);
	$("#tail_info_5").hover(
		function () {
	    $(this).attr("src", "/v2/img/footer/info_security_on.png");
	  }, 
	  function () {
	    $(this).attr("src", "/v2/img/footer/info_security.png");
	  }	
	);
	$("#tail_info_6").hover(
		function () {
	    $(this).attr("src", "/v2/img/footer/info_contactus_on.png");
	  }, 
	  function () {
	    $(this).attr("src", "/v2/img/footer/info_contactus.png");
	  }	
	);					
	$("#tail_info_7").hover(
		function () {
	    $(this).attr("src", "/v2/img/footer/Tweeter_orange.png");
	  }, 
	  function () {
	    $(this).attr("src", "/v2/img/footer/Tweeter_blue.png");
	  }	
	);		


	

	

	
	// Logo animation
	$("#top_logo a").css("margin-top","-170px").animate({marginTop: "-10px"}, 500 );	

	
	// Logo rollover
	$("#top_logo a").hover(	
	function() {
		$(this).stop().animate({ 
	        marginTop: 0
	      }, 500 );	
	},
	function(){
		$(this).animate({ 
        	marginTop: "-10px"
      	}, 500 );	
	});
	// Logo rollover 처리 완료


	$("#minibasket").hover(
			function(){
/*
				$("#minibasket").stop().animate({
					queue: false,
					top: 0 - 20
					}, 500);
*/					
			},
			function(){
				$("#minibasket").animate({
					queue: false,
					top: 0- $("#basket_content").height() - 20
				}, 500);
			}
			
		
		);	


	$(".checkBasket").click(function(event) {
		event.preventDefault();
		
		// alert($("#basket_content").height());
		
		// 이미 로드 되어 있다면 생략한다.
		if ($("#basket_contents").height() < 15) { 
			// alert('호출');
			BasketActionPro("R", "0", "N", CookieSessionID, CookieMemberEmail);
		}
		
		
		
		$("#minibasket").animate({
					queue: true,
					top: -20
				}, 500);
	});

// State  선택시 액션 (billing / shipping )
	$("#fm_County").change(function() {
		var str = "";
		$("#fm_County option:selected").each(function() {
			str = $(this).val();
		});
		
		
		
		var f = document.order_info;
		f.fm_County_city.value = str;
		$("#fm_County_city").parents('label').attr("display", "none");
	});


	$("#fm2_County").change(function() {
		var str = "";
		$("#fm2_County option:selected").each(function() {
			str = $(this).val();
		});
		
		var f = document.order_info;
		f.fm2_County_city.value = str;
	});
	
	
// fm_userCountry :: 국가 선택시 액션
	$("#fm_userCountry").change(function() {

		var f = document.order_info;
		
		var str = "";
		 $("#fm_userCountry option:selected").each(function () {
                str = $(this).val();	// 선택되어 있는 값 가져오기
          });

		// 타 배송지가 선택되어 있는 경우 루틴 종료
		if ($("#different-address-option").is(":checked")) {
			return false;
		} 


		// alert(str);
		if (str == "D" || str == "S") {
			$("#shipping_description").html("shipping cost will be  <br/>automatically updated here.");
			f.nationCode.value = "0";
			f.shipping_price.value = "0";
			$("#shipping_description").show();
			$("#shipping_info").hide();
			calculateTotal();	
			return;
		} else {
			// 서버에서 해당 정보 읽어오기
			f.nationCode.value = str;
			$("#shipping_description").hide();
			getShippingInfo(str);
		}
		
		
	}).change();
	
	
// fm2_userCountry
	$("#fm2_userCountry").change(function() {
		if ($("#different-address-option").is(":checked")) {

			var f = document.order_info;
					
			var str = "";
			 $("#fm2_userCountry option:selected").each(function () {
	                str = $(this).val();	// 선택되어 있는 값 가져오기
	          });
	

			// alert(str);
			if (str == "D" || str == "S") {
				$("#shipping_description").html("shipping cost will be  <br/>automatically updated here.");
				f.nationCode.value = "0";
				f.shipping_price.value = "0";
				$("#shipping_description").show();
				$("#shipping_info").hide();
				calculateTotal();	
				return;
			} else {
				// 서버에서 해당 정보 읽어오기
				f.nationCode.value = str;
				$("#shipping_description").hide();
				getShippingInfo(str);
				
			}
		
	
		}
	}).change();
	
	
	// shipping info 요청
	function getShippingInfo(idx) {
		// alert('서버로 shipping 정보 요청');
		$.get("/v2/basket/return_shipping_info.php", {"idx":idx}, function(xml) {
	
			$("shippingInfo", xml).each(function() {
				var $CountryName;
				var $DeliveryType;
				var $ShippingFee;
				var $EU;
				var $Free2;
				var $BasketCount;
			
				$CountryName = $(this).find("CountryName").text();
				$DeliveryType = $(this).find("DeliveryType").text();
				$ShippingFee = parseFloat($(this).find("ShippingFee").text()); 
				$EU = $(this).find("EU").text();
				$Free2 = $(this).find("Free2").text();
				$BasketCount = parseInt($(this).find("BasketCount").text());  
				
				
				// alert($EU);
				
				var f = document.order_info;
				f.shipping_price.value = $ShippingFee;
				
				// 화면상 나타나는 것을 조절한다. (배송정보 관련, 스타일 시트 적용 할것.)
				$("#shipping_info").show();
				$("#nation_name").text($CountryName);
				$("#delivery_type").text($DeliveryType);
				if ($Free2 == "Y") {
					$("#freeStr").hide();
				} else {
					$("#freeStr").hide();
				}
				

				if ($ShippingFee == 0) {
					$("#deliveryCommon").hide();
				} else {
					$("#deliveryCommon").show();
				}
				
				if ($DeliveryType == " Special Delivery") {
					$("#deliveryCommon").text("Royal Mail Special Delivery");
				} else {
					$("#deliveryCommon").html("Royal Mail Air Sure <br/>or International Signed For");
				}
				
				// alert($DeliveryType);
				/*
				if ($DeliveryType == "FREE Delivery") {
					$("#nation_name").removeClass('grayColor').addClass('orangeColor');
				} else {
					$("#nation_name").removeClass('orangeColor').addClass('grayColor');
				}
				*/
				
				$("#ShippingFeeResult").text("+£"+$ShippingFee.toFixed(2));
				
				
				calculateTotal();	

			
				
			});
			
		});
				
		
	}	
	
	
	
	
	function calculateTotal() {
		
		// 서버로 현재 가격을 요청한다.
		$.ajax({
			method: "get",
			url: "/v2/basket/calculate.php",
			data: "SID="+CookieSessionID+"&Email="+CookieMemberEmail,
			cache: false,
			success: function(xmlDoc){ 
			
			
				var $SubTotal = 0;
				var $OrderTotal = 0;
				var $MultibuyDiscountTotal = 0;
				var $calculateTotal = 0;
				var $newStampCount = 0;
				var $usedStampCount = 0;
				var $totalStampCount = 0;	// 총 계산된 보유한 스탬프 카운트
				var $discountTotal = 0;
				var $shipping_cost = 0;
				var $eventPriceTotal = 0;
				
				var f = document.order_info;
				
				$("BasketTotal", xmlDoc).each(function() {
				
					$SubTotal = $(this).find("SubTotal").text();
					$OrderTotal = $(this).find("OrderTotal").text();
					$MultibuyDiscountTotal = $(this).find("MultiBuyDiscount").text();
					$calculateTotal = parseFloat($OrderTotal -  parseFloat(f.coupon_discount.value) -  parseFloat(f.stamp_discount.value) + parseFloat(f.shipping_price.value));
					$newStampCount = parseInt($(this).find("NewStampCount").text());
					$usedStampCount = parseInt($(this).find("UsedStampCount").text());
					$totalStampCount =  parseInt($("#have_stamp_count").text()) + $newStampCount;
					$discountTotal = parseFloat(f.coupon_discount.value) +  parseFloat(f.stamp_discount.value) + parseFloat($MultibuyDiscountTotal) ;
					$shipping_cost = parseFloat(f.shipping_price.value);
					$eventPriceTotal = parseFloat($(this).find("eventPriceTotal").text());
					
					if (parseInt($SubTotal) == 0) {
						$("#noItemsMSG").show();
						$("#goods_list").css("background", "none");
					} else {
						$("#noItemsMSG").hide();
						$("#goods_list").css("background", "url(/v2/img/basket/basket_cord.png)");
						//goods_list background:url(/v2/img/basket/basket_cord.png)
					}
					
					// alert($eventPriceTotal);
					
					$("#subtotal").html("&pound;"+$SubTotal);
					$("#multibydiscount").html("-&pound;"+$MultibuyDiscountTotal);
					$("#eventdiscount").html("-&pound;"+$eventPriceTotal.toFixed(2));
					$("#total").html("&pound;"+$calculateTotal.toFixed(2));
					
					$("#subtotal_content1").html("&pound;"+$SubTotal);
					$("#subtotal_content2").html("+ &pound;"+$shipping_cost);
					$("#subtotal_content3").html("- &pound;"+($discountTotal + $eventPriceTotal).toFixed(2));
					$("#subtotal_content4").html("&pound;"+$calculateTotal.toFixed(2));

					// 폼의 히든밸류로 할당 (총 주문가격)
					
					f.totalPrice.value = $OrderTotal;
					f.GoodsCount.value = $newStampCount;
					
					$("#memberStampStr").text($newStampCount + 1);
					
					if (f.isLogin.value == "T") {

						// alert("usedStampCount : "+ $usedStampCount);
						
						var $useStamp;
						$useStamp = f.useStamp.value;
						
						if ($useStamp == "N") {
							// 스탬프를 사용하지 않았을 경우
							$("#new_stamp_count").text($newStampCount);
							if ($totalStampCount > 9) {
								$("#useStampButton").show();
							} else {
								$("#useStampButton").hide();
							}
						} else {
							if ($totalStampCount > 9) {
								$("#leftStampCount").text($totalStampCount - 10);		
							} else {
									f.useStamp.value = "N";
									f.stamp_discount.value = "0";
									
									$("#useStampView").hide();
									
									$("#have_stamp").show();
									$("#new_stamp").show();
									$("#new_stamp_count").text($newStampCount);

									$("#stamp_pic").attr("src", "/v2/img/basket/stamp_on.png");
									$calculateTotal = parseFloat(parseFloat($OrderTotal) -  parseFloat(f.coupon_discount.value) -  parseFloat(f.stamp_discount.value));
									$("#total").html("&pound;"+$calculateTotal.toFixed(2));
									$("#subtotal_content3").html("&pound;"+$discountTotal.toFixed(2));
									$("#subtotal_content4").html("&pound;"+$calculateTotal.toFixed(2));
							}
							
						}
							
					}
					
				});
				
			}
		});
		
		
		try {
			// 빨랫줄 정리
			var p = $("#goods_list .item:last");
			var p2 = $("#goods_list");
			var offset = p.offset();
			var offset2 = p2.offset();
			
			var g_height = parseInt(offset.top - offset2.top) + 20;
			
			
			$("#goods_list").height(g_height);				
		}
		catch(err) {
			$("#goods_list").height(0);
		}

	}



	function BasketActionPro(Mode, Prd_idx, p_Size, SID, Email) {
		
		var $url;
		/*
		if (Mode == "R" || Mode == "C") {
			$url = "/basket/basket.php";
		} else {
			$url = "/v2/basket/basket.php";
		}
		*/
		
		$url = "/v2/basket/basket.php";

		$.ajax({
			method: "get",
			url: $url,
			data: "m="+Mode+"&prd_idx="+Prd_idx+"&size="+p_Size+"&SID="+SID+"&Email="+Email,
			cache: false,
			success: function(xmlDoc){ 
			
				var BasketCount = 0;
				var WorkMode;	
				var result;
				var resultString;	
				var remainCount = 0;		
				var remainStr = "";
				var nowCount = 0;		
				var eventPriceTotal = 0;
				var debugStr;
			

				$("basket",xmlDoc).each(function() {  
				
					WorkMode = $(this).find("workMode").text();
					BasketCount = parseInt($(this).find("BasketCount").text());
					result  = $(this).find("result").text();
					resultString = $(this).find("resultString").text();
					
					
					debugStr = $(this).find("debugStr").text();
					
					// alert(debugStr);

					
					if (WorkMode == "B") {
						// alert(debugStr);
					}
					
					if (BasketCount > 10) {
						remainCount = BasketCount - 10;
						remainStr = "<tr><td colspan=4 style='text-align:left;color:#ff6000;font-weight:bold;'>You have  "+remainCount+" more items</td></tr>";
					}
					
					
					
					if (BasketCount == 0) {
						$(".checkBasket").text("");
						$(".checkout").text("");
					} else {
							
							$(".checkBasket").html(BasketCount+" items in your basket. &nbsp; &nbsp;");
							$(".checkout").text("Checkout");
						
					}
					
					// $("#moreStr").html(remainStr);
				});
				
				var $BasketContents;
				$BasketContents = "";
				$OrderContents = "";
				$("#basket_add_product_t").text("");	// 장바구니의 내용을 비운다.
				var idx, prd_idx, prd_size, prd_price, order_price, basket_type, artist_name, product_name, main_img, orgPrice;

				var sizeStr;
				// 장바구니 내용 만들기
				$("item", xmlDoc).each(function() {
					idx = $(this).find("idx").text();
					prd_idx = $(this).find("prd_idx").text();
					prd_size = $(this).find("prd_size").text();
					prd_price = $(this).find("prd_price").text();
					order_price = $(this).find("order_price").text();
					basket_type = $(this).find("basket_type").text();
					artist_name = $(this).find("artist_name").text();
					product_name = $(this).find("product_name").text();
					main_img = $(this).find("main_img").text();
					orgPrice = "";
					
					if (prd_price != order_price) {
						orgPrice = "<strike style='color:#cccccc;'>&pound;"+prd_price+"</strike><br/>";
					}
					
					switch (prd_size) {
						case "MS":
							sizeStr = "Men\'s Small";
							break;
						case "MM":
							sizeStr = "Men\'s Middle";
							break;
						case "ML":
							sizeStr = "Men\'s Large";
							break;
						case "WS":
							sizeStr = "Women\'s Small";
							break;
						case "WM":
							sizeStr = "Women\'s Middle";
							break;
						case "WL":
							sizeStr = "Women\'s Large";
							break;
						case "KS":
							sizeStr = "Kids Small";
							break;
						case "KM":
							sizeStr = "Kids Middle";
							break;
						case "SG":
							sizeStr = "One Size";
							break;

							
					}
					
					
					nowCount++;
					if (nowCount < 11) {
						$BasketContents = "<tr>";
						$BasketContents = $BasketContents + "<td>";
						$BasketContents = $BasketContents + "<a href=\"/v2/goods/contents.php?idx="+prd_idx+"\"><img src=\"/upimg/goods/s2/"+main_img+"\" width=\"34\" height=\"34\" alt=\"\" /></a>";
						$BasketContents = $BasketContents + "</td>";
						$BasketContents = $BasketContents + "<td>";
						$BasketContents = $BasketContents + "<a href=\"/v2/goods/contents.php?idx="+prd_idx+"\">"+product_name+"</a><br /> "+sizeStr+"</td>";
						/*
						$BasketContents = $BasketContents + "<td>";
						$BasketContents = $BasketContents + "<div class=\'quanity_control\'>";
						$BasketContents = $BasketContents + "<a href=\'#\' info=\'"+idx+"\' class=\'minus\'>-</a>";
						$BasketContents = $BasketContents + "<a href=\'#\' info=\'"+prd_idx+"|"+prd_size+"\' class=\'plus\'>+</a>";
						$BasketContents = $BasketContents + "</div>";
						$BasketContents = $BasketContents + "</td>";
						*/
						$BasketContents = $BasketContents + "<td class=\'digit price\'>";
						$BasketContents = $BasketContents + orgPrice;
						$BasketContents = $BasketContents + "&pound;"+order_price+"</td>";
						$BasketContents = $BasketContents + "</tr>";
					
						if (WorkMode == "R" || WorkMode == "C" || WorkMode == "P" || WorkMode == "D") { 
						// if (WorkMode == "R" ||  WorkMode == "P" || WorkMode == "D") { 
							$("#basket_add_product_t").append($BasketContents);	
						}
					}
				
				}); // 장바구니 내용 만들기 end




				if (WorkMode == "R" ||  WorkMode == "P" || WorkMode == "D") { 
					
					if (nowCount > 10) {
						$("#basket_add_product_t").append(remainStr);	
					}	
				}
													

				if (WorkMode == "C") {
					// 장바구니에 담기 결과 출력
					$("#basket_description").html(resultString);
					
					// 내려온 바스켓을 다시 올려준다.
					$("#minibasket").delay(1000).animate({
					queue: true,
					top: 0- $("#basket_content").height() - 20
					}, 500);
					
				}
				
				if (WorkMode == "A" || WorkMode == "B") {
					var f = document.order_info;
					var $SelectCountryIDX;
					$SelectCountryIDX = f.nationCode.value;
					
					if (!($SelectCountryIDX == "D" || $SelectCountryIDX == "S" || $SelectCountryIDX == "0")) {
						getShippingInfo($SelectCountryIDX);
					} else {
						calculateTotal();
					}
					
					
					// calculateTotal();
				}
				
								
			}
		}); //close $.ajax
	}

	// 무조건 order page에서 일어나는 액션으로 처리하면 된다.
	$('.quanity_control a.plus').live('click', function(event) {
		event.preventDefault();

		var tmpvalue = $(this).attr("info");
		var tmpArray = tmpvalue.split("|"); 

		BasketActionPro("A", tmpArray[0], tmpArray[1], CookieSessionID, CookieMemberEmail);	

		$('#goods_list .last').removeClass('last');
		$(this).closest('.item').clone(true).appendTo('#goods_list').hide().fadeIn();
		$('#goods_list .item:last').addClass('last');	
		
		var p = $("#goods_list .item:last");
		var p2 = $("#goods_list");
		var offset = p.offset();
		var offset2 = p2.offset();
		
		var g_height = parseInt(offset.top - offset2.top) + 20;
		$("#goods_list").height(g_height);
		
  	});
	
	

	$(".quanity_control a.minus").live('click', function(event){
		event.preventDefault();
		var tmpvalue = $(this).attr("info");
		
		
		// alert(CookieSessionID);
		BasketActionPro("B", tmpvalue, "", CookieSessionID, CookieMemberEmail);


		$('#goods_list .last').removeClass('last');
		$(this).closest('.item').fadeOut(function() { 
			$(this).remove();

		});
		$('#goods_list .item:last').addClass('last');		

				
	});



	

	

	// inputBasket
	$('#inputBasket').click(function(){
	
		var f = document.AddBasket;
		/*
		var chkRadio = 0;
		var checkSize;
		for(i=0;i<document.all.size.length;i++) {
			if(document.all.size[i].checked == true) {
		        chkRadio ++;
				checkSize = document.all.size[i].value;
		    }
		}
		*/
		var checkSize;
		checkSize = f.size.value;
		
		if (checkSize == "N" ) {
			document.getElementById("basket_description").innerHTML = "Please Select Size!";
			return;
		} else {
			document.getElementById("basket_description").innerHTML = "";
		}
		
		BasketActionPro("C", f.prd_idx.value, checkSize, CookieSessionID, CookieMemberEmail);
		
	})
	// end inputBasket

	// inputBasket_bag
	$('#inputBasket_bag').click(function(){
	
		var f = document.AddBasket;
		BasketActionPro("C", f.prd_idx.value, "MS", CookieSessionID, CookieMemberEmail);
		
	})
	// end inputBasket
	
});	
