Core.ShoppingCartBubble_Class=function(){this.ShoppingCartBubble_DivID="ShoppingCartBubble_Div";this.ShoppingCartBubble_SubTotalID="ShoppingCartBubble_SubTotal";this.ShoppingCartBubble_SubTotalID_1="ShoppingCartBubble_SubTotal_1";this.ShoppingCartBubble_SubTotalID_Header="ShoppingCartBubble_SubTotal_header";this.ShoppingCartBubble_TotalID="ShoppingCartBubble_Total";this.ShoppingCartBubble_TaxTotalID="ShoppingCartBubble_TaxTotal";this.ShoppingCartBubble_ShippingSubTotalID="ShoppingCartBubble_ShippingSubTotal";this.ShoppingCartBubble_TotalItemsID="ShoppingCartBubble_TotalItems";this.ShoppingCartBubble_TotalItemsID_Header_Outside="ShoppingCartBubble_TotalItems_header";this.ShoppingCartBubble_SuccessID="ShoppingCartBubble_Success";this.ShoppingCartBubble_FailureID="ShoppingCartBubble_Failure";this.ShoppingCartBubble_ProductNameID="ShoppingCartBubble_ProductName";this.ShoppingCartBubble_ProductImageID="ShoppingCartBubble_ProductImage";this.ShoppingCartBubble_VariantNameID="ShoppingCartBubble_VariantName";this.ShoppingCartBubble_ItemPriceID="ShoppingCartBubble_ItemPrice";this.ShoppingCartBubble_ItemQuantityID="ShoppingCartBubble_ItemQuantity";this.ShoppingCartBubble_LastItemTotalAmountID="ShoppingCartBubble_LastItemTotalAmount";this.ShoppingCartBubble_Last_Item_Added="ShoppingCartBubble_Last_Item_Added";this.ShoppingCartBubble_Last_Item_Added_Caption="ShoppingCartBubble_Last_Item_Added_Caption";this.beforeOpen=null;this.beforeClose=null;this.AddSingleProductToCartResultHandler=function(result){DoDefault();if(result!=null){if(result.ActivityStatus==true){_WebServiceAPI.RetrieveShoppingCart(GetCurrentCustomerID(),_ShoppingCartBubble_Class.RetrieveShoppingCartResultHandler)}else{if(result.ErrorString.indexOf("The maximum amount of the shopping cart is reach")!=-1&&result.ErrorString.indexOf(":")!=-1){var error_array=result.ErrorString.split(":");error_array[0]="The total amount of your order may not exceed $";alert(error_array[0]+formatAsMoney(error_array[1].replace(" ","")))}else{alert(result.ErrorString)}}}};this.RetrieveShoppingCartLastItemsResultHandler=function(result){DoDefault();if(result!=null){_ShoppingCartBubble_Class.DisplayShoppingCartAndLastItems(result)}};this.DisplayShoppingCartAndLastItems=function(){alert("this method is not finished yet, it is in progress");this.Show()};this.RetrieveShoppingCartResultHandler=function(result){DoDefault();if(result!=null){_ShoppingCartBubble_Class.DisplayShoppingCart(result)}};this.DisplayShoppingCart=function(result){DoDefault();var obj=$get(this.ShoppingCartBubble_SubTotalID);if(obj!=null){obj.innerHTML=result.SubTotal.toFixed(2);obj.innerHTML="$"+obj.innerHTML}var obj=$get(this.ShoppingCartBubble_SubTotalID_1);if(obj!=null){obj.innerHTML=result.SubTotal.toFixed(2);obj.innerHTML="$"+obj.innerHTML}var obj_h=$get(this.ShoppingCartBubble_SubTotalID_Header);if(obj_h!=null){obj_h.innerHTML=result.SubTotal.toFixed(2);obj_h.innerHTML="$"+obj_h.innerHTML}if($get(this.ShoppingCartBubble_TotalID)!=null){$get(this.ShoppingCartBubble_TotalID).innerHTML=result.Total.toFixed(2)}if($get(this.ShoppingCartBubble_TaxTotalID)!=null){$get(this.ShoppingCartBubble_TaxTotalID).innerHTML=result.TaxTotal.toFixed(2)}if($get(this.ShoppingCartBubble_ShippingSubTotalID)!=null){$get(this.ShoppingCartBubble_ShippingSubTotalID).innerHTML=result.ShippingSubTotal.toFixed(2)}if($get(this.ShoppingCartBubble_TotalItemsID)!=null){$get(this.ShoppingCartBubble_TotalItemsID).innerHTML=result.Quantity}if($get(this.ShoppingCartBubble_TotalItemsID_Header_Outside)!=null){$get(this.ShoppingCartBubble_TotalItemsID_Header_Outside).innerHTML=result.Quantity}this.DisplayShoppingCartLastItem();this.Show()};this.DisplayShoppingCartLastItem=function(){if($get(this.ShoppingCartBubble_ProductNameID)!=null){$get(this.ShoppingCartBubble_ProductNameID).innerHTML=_LastShoppingCartItem.ItemParentName}var objimage=$get(this.ShoppingCartBubble_ProductImageID);if(objimage!=null){objimage.src=IMAGES_RELATIVE_OR_ABSOLUTE_PATH+PRODUCT_SMALL_IMAGE_PREFIX+_LastShoppingCartItem.ItemParentCode+PRODUCT_SMALL_IMAGE_SUFFIX}if($get(this.ShoppingCartBubble_VariantNameID)!=null){$get(this.ShoppingCartBubble_VariantNameID).innerHTML=_LastShoppingCartItem.ItemName}if($get(this.ShoppingCartBubble_ItemPriceID)!=null){$get(this.ShoppingCartBubble_ItemPriceID).innerHTML="$"+_LastShoppingCartItem.ItemPrice}if($get(this.ShoppingCartBubble_ItemQuantityID)!=null){$get(this.ShoppingCartBubble_ItemQuantityID).innerHTML=_LastShoppingCartItem.ItemQuantity}if($get(this.ShoppingCartBubble_LastItemTotalAmountID)!=null){var _ItemTotalAmount=0;_ItemTotalAmount=parseInt(_LastShoppingCartItem.ItemQuantity)*_LastShoppingCartItem.ItemPrice;$get(this.ShoppingCartBubble_LastItemTotalAmountID).innerHTML=_ItemTotalAmount.toFixed(2)}if($get(this.ShoppingCartBubble_Last_Item_Added)!=null){$get(this.ShoppingCartBubble_Last_Item_Added).style.display=""}if($get(this.ShoppingCartBubble_Last_Item_Added_Caption)!=null){$get(this.ShoppingCartBubble_Last_Item_Added_Caption).style.display=""}};this.Show=function(){var obj=$get(this.ShoppingCartBubble_DivID);obj.style.visibility="visible";obj.style.display="";if(this.beforeOpen!=null){eval(this.beforeOpen+"();")}};this.Hide=function(){var obj=$get(this.ShoppingCartBubble_DivID);obj.style.visibility="hidden";obj.style.display="none";_QuickShop_Class.Hide();if(this.beforeClose!=null){eval(this.beforeClose+"();")}}};if(IsTypeDefined){Core.ShoppingCartBubble_Class.registerClass("Core.ShoppingCartBubble_Class")}Core.ShoppingCartItem_Class=function(){this.ItemCode="";this.ItemName="";this.ItemParentCode="";this.ItemParentName="";this.ItemQuantity=1;this.ItemPrice=0;this.IsVariantShade=false;this.PopulateData=function(b,d,c,a,e){this.ItemCode=b;this.ItemName=d;this.ItemParentCode=c;this.ItemParentName=a;this.ItemPrice=e}};if(IsTypeDefined){Core.ShoppingCartItem_Class.registerClass("Core.ShoppingCartItem_Class")}var _ShoppingCartBubble_Class=new Core.ShoppingCartBubble_Class();var _LastShoppingCartItem=new Core.ShoppingCartItem_Class();