
categoryDisplayJS={entitledItems:[],selectedProducts:new Object(),selectedAttributes:new Object(),errorMessages:new Object(),langId:"-1",storeId:"",catalogId:"",orderId:"",ajaxShopCart:true,ajaxMyAccount:true,contextChanged:false,isHistory:false,merchandisingAssociationItems:[],baseCatalogEntryDetails:[],associationThumbnailIndex:1,totalAssociationCount:0,baseItemAddedToCart:false,merchandisingProductAssociationAddToCart:false,merchandisingProductAssociationForm:"",isParentBundleBean:false,userType:"",moreInfoUrl:"",displayPrevAssociation:"",displayNextAssociation:"",defaultItemArray:[],currentPageType:"",currentCatalogEntryId:"",entitledItemJsonObject:null,initHistory:function(elementId,changeUrl){var historyObject=new categoryDisplayJS.HistoryTracker(elementId,changeUrl);dojo.back.setInitialState(historyObject);},setAjaxShopCart:function(ajaxShopCart){this.ajaxShopCart=ajaxShopCart;},setAjaxMyAccount:function(ajaxMyAccount){this.ajaxMyAccount=ajaxMyAccount;},setCommonParameters:function(langId,storeId,catalogId,userType){this.langId=langId;this.storeId=storeId;this.catalogId=catalogId;this.userType=userType;},setEntitledItems:function(entitledItemArray){this.entitledItems=entitledItemArray;},setSelectedAttribute:function(selectedAttributeName,selectedAttributeValue){console.debug(selectedAttributeName+" : "+selectedAttributeValue);this.selectedAttributes[selectedAttributeName]=selectedAttributeValue;this.moreInfoUrl=this.moreInfoUrl+'&'+selectedAttributeName+'='+selectedAttributeValue;},setSelectedAttributeOfProduct:function(productId,selectedAttributeName,selectedAttributeValue){selectedAttributesForProduct=new Object();if(this.selectedProducts[productId])selectedAttributesForProduct=this.selectedProducts[productId];selectedAttributesForProduct[selectedAttributeName]=selectedAttributeValue;this.selectedProducts[productId]=selectedAttributesForProduct;},gotoASubCategoryDisplayPage:function(pageNum,totalPages,pageSize,subCatDispUrl){pageNum=trim(pageNum);if(pageNum==""){MessageHelper.formErrorHandleClient(document.getElementById('subCategoriesListDisplayPageNum').id,MessageHelper.messages['ERROR_EMPTY_NUM']);return;}
if(MessageHelper.IsNumeric(pageNum,false)==false){MessageHelper.formErrorHandleClient(document.getElementById('subCategoriesListDisplayPageNum').id,MessageHelper.messages['ERROR_PAGE_NUM']);return;}
if(pageNum>=1&&pageNum<=totalPages){MessageHelper.hideAndClearMessage();var url=subCatDispUrl+"&beginIndex="+((pageNum-1)*pageSize);this.loadSubCategoryContentURL(url)}else{MessageHelper.formErrorHandleClient(document.getElementById('subCategoriesListDisplayPageNum').id,MessageHelper.messages['ERROR_PAGE_NUM']);return;}},getCatalogEntryId:function(){var attributeArray=[];for(attribute in this.selectedAttributes){attributeArray.push(attribute+"_"+this.selectedAttributes[attribute]);}
return this.resolveSKU(attributeArray);},getCatalogEntryIdforProduct:function(selectedAttributes){var attributeArray=[];for(attribute in selectedAttributes){attributeArray.push(attribute+"_"+selectedAttributes[attribute]);}
return this.resolveSKU(attributeArray);},resolveSKU:function(attributeArray){console.debug("Resolving SKU >> "+attributeArray+">>"+this.entitledItems);var catentry_id="";var attributeArrayCount=attributeArray.length;for(x in this.entitledItems){var catentry_id=this.entitledItems[x].catentry_id;var Attributes=this.entitledItems[x].Attributes;var attributeCount=0;for(index in Attributes){attributeCount++;}
if(attributeArrayCount==0&&attributeCount==0){return catentry_id;}
if(attributeCount!=0&&attributeArrayCount>=attributeCount){var matchedAttributeCount=0;for(attributeName in attributeArray){var attributeValue=attributeArray[attributeName];if(attributeValue in Attributes){matchedAttributeCount++;}}
if(attributeCount==matchedAttributeCount){console.debug("CatEntryId:"+catentry_id+" for Attribute: "+attributeArray);return catentry_id;}}}
return null;},updateParamObject:function(params,key,value,toArray,index){if(params==null){params=[];}
if(params[key]!=null&&toArray)
{if(dojo.lang.isArrayLike(params[key]))
{if(index!=null&&index!="")
{params[key][index]=value;}
else
{params[key].push(value);}}
else
{var tmpValue=params[key];params[key]=[];params[key].push(tmpValue);params[key].push(value);}}
else
{if(index!=null&&index!=""&&index!=-1)
{params[key+"_"+index]=value;}
else if(index==-1)
{var i=1;while(params[key+"_"+i]!=null)
{i++;}
params[key+"_"+i]=value;}
else
{params[key]=value;}}
return params;},setDefaultItem:function(productId,entitledItemId){this.defaultItemArray[productId]=entitledItemId;},getDefaultItem:function(productId){return this.defaultItemArray[productId];},AddBundle2ShopCartAjax:function(form){var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.orderId=".";params.calculationUsage="-1,-2,-3,-4,-5,-6,-7";var productCount=form["numberOfProduct"].value;for(var i=1;i<=productCount;i++){var catEntryId=form["catEntryId_"+i].value;if(this.selectedProducts[catEntryId])
catEntryId=this.getCatalogEntryIdforProduct(this.selectedProducts[catEntryId]);var qty=form["quantity_"+i].value;if(qty==null||qty==""||qty<=0){MessageHelper.displayErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);return;}
if(qty!=null&&qty!=''&&catEntryId!=null){this.updateParamObject(params,"catEntryId",catEntryId,false,-1);this.updateParamObject(params,"quantity",qty,false,-1);this.baseItemAddedToCart=true;}
else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}
var contractIdElements=document.getElementsByName('contractSelectForm_contractId_'+catEntryId);if(contractIdElements!=null&&contractIdElements!="undefined"){for(j=0;j<contractIdElements.length;j++){if(contractIdElements[j].checked){form["contractId_"+i].value=contractIdElements[j].value;break;}}}
var contractId=form["contractId_"+i].value;if(contractId!=null&&contractId!=''){this.updateParamObject(params,"contractId",contractId,false,-1);}}
if(!submitRequest()){return;}
cursor_wait();wc.service.invoke("AjaxAddOrderItem",params);},AddBundle2ShopCart:function(form){form.URL.value="AjaxOrderItemDisplayView";var productCount=form["numberOfProduct"].value;for(var i=1;i<=productCount;i++){var catEntryId=form["catEntryId_"+i].value;if(this.selectedProducts[catEntryId]){catEntryId=this.getCatalogEntryIdforProduct(this.selectedProducts[catEntryId]);if(catEntryId!=null)
form["catEntryId_"+i].value=catEntryId;else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}
var qty=form["quantity_"+i].value;if(qty==null||qty==""||qty<=0){MessageHelper.displayErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);return;}
var contractIdElements=document.getElementsByName('contractSelectForm_contractId_'+catEntryId);if(contractIdElements!=null&&contractIdElements!="undefined"){for(j=0;j<contractIdElements.length;j++){if(contractIdElements[j].checked){form["contractId_"+i].value=contractIdElements[j].value;break;}}}}
if(!submitRequest()){return;}
form.submit();},Add2ShopCart:function(entitledItemId,form,quantity,isPopup){var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();if(catalogEntryId!=null){if(this.merchandisingProductAssociationAddToCart){this.AddAssociation2ShopCart(catalogEntryId,quantity);return;}
form.catEntryId.value=catalogEntryId;form.productId.value=catalogEntryId;this.AddItem2ShopCart(form,quantity);hidePopup('second_level_category_popup');}else if(isPopup==true){dojo.byId('second_level_category_popup').style.zIndex='1';MessageHelper.formErrorHandleClient('addToCartLink',MessageHelper.messages['ERR_RESOLVING_SKU']);}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);}},AddItem2ShopCart:function(form,quantity){if(!isPositiveInteger(quantity)){MessageHelper.displayErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);return;}
form.quantity.value=quantity;var contractIdElements=document.getElementsByName('contractSelectForm_contractId');if(contractIdElements!=null&&contractIdElements!="undefined"){for(i=0;i<contractIdElements.length;i++){if(contractIdElements[i].checked){form.contractId.value=contractIdElements[i].value;break;}}}
if(!submitRequest()){return;}
form.submit();},Add2ShopCartAjax:function(entitledItemId,quantity,isPopup,customParams)
{var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();if(catalogEntryId==null){catalogEntryId=entitledItemId;}
if(catalogEntryId!=null){this.AddItem2ShopCartAjax(catalogEntryId,quantity,customParams);this.baseItemAddedToCart=true;hidePopup('second_level_category_popup');}
else if(isPopup==true){dojo.byId('second_level_category_popup').style.zIndex='1';MessageHelper.formErrorHandleClient('addToCartLinkAjax',MessageHelper.messages['ERR_RESOLVING_SKU']);}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);this.baseItemAddedToCart=false;}},setEntitledItemJsonObject:function(jsonObject){this.entitledItemJsonObject=jsonObject;},getEntitledItemJsonObject:function(){return this.entitledItemJsonObject;},ReplaceItemAjax:function(entitledItemId,quantity){var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();var removeOrderItemId="";var removeOrderItemId=replaceOrderItemId;var typeId=document.getElementById("shipmentTypeId");var addressId="";var shipModeId="";if(typeId!=null&&typeId!=""){if(typeId.value=="2"){addressId=document.getElementById("MS_ShipmentAddress_"+removeOrderItemId).value;shipModeId=document.getElementById("MS_ShippingMode_"+removeOrderItemId).value;}
else{addressId=document.getElementById("addressId_all").value;;shipModeId=document.getElementById("shipModeId_all").value;}}
if(catalogEntryId!=null){if(removeOrderItemId==""){}
else{this.ReplaceItemAjaxHelper(catalogEntryId,quantity,removeOrderItemId,addressId,shipModeId);}}
else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);}},ReplaceItemNonAjax:function(entitledItemId,quantity,form){var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();var removeOrderItemId="";var removeOrderItemId=replaceOrderItemId;if(catalogEntryId!=null){if(removeOrderItemId==""){}
else{form.orderItemId.value=removeOrderItemId;var addressId,shipModeId;if(quantity==0){console.debug("An invalid quantity was selected");}
if(form.shipmentTypeId!=null&&form.shipmenTypeId!=""){if(form.shipmentTypeId.value=="2"){addressId=document.getElementById("MS_ShipmentAddress_"+removeOrderItemId).value;;shipModeId=document.getElementById("MS_ShippingMode_"+removeOrderItemId).value;;}
else{addressId=document.getElementById("addressId_all").value;;shipModeId=document.getElementById("shipModeId_all").value;}
form.URL.value="OrderChangeServiceItemAdd?calculationUsage=-1,-2,-3,-4,-5,-6,-7&catEntryId="+catalogEntryId+"&quantity="+quantity+"&addressId="+addressId+"&shipModeId="+shipModeId+"&URL=OrderChangeServiceShipInfoUpdate?URL="+form.URL.value;}
else{form.URL.value="OrderChangeServiceItemAdd?calculationUsage=-1,-2,-3,-4,-5,-6,-7&catEntryId="+catalogEntryId+"&quantity="+quantity+"&URL="+form.URL.value;}
if(!submitRequest()){return;}
form.submit();}}
else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);}},AddItem2ShopCartAjax:function(catEntryIdentifier,quantity,customParams)
{var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.orderId=".";params.calculationUsage="-1,-2,-3,-4,-5,-6,-7";if(dojo.isArray(catEntryIdentifier)&&dojo.isArray(quantity)){for(var i=0;i<catEntryIdentifier.length;i++){if(!isPositiveInteger(quantity[i])){MessageHelper.displayErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);return;}
params["catEntryId_"+(i+1)]=catEntryIdentifier[i];params["quantity_"+(i+1)]=quantity[i];}}
else{if(!isPositiveInteger(quantity)){MessageHelper.displayErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);return;}
params.catEntryId=catEntryIdentifier;params.quantity=quantity;}
if(customParams!=null&&customParams!='undefined'){for(i in customParams){params[i]=customParams[i];}}
var contractIdElements=document.getElementsByName('contractSelectForm_contractId');if(contractIdElements!=null&&contractIdElements!="undefined"){for(i=0;i<contractIdElements.length;i++){if(contractIdElements[i].checked){params.contractId=contractIdElements[i].value;break;}}}
if(!submitRequest()){return;}
cursor_wait();if(this.ajaxShopCart){wc.service.invoke("AjaxAddOrderItem",params);this.baseItemAddedToCart=true;}else{wc.service.invoke("AjaxAddOrderItem_shopCart",params);this.baseItemAddedToCart=true;}
if(document.getElementById("headerShopCartLink")&&document.getElementById("headerShopCartLink").style.display!="none")
{document.getElementById("headerShopCart").focus();}},ReplaceItemAjaxHelper:function(catalogEntryId,qty,removeOrderItemId,addressId,shipModeId){var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.orderItemId=removeOrderItemId;params.orderId=(this.orderId!=null&&this.orderId!='undefined'&&this.orderId!='')?this.orderId:".";params.calculationUsage="-1,-2,-3,-4,-5,-6,-7";var params2=[];params2.storeId=this.storeId;params2.catalogId=this.catalogId;params2.langId=this.langId;params2.catEntryId=catalogEntryId;params2.quantity=qty;params2.orderId=(this.orderId!=null&&this.orderId!='undefined'&&this.orderId!='')?this.orderId:".";params2.calculationUsage="-1,-2,-3,-4,-5,-6,-7";var params3=[];params3.storeId=this.storeId;params3.catalogId=this.catalogId;params3.langId=this.langId;params3.orderId=(this.orderId!=null&&this.orderId!='undefined'&&this.orderId!='')?this.orderId:".";params3.calculationUsage="-1,-2,-3,-4,-5,-6,-7";params3.allocate="***";params3.backorder="***";params3.remerge="***";params3.check="*n";var shipInfoUpdateNeeded=false;if(addressId!=null&&addressId!=""&&shipModeId!=null&&shipModeId!=""){params3.addressId=addressId;params3.shipModeId=shipModeId;shipInfoUpdateNeeded=true;}
wc.service.declare({id:"AjaxReplaceItem",actionId:"AjaxReplaceItem",url:"AjaxOrderChangeServiceItemDelete",formId:"",successHandler:function(serviceResponse){if(!shipInfoUpdateNeeded){wc.service.invoke("AjaxAddOrderItem",params2);}
else{wc.service.invoke("AjaxAddOrderItemTemp",params2);}},failureHandler:function(serviceResponse){if(serviceResponse.errorMessage){MessageHelper.displayErrorMessage(serviceResponse.errorMessage);}else{if(serviceResponse.errorMessageKey){MessageHelper.displayErrorMessage(serviceResponse.errorMessageKey);}}
cursor_clear();}});wc.service.declare({id:"AjaxAddOrderItemTemp",actionId:"AjaxAddOrderItemTemp",url:"AjaxOrderChangeServiceItemAdd",formId:"",successHandler:function(serviceResponse){wc.service.invoke("OrderItemAddressShipMethodUpdate",params3);},failureHandler:function(serviceResponse){MessageHelper.displayErrorMessage(serviceResponse.errorMessageKey);}});if(!submitRequest()){return;}
cursor_wait();wc.service.invoke("AjaxReplaceItem",params);},AddBundle2WishList:function(form){if(!isAuthenticated){setWarningMessageCookie('WISHLIST_GUEST_ADDITEM');}
var productCount=form["numberOfProduct"].value;for(var i=1;i<=productCount;i++){var catEntryId=form["catEntryId_"+i].value;if(this.selectedProducts[catEntryId]){catEntryId=this.getCatalogEntryIdforProduct(this.selectedProducts[catEntryId]);if(catEntryId!=null)
form["catEntryId_"+i].value=catEntryId;else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}}
form.action="InterestItemAdd";form.page.value="customerlinkwishlist";if(this.ajaxMyAccount){if(this.userType=='G'){form.URL.value='InterestItemDisplay';}else{form.URL.value='AjaxLogonForm';}}else{if(this.userType=='G'){form.URL.value='InterestItemDisplay';}else{form.URL.value='NonAjaxAccountWishListDisplayView';}}
if(!submitRequest()){return;}
form.submit();},AddBundle2WishListAjax:function(form){if(!isAuthenticated){setWarningMessageCookie('WISHLIST_GUEST_ADDITEM');}
var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.updateable=0;params.orderId=".";var catEntryArray=[];catEntryArray=form.catEntryIDS.value.toString().split(",");for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.selectedProducts[catEntryArray[i]])
catEntryId=this.getCatalogEntryIdforProduct(this.selectedProducts[catEntryArray[i]]);if(qty==0||qty==null)qty=1;if(qty!=null&&qty!=''&&catEntryId!=null){this.updateParamObject(params,"catEntryId",catEntryId,false,-1);this.updateParamObject(params,"quantity",qty,false,-1);}
else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}
if(!submitRequest()){return;}
cursor_wait();wc.service.invoke("AjaxInterestItemAdd",params);},Add2WishListAjaxByID:function(catalogEntryId)
{if(catalogEntryId!=null){if(!isAuthenticated){setWarningMessageCookie('WISHLIST_GUEST_ADDITEM');}
var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.catEntryId=catalogEntryId;params.updateable=0;params.URL="SuccessfulAJAXRequest";if(document.getElementById("controllerURLWishlist")!=null&&document.getElementById("controllerURLWishlist")!='undefined')
CommonControllersDeclarationJS.setControllerURL("WishlistDisplay_Controller",document.getElementById("controllerURLWishlist").value);if(!submitRequest()){return;}
cursor_wait();if(this.ajaxShopCart)
wc.service.invoke("AjaxInterestItemAdd",params);else
wc.service.invoke("AjaxInterestItemAdd_shopCart",params);}
else MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);},Add2WishListAjax:function(entitledItemId)
{if(!isAuthenticated){setWarningMessageCookie('WISHLIST_GUEST_ADDITEM');}
var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();this.Add2WishListAjaxByID(catalogEntryId);},AddItem2WishListAjax:function(itemId)
{if(!isAuthenticated){setWarningMessageCookie('WISHLIST_GUEST_ADDITEM');}
var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.catEntryId=itemId;params.updateable=0;params.URL="SuccessfulAJAXRequest";if(document.getElementById("controllerURLWishlist")!=null&&document.getElementById("controllerURLWishlist")!='undefined')
CommonControllersDeclarationJS.setControllerURL("WishlistDisplay_Controller",document.getElementById("controllerURLWishlist").value);if(!submitRequest()){return;}
cursor_wait();if(this.ajaxShopCart)
wc.service.invoke("AjaxInterestItemAdd",params);else
wc.service.invoke("AjaxInterestItemAdd_shopCart",params);},Add2WishList:function(entitledItemId,form)
{if(!isAuthenticated){setWarningMessageCookie('WISHLIST_GUEST_ADDITEM');}
var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();this.Add2WishListByID(catalogEntryId,form);},Add2WishListByID:function(catalogEntryId,form)
{if(!isAuthenticated){setWarningMessageCookie('WISHLIST_GUEST_ADDITEM');}
if(catalogEntryId!=null){form.productId.value=catalogEntryId;form.catEntryId.value=catalogEntryId;form.action="InterestItemAdd";form.page.value="customerlinkwishlist";if(this.ajaxMyAccount){if(this.userType=='G'){form.URL.value='InterestItemDisplay';}else{form.URL.value='AjaxLogonForm';}}else{if(this.userType=='G'){form.URL.value='InterestItemDisplay';}else{form.URL.value='NonAjaxAccountWishListDisplayView';}}
form.quantity.value="1";if(!submitRequest()){return;}
form.submit();}
else MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);},AddItem2WishList:function(form)
{if(!isAuthenticated){setWarningMessageCookie('WISHLIST_GUEST_ADDITEM');}
form.action="InterestItemAdd"
form.quantity.value="1";form.page.value="customerlinkwishlist";if(this.ajaxMyAccount){if(this.userType=='G'){form.URL.value='InterestItemDisplay';}else{form.URL.value='AjaxLogonForm';}}else{if(this.userType=='G'){form.URL.value='InterestItemDisplay';}else{form.URL.value='NonAjaxAccountWishListDisplayView';}}
if(!submitRequest()){return;}
form.submit();},loadContentURL:function(contentURL){var document_protocol=(('https:'==document.location.protocol)?'https://':'http://');if(contentURL.substring(0,2)=="//"){contentURL=contentURL.replace("//",document_protocol);}
if(!submitRequest()){return;}
cursor_wait();CommonControllersDeclarationJS.setControllerURL('CategoryDisplay_Controller',contentURL);wc.render.updateContext("CategoryDisplay_Context");},loadCustomContentURL:function(contentURL){cursor_wait();CommonControllersDeclarationJS.setControllerURL('CategoryDisplay_Controller',contentURL);wc.render.updateContext("CategoryDisplay_Context");},loadSubCategoryContentURL:function(contentURL){MessageHelper.hideAndClearMessage();if(!submitRequest()){return;}
cursor_wait();CommonControllersDeclarationJS.setControllerURL('SubCategoryDisplay_Controller',contentURL);wc.render.updateContext("SubCategoryDisplay_Context");},goBack:function(){categoryDisplayJS.loadContentURL(this.changeUrl);categoryDisplayJS.isHistory=true;},goForward:function(){categoryDisplayJS.loadContentURL(this.changeUrl);isHistory=true;},HistoryTracker:function(elementId,changeUrl){this.elementId=elementId;this.changeUrl=changeUrl;},processBookmarkURL:function(){var bookmarkId=location.hash;if(bookmarkId){bookmarkId=bookmarkId.substring(1,bookmarkId.length);}
if(bookmarkId){var indexOfIdentifier=bookmarkId.indexOf("identifier",0);if(indexOfIdentifier>=0){var realUrl=bookmarkId.substring(0,indexOfIdentifier-1);}}
if(bookmarkId==null||bookmarkId==""){}},initializeMerchandisingAssociation:function(thumbnailIndex){var associationDisplay=document.getElementById("marchandisingAssociationDisplay");var totalPriceMsg=document.getElementById("totalPriceMsg").value;var baseCatEntryJSON=eval('('+dojo.byId("baseCatEntryDetails").innerHTML+')');this.baseCatalogEntryDetails=baseCatEntryJSON;var basePrice=this.baseCatalogEntryDetails[0].baseCatEntry_Price;this.totalAssociationCount=this.baseCatalogEntryDetails[0].totalAssociations;var identifierJSON="associatedCatEntries_"+thumbnailIndex;var associationEntryJSON=eval('('+dojo.byId(identifierJSON).innerHTML+')');this.merchandisingAssociationItems=associationEntryJSON;var totalPrice=parseFloat(basePrice)+parseFloat(this.merchandisingAssociationItems[0].catEntry_Price);var dragType="";if(this.merchandisingAssociationItems[0].catEntry_Type=='ProductBean'){dragType="product";}else if(this.merchandisingAssociationItems[0].catEntry_Type=='ItemBean'){dragType="item";}else if(this.merchandisingAssociationItems[0].catEntry_Type=='PackageBean'){dragType="package";}else if(this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){dragType="bundle";}
var widgetHTML="";if(document.getElementById('addToCartLink')){var url="AjaxOrderItemDisplayView?storeId="+this.storeId+"&catalogId="+this.catalogId+"&langId="+this.langId;widgetHTML=widgetHTML
+"<form name='OrderItemAddForm_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' action='OrderChangeServiceItemAdd' method='post' id='OrderItemAddForm_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'>\n"
+"<input type='hidden' name='storeId' value='"+this.storeId+"' id='OrderItemAddForm_storeId_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' name='orderId' value='.' id='OrderItemAddForm_orderId_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' name='catalogId' value='"+this.catalogId+"' id='OrderItemAddForm_orderId_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' name='URL' value='"+url+"' id='OrderItemAddForm_url_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' name='errorViewName' value='InvalidInputErrorView' id='OrderItemAddForm_errorViewName_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' name='catEntryId' value='"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' id='OrderItemAddForm_catEntryId_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' name='productId' value='"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' id='OrderItemAddForm_productId_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' value='1' name='quantity' id='OrderItemAddForm_quantity_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' value='' name='page' id='OrderItemAddForm_page_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' value='-1,-2,-3,-4,-5,-6,-7' name='calculationUsage' id='OrderItemAddForm_calcUsage_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' value='0' name='updateable' id='OrderItemAddForm_updateable_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"<input type='hidden' value='' name='giftListId' id='OrderItemAddForm_giftListId_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'/>\n"
+"</form>\n";}
widgetHTML=widgetHTML
+"<div class='scroller' id='WC_CategoryDisplayJS_div_1'>";if(this.totalAssociationCount>1){if(this.associationThumbnailIndex<this.totalAssociationCount){widgetHTML=widgetHTML
+"  <a href='Javascript:categoryDisplayJS.showNextAssociation()'  id='WC_ProductAssociation_UpArrow_Link_1'>";}
widgetHTML=widgetHTML
+"  <img src='"+this.baseCatalogEntryDetails[0].storeImage_Path+"i_up_arrow.png' alt='"+this.displayNextAssociation+"'/></a>";}
widgetHTML=widgetHTML+" <br />"
+"<div id='baseContent_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"'";if(this.merchandisingAssociationItems[0].showProductQuickView=='true'){widgetHTML=widgetHTML
+" onmouseover='showPopupButton("+this.merchandisingAssociationItems[0].catEntry_Identifier+");' onmouseout='hidePopupButton("+this.merchandisingAssociationItems[0].catEntry_Identifier+");'>";}else{widgetHTML=widgetHTML
+" >";}
if(this.merchandisingAssociationItems[0].productDragAndDrop=='true'){widgetHTML=widgetHTML
+" <div dojoType='dojo.dnd.Source' jsId='dndSource' id="+this.merchandisingAssociationItems[0].catEntry_Identifier+" copyOnly='true' dndType='"+dragType+"'>"
+"  <div class='dojoDndItem' dndType='"+dragType+"' id='WC_CategoryDisplayJS_div_draganddrop'>";}
widgetHTML=widgetHTML
+" <a href='"+this.merchandisingAssociationItems[0].catEntry_ProductLink+"'  id='img"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' onfocus='showPopupButton("+this.merchandisingAssociationItems[0].catEntry_Identifier+");'>";if(this.merchandisingAssociationItems[0].productDragAndDrop=='true'&&dojo.isIE==6)
{widgetHTML=widgetHTML
+"<iframe class='productDnDIFrame' scrolling='no' frameborder='0' src='"+getImageDirectoryPath()+"images/empty.gif'></iframe>";}
widgetHTML=widgetHTML
+"  <img src='"+this.merchandisingAssociationItems[0].catEntry_Thumbnail+"' alt='"+this.merchandisingAssociationItems[0].catEntry_ShortDescription+"' class='img' width='70' height='70'/>"
+" </a><br />";if(this.merchandisingAssociationItems[0].productDragAndDrop=='true'){widgetHTML=widgetHTML
+"  </div>"
+" </div>";}
if(this.merchandisingAssociationItems[0].showProductQuickView=='true'){widgetHTML=widgetHTML
+" <div id='popupButton_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' class='main_quickinfo_button'>"
+"<span class='secondary_button' >\n"
+"<span class='button_container' >\n"
+"<span class='button_bg' >\n"
+"<span class='button_top'>\n"
+"<span class='button_bottom'>\n"
+"<a id='QuickInfoButton_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' href='#' onclick='javaScript:var actionListImageAcct = new popupActionProperties(); actionListImageAcct.showWishList="+this.merchandisingAssociationItems[0].associationProductBuyable+"; actionListImageAcct.showAddToCart="+this.merchandisingAssociationItems[0].associationProductBuyable+"; showPopup("+this.merchandisingAssociationItems[0].catEntry_Identifier+","+this.storeId+","+this.langId+","+this.catalogId+",event,null,null,actionListImageAcct);' onkeypress='javaScript:var actionListImageAcct = new popupActionProperties(); actionListImageAcct.showWishList="+this.merchandisingAssociationItems[0].associationProductBuyable+"; actionListImageAcct.showAddToCart="+this.merchandisingAssociationItems[0].associationProductBuyable+"; showPopup("+this.merchandisingAssociationItems[0].catEntry_Identifier+","+this.storeId+","+this.langId+","+this.catalogId+",event,null,null,actionListImageAcct);' onblur='hidePopupButton("+this.merchandisingAssociationItems[0].catEntry_Identifier+");' role='wairole:button' waistate:haspopup='true'>"+this.merchandisingAssociationItems[0].showProductQuickViewLable+"</a>"
+"</span>\n"
+"</span>\n"
+"</span>\n"
+"</span>\n"
+"</span>\n"
+"</div>\n";}
widgetHTML=widgetHTML
+"</div>";if(this.totalAssociationCount>1){if(this.associationThumbnailIndex>1){widgetHTML=widgetHTML
+"  <a href='Javascript:categoryDisplayJS.showPreviousAssociation()'  id='WC_ProductAssociation_DownArrow_Link_1'>";}
widgetHTML=widgetHTML
+"  <img src='"+this.baseCatalogEntryDetails[0].storeImage_Path+"i_down_arrow.png' alt='"+this.displayPrevAssociation+"'/></a>";}
var comboText=this.baseCatalogEntryDetails[0].associatedProductsName.replace(/%0/,this.baseCatalogEntryDetails[0].baseCatEntry_Name);comboText=comboText.replace(/%1/,this.merchandisingAssociationItems[0].catEntry_Name);widgetHTML=widgetHTML
+"</div>"
+"<div class='combo_text' id='WC_CategoryDisplayJS_div_2'>\n"
+" <h1 class='status_msg'>"+comboText+"</h1>\n"
+" <span class='grey'>"+totalPriceMsg+dojo.currency.format(totalPrice.toFixed(2),{currency:this.baseCatalogEntryDetails[0].currency})+"</span>\n"
+"</div>\n";widgetHTML=widgetHTML
+"<input type='hidden' id='compareImgPath_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' value='"+this.merchandisingAssociationItems[0].catEntry_Thumbnail_compare+"'/>"
+"<input type='hidden' id='compareProductDetailsPath_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' value='"+this.merchandisingAssociationItems[0].catEntry_ProductLink+"'/>"
+"<input type='hidden' id='compareImgDescription_"+this.merchandisingAssociationItems[0].catEntry_Identifier+"' value='"+this.merchandisingAssociationItems[0].catEntry_ShortDescription+"'/>";associationDisplay.innerHTML=null;associationDisplay.innerHTML=widgetHTML;dojo.parser.parse(associationDisplay);},showNextAssociation:function(){if(this.associationThumbnailIndex<this.totalAssociationCount){this.associationThumbnailIndex=this.associationThumbnailIndex+1;this.initializeMerchandisingAssociation(this.associationThumbnailIndex);}},showPreviousAssociation:function(){if(this.associationThumbnailIndex>1){this.associationThumbnailIndex=this.associationThumbnailIndex-1;this.initializeMerchandisingAssociation(this.associationThumbnailIndex);}},AddAssociation2ShopCartAjax:function(baseProductId,baseProductQuantity){var identifierJSON="associatedCatEntries_"+this.associationThumbnailIndex;var associationEntryJSON=eval('('+dojo.byId(identifierJSON).innerHTML+')');this.merchandisingAssociationItems=associationEntryJSON;this.baseItemAddedToCart=false;if(this.merchandisingAssociationItems[0].catEntry_Type=='ProductBean'){this.Add2ShopCartAjax(baseProductId,baseProductQuantity);if(this.baseItemAddedToCart){showPopup(this.merchandisingAssociationItems[0].catEntry_Identifier,this.storeId,this.langId,this.catalogId,function(e){return e;},'marchandisingAssociationDisplay');}}else if(this.merchandisingAssociationItems[0].catEntry_Type=='ItemBean'||this.merchandisingAssociationItems[0].catEntry_Type=='PackageBean'||this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var entitledItemJSON=eval('('+dojo.byId(baseProductId).innerHTML+')');this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.orderId=".";params.calculationUsage="-1,-2,-3,-4,-5,-6,-7";if(catalogEntryId!=null){this.updateParamObject(params,"catEntryId",catalogEntryId,false,-1);this.updateParamObject(params,"quantity",baseProductQuantity,false,-1);if(this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var form=document.getElementById(this.merchandisingAssociationItems[0].catEntry_BundleFormId);var catEntryArray=[];catEntryArray=form.catEntryIDS.value.toString().split(",");for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.getDefaultItem(catEntryArray[i]))
catEntryId=this.getDefaultItem(catEntryArray[i]);if(qty==0||qty==null)qty=1;if(qty!=null&&qty!=''&&catEntryId!=null){this.updateParamObject(params,"catEntryId",catEntryId,false,-1);this.updateParamObject(params,"quantity",qty,false,-1);}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}}else{this.updateParamObject(params,"catEntryId",this.merchandisingAssociationItems[0].catEntry_Identifier,false,-1);this.updateParamObject(params,"quantity",1,false,-1);}}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}
if(!submitRequest()){return;}
cursor_wait();wc.service.invoke("AjaxAddOrderItem",params);}},AddMarchandisingAssociation2ShopCart:function(entitledItemId,form,quantity){var identifierJSON="associatedCatEntries_"+this.associationThumbnailIndex;var associationEntryJSON=eval('('+dojo.byId(identifierJSON).innerHTML+')');this.merchandisingAssociationItems=associationEntryJSON;var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId_1=this.getCatalogEntryId();if(this.merchandisingAssociationItems[0].catEntry_Type=='ProductBean'){if(catalogEntryId_1!=null){form.catEntryId_1.value=catalogEntryId_1;form.productId_1.value=catalogEntryId_1;form.quantity_1.value=quantity;this.merchandisingProductAssociationAddToCart=true;this.merchandisingProductAssociationForm=form;showPopup(this.merchandisingAssociationItems[0].catEntry_Identifier,this.storeId,this.langId,this.catalogId,function(e){return e;},'marchandisingAssociationDisplay');}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}else if(this.merchandisingAssociationItems[0].catEntry_Type=='ItemBean'||this.merchandisingAssociationItems[0].catEntry_Type=='PackageBean'||this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){if(catalogEntryId_1!=null){form.catEntryId_1.value=catalogEntryId_1;form.productId_1.value=catalogEntryId_1;form.quantity_1.value=quantity;if(this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var bundleForm=document.getElementById(this.merchandisingAssociationItems[0].catEntry_BundleFormId);var catEntryArray=[];catEntryArray=bundleForm.catEntryIDS.value.toString().split(",");var catEntryCount=3;for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.getDefaultItem(catEntryArray[i]))
catEntryId=this.getDefaultItem(catEntryArray[i]);if(qty==0||qty==null)qty=1;if(qty!=null&&qty!=''&&catEntryId!=null){if(i==0){form.catEntryId_2.value=catEntryId;form.productId_2.value=catEntryId;form.quantity_2.value=qty;}else{var input1=document.createElement("input");input1.setAttribute("id","OrderAssociationItemAddForm_catEntryId_"+catEntryId);input1.setAttribute("type","hidden");input1.setAttribute("name","catEntryId_"+catEntryCount);input1.setAttribute("value",catEntryId);form.appendChild(input1);var input2=document.createElement("input");input2.setAttribute("id","OrderAssociationItemAddForm_productId_"+catEntryId);input2.setAttribute("type","hidden");input2.setAttribute("name","productId_"+catEntryCount);input2.setAttribute("value",catEntryId);form.appendChild(input2);var quantity1=document.createElement("input");quantity1.setAttribute("id","OrderAssociationItemAddForm_quantity_"+catEntryId);quantity1.setAttribute("type","hidden");quantity1.setAttribute("name","quantity_"+catEntryCount);quantity1.setAttribute("value","1");form.appendChild(quantity1);catEntryCount=catEntryCount+1;}}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}}else{form.catEntryId_2.value=this.merchandisingAssociationItems[0].catEntry_Identifier;form.productId_2.value=this.merchandisingAssociationItems[0].catEntry_Identifier;form.quantity_2.value="1";}
if(!submitRequest()){return;}
form.submit();}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}},AddAssociation2ShopCart:function(associatedItemId,quantity){var form=this.merchandisingProductAssociationForm;this.merchandisingProductAssociationAddToCart=false;if(this.isParentBundleBean){var catEntryArray=[];catEntryArray=form.catEntryIDS.value.toString().split(",");var bundleItemsCount=1;for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.selectedProducts[catEntryArray[i]])
catEntryId=this.getCatalogEntryIdforProduct(this.selectedProducts[catEntryArray[i]]);if(qty==0||qty==null)qty=1;if(qty!=null&&qty!=''&&catEntryId!=null){var input1=document.createElement("input");input1.setAttribute("id","OrderItemAddForm_catEntryId_"+catEntryId);input1.setAttribute("type","hidden");input1.setAttribute("name","catEntryId_"+bundleItemsCount);input1.setAttribute("value",catEntryId);bundleItemsCount=bundleItemsCount+1;form.appendChild(input1);}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}
var input2=document.createElement("input");input2.setAttribute("id","OrderItemAddForm_catEntryId_"+associatedItemId);input2.setAttribute("type","hidden");input2.setAttribute("name","catEntryId_"+bundleItemsCount);input2.setAttribute("value",associatedItemId);form.appendChild(input2);var quantity1=document.createElement("input");quantity1.setAttribute("id","OrderItemAddForm_quantity_"+associatedItemId);quantity1.setAttribute("type","hidden");quantity1.setAttribute("name","quantity_"+bundleItemsCount);quantity1.setAttribute("value",quantity);form.appendChild(quantity1);form.URL.value="AjaxOrderItemDisplayView";this.isParentBundleBean=false;}else{form.catEntryId_2.value=associatedItemId;form.productId_2.value=associatedItemId;form.quantity_2.value=quantity;}
if(!submitRequest()){return;}
form.submit();this.merchandisingProductAssociationForm="";},AddAssociationItem2ShopCartAjax:function(baseItemId,baseItemQuantity){var identifierJSON="associatedCatEntries_"+this.associationThumbnailIndex;var associationEntryJSON=eval('('+dojo.byId(identifierJSON).innerHTML+')');this.merchandisingAssociationItems=associationEntryJSON;this.baseItemAddedToCart=false;if(this.merchandisingAssociationItems[0].catEntry_Type=='ProductBean'){this.AddItem2ShopCartAjax(baseItemId,baseItemQuantity);if(this.baseItemAddedToCart){showPopup(this.merchandisingAssociationItems[0].catEntry_Identifier,this.storeId,this.langId,this.catalogId,function(e){return e;},'marchandisingAssociationDisplay');}}else if(this.merchandisingAssociationItems[0].catEntry_Type=='ItemBean'||this.merchandisingAssociationItems[0].catEntry_Type=='PackageBean'||this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.orderId=".";params.calculationUsage="-1,-2,-3,-4,-5,-6,-7";this.updateParamObject(params,"catEntryId",baseItemId,false,-1);this.updateParamObject(params,"quantity",baseItemQuantity,false,-1);if(this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var form=document.getElementById(this.merchandisingAssociationItems[0].catEntry_BundleFormId);var catEntryArray=[];catEntryArray=form.catEntryIDS.value.toString().split(",");for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.getDefaultItem(catEntryArray[i]))
catEntryId=this.getDefaultItem(catEntryArray[i]);if(qty==0||qty==null)qty=1;if(qty!=null&&qty!=''&&catEntryId!=null){this.updateParamObject(params,"catEntryId",catEntryId,false,-1);this.updateParamObject(params,"quantity",qty,false,-1);}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}}else{this.updateParamObject(params,"catEntryId",this.merchandisingAssociationItems[0].catEntry_Identifier,false,-1);this.updateParamObject(params,"quantity",1,false,-1);}
if(!submitRequest()){return;}
cursor_wait();wc.service.invoke("AjaxAddOrderItem",params);}},AddAssociationItem2ShopCart:function(form,quantity){var identifierJSON="associatedCatEntries_"+this.associationThumbnailIndex;var associationEntryJSON=eval('('+dojo.byId(identifierJSON).innerHTML+')');this.merchandisingAssociationItems=associationEntryJSON;if(this.merchandisingAssociationItems[0].catEntry_Type=='ProductBean'){if(quantity)form.quantity_1.value=quantity;this.merchandisingProductAssociationAddToCart=true;this.merchandisingProductAssociationForm=form;showPopup(this.merchandisingAssociationItems[0].catEntry_Identifier,this.storeId,this.langId,this.catalogId,function(e){return e;},'marchandisingAssociationDisplay');}else if(this.merchandisingAssociationItems[0].catEntry_Type=='ItemBean'||this.merchandisingAssociationItems[0].catEntry_Type=='PackageBean'||this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){if(quantity)form.quantity_1.value=quantity;if(this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var bundleForm=document.getElementById(this.merchandisingAssociationItems[0].catEntry_BundleFormId);var catEntryArray=[];catEntryArray=bundleForm.catEntryIDS.value.toString().split(",");var catEntryCount=3;for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.getDefaultItem(catEntryArray[i]))
catEntryId=this.getDefaultItem(catEntryArray[i]);if(qty==0||qty==null)qty=1;if(i==0){form.catEntryId_2.value=catEntryId;form.productId_2.value=catEntryId;form.quantity_2.value=qty;}else{var input1=document.createElement("input");input1.setAttribute("id","OrderAssociationItemAddForm_catEntryId_"+catEntryId);input1.setAttribute("type","hidden");input1.setAttribute("name","catEntryId_"+catEntryCount);input1.setAttribute("value",catEntryId);form.appendChild(input1);var input2=document.createElement("input");input2.setAttribute("id","OrderAssociationItemAddForm_productId_"+catEntryId);input2.setAttribute("type","hidden");input2.setAttribute("name","productId_"+catEntryCount);input2.setAttribute("value",catEntryId);form.appendChild(input2);var quantity1=document.createElement("input");quantity1.setAttribute("id","OrderAssociationItemAddForm_quantity_"+catEntryId);quantity1.setAttribute("type","hidden");quantity1.setAttribute("name","quantity_"+catEntryCount);quantity1.setAttribute("value","1");form.appendChild(quantity1);catEntryCount=catEntryCount+1;}}}else{form.catEntryId_2.value=this.merchandisingAssociationItems[0].catEntry_Identifier;form.productId_2.value=this.merchandisingAssociationItems[0].catEntry_Identifier;form.quantity_2.value="1";}
if(!submitRequest()){return;}
form.submit();}},AddAssociationBundle2ShopCartAjax:function(form){var identifierJSON="associatedCatEntries_"+this.associationThumbnailIndex;var associationEntryJSON=eval('('+dojo.byId(identifierJSON).innerHTML+')');this.merchandisingAssociationItems=associationEntryJSON;this.baseItemAddedToCart=false;var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params.orderId=".";params.calculationUsage="-1,-2,-3,-4,-5,-6,-7";var catEntryArray=[];catEntryArray=form.catEntryIDS.value.toString().split(",");for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.getDefaultItem(catEntryArray[i]))
catEntryId=this.getDefaultItem(catEntryArray[i]);if(qty==0||qty==null)qty=1;if(qty!=null&&qty!=''&&catEntryId!=null){this.updateParamObject(params,"catEntryId",catEntryId,false,-1);this.updateParamObject(params,"quantity",qty,false,-1);this.baseItemAddedToCart="true";}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}
if(this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var bundleForm=document.getElementById(this.merchandisingAssociationItems[0].catEntry_BundleFormId);var innerCatEntryArray=[];innerCatEntryArray=bundleForm.catEntryIDS.value.toString().split(",");for(var i=0;i<innerCatEntryArray.length;i++){var qty=document.getElementById("quantity_"+innerCatEntryArray[i]).value;var innerCatEntryId=innerCatEntryArray[i];if(this.getDefaultItem(innerCatEntryArray[i]))
innerCatEntryId=this.getDefaultItem(innerCatEntryArray[i]);if(qty==0||qty==null)qty=1;if(qty!=null&&qty!=''&&innerCatEntryId!=null){this.updateParamObject(params,"catEntryId",innerCatEntryId,false,-1);this.updateParamObject(params,"quantity",qty,false,-1);}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}}else if(this.merchandisingAssociationItems[0].catEntry_Type=='PackageBean'||this.merchandisingAssociationItems[0].catEntry_Type=='ItemBean'){this.updateParamObject(params,"catEntryId",this.merchandisingAssociationItems[0].catEntry_Identifier,false,-1);this.updateParamObject(params,"quantity",1,false,-1);}
if(!submitRequest()){return;}
cursor_wait();wc.service.invoke("AjaxAddOrderItem",params);if(this.merchandisingAssociationItems[0].catEntry_Type=='ProductBean'){showPopup(this.merchandisingAssociationItems[0].catEntry_Identifier,this.storeId,this.langId,this.catalogId,function(e){return e;},'marchandisingAssociationDisplay');}},setOrderId:function(orderId)
{this.orderId=orderId;},AddAssociationBundle2ShopCart:function(form){var identifierJSON="associatedCatEntries_"+this.associationThumbnailIndex;var associationEntryJSON=eval('('+dojo.byId(identifierJSON).innerHTML+')');this.merchandisingAssociationItems=associationEntryJSON;this.isParentBundleBean=true;if(this.merchandisingAssociationItems[0].catEntry_Type=='ProductBean'){this.merchandisingProductAssociationAddToCart=true;this.merchandisingProductAssociationForm=form;var catEntryArray=[];catEntryArray=form.catEntryIDS.value.toString().split(",");var bundleItemsCount=1;for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.getDefaultItem(catEntryArray[i]))
catEntryId=this.getDefaultItem(catEntryArray[i]);if(catEntryId!=null)
form["catEntryId_"+catEntryArray[i]].value=catEntryId;else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}
bundleItemsCount=bundleItemsCount+1;}
showPopup(this.merchandisingAssociationItems[0].catEntry_Identifier,this.storeId,this.langId,this.catalogId,function(e){return e;},'marchandisingAssociationDisplay');}else if(this.merchandisingAssociationItems[0].catEntry_Type=='ItemBean'||this.merchandisingAssociationItems[0].catEntry_Type=='PackageBean'||this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var catEntryArray=[];catEntryArray=form.catEntryIDS.value.toString().split(",");var bundleItemsCount=1;for(var i=0;i<catEntryArray.length;i++){var qty=document.getElementById("quantity_"+catEntryArray[i]).value;var catEntryId=catEntryArray[i];if(this.getDefaultItem(catEntryArray[i]))
catEntryId=this.getDefaultItem(catEntryArray[i]);if(catEntryId!=null)
form["catEntryId_"+catEntryArray[i]].value=catEntryId;else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}
bundleItemsCount=bundleItemsCount+1;}
if(this.merchandisingAssociationItems[0].catEntry_Type=='BundleBean'){var bundleForm=document.getElementById(this.merchandisingAssociationItems[0].catEntry_BundleFormId);var innerCatEntryArray=[];innerCatEntryArray=bundleForm.catEntryIDS.value.toString().split(",");for(var i=0;i<innerCatEntryArray.length;i++){var qty=document.getElementById("quantity_"+innerCatEntryArray[i]).value;var innerCatEntryId=innerCatEntryArray[i];if(this.getDefaultItem(innerCatEntryArray[i])){innerCatEntryId=this.getDefaultItem(innerCatEntryArray[i]);}
if(qty==0||qty==null)qty=1;if(qty!=null&&qty!=''&&innerCatEntryId!=null){var input2=document.createElement("input");input2.setAttribute("id","OrderItemAddForm_catEntryId_"+innerCatEntryId);input2.setAttribute("type","hidden");input2.setAttribute("name","catEntryId_"+bundleItemsCount);input2.setAttribute("value",innerCatEntryId);form.appendChild(input2);var quantity2=document.createElement("input");quantity2.setAttribute("id","OrderItemAddForm_quantity_"+innerCatEntryId);quantity2.setAttribute("type","hidden");quantity2.setAttribute("name","quantity_"+bundleItemsCount);quantity2.setAttribute("value","1");form.appendChild(quantity2);bundleItemsCount=bundleItemsCount+1;}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU']);return;}}}else{var input2=document.createElement("input");input2.setAttribute("id","OrderItemAddForm_catEntryId_"+this.merchandisingAssociationItems[0].catEntry_Identifier);input2.setAttribute("type","hidden");input2.setAttribute("name","catEntryId_"+bundleItemsCount);input2.setAttribute("value",this.merchandisingAssociationItems[0].catEntry_Identifier);form.appendChild(input2);var quantity2=document.createElement("input");quantity2.setAttribute("id","OrderItemAddForm_quantity_"+this.merchandisingAssociationItems[0].catEntry_Identifier);quantity2.setAttribute("type","hidden");quantity2.setAttribute("name","quantity_"+bundleItemsCount);quantity2.setAttribute("value","1");form.appendChild(quantity2);}
form.URL.value="AjaxOrderItemDisplayView";if(!submitRequest()){return;}
form.submit();}},addToNewListFromProductDetail:function(entitledItemId,quantityElemId,currentPage){MessageHelper.hideAndClearMessage();var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();if(catalogEntryId!=null){this.addItemToNewListFromProductDetail(catalogEntryId,quantityElemId,currentPage);}
else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU_REQ_LIST']);if(dijit.byId('second_level_category_popup')!=null){hidePopup('second_level_category_popup');}
return;}},addItemToNewListFromProductDetail:function(catalogEntryId,quantityElemId,currentPage){MessageHelper.hideAndClearMessage();if(catalogEntryId!=null){var quantity=document.getElementById(quantityElemId).value;if(quantity==null||quantity==""||quantity<=0||!RequisitionList.isNumber(quantity)){MessageHelper.displayErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);if(dijit.byId('second_level_category_popup')!=null){hidePopup('second_level_category_popup');}
return;}
if(this.ajaxMyAccount){var URL="AjaxLogonForm?page=createrequisitionlist";}else{var URL="RequisitionListDetailView?editable=true&newList=true";}
var formObj=document.createElement("form");formObj.setAttribute("method","POST");var input=document.createElement("input");input.setAttribute("type","hidden");input.setAttribute("value",currentPage);input.setAttribute("name","previousPage");formObj.appendChild(input);formObj.action=URL+"&catEntryId="+catalogEntryId+"&quantity="+quantity+"&storeId="+this.storeId+"&catalogId="+this.catalogId+"&langId="+this.langId;document.body.appendChild(formObj);formObj.submit();}
else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU_REQ_LIST']);}},addBundleToNewListFromProductDetail:function(form,currentPage){var productCount=form["numberOfProduct"].value;var URL="";if(this.ajaxMyAccount){URL="AjaxLogonForm?page=createrequisitionlist";}else{URL="RequisitionListDetailView?editable=true&newList=true";}
for(var i=1;i<=productCount;i++){var catEntryId=form["catEntryId_"+i].value;if(this.selectedProducts[catEntryId]){catEntryId=this.getCatalogEntryIdforProduct(this.selectedProducts[catEntryId]);}
var qty=form["quantity_"+i].value;if(qty==null||qty==""||qty<=0||!RequisitionList.isNumber(qty)){MessageHelper.displayErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);return;}else if(catEntryId!=null){URL=URL+"&catEntryId="+catEntryId+"&quantity="+qty;}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU_REQ_LIST']);return;}}
var input=document.createElement("input");input.setAttribute("type","hidden");input.setAttribute("value",currentPage);input.setAttribute("name","previousPage");form.appendChild(input);URL=URL+"&numberOfProduct="+form.numberOfProduct.value+"&storeId="+this.storeId+"&catalogId="+this.catalogId+"&langId="+this.langId;form.action=URL;form.submit();},addToExistingRequisitionList:function(entitledItemId,quantityElemId,ajaxAddToCart){var entitledItemJSON;if(dojo.byId(entitledItemId)!=null){entitledItemJSON=eval('('+dojo.byId(entitledItemId).innerHTML+')');}else{entitledItemJSON=this.getEntitledItemJsonObject();}
this.setEntitledItems(entitledItemJSON);var catalogEntryId=this.getCatalogEntryId();if(catalogEntryId!=null){this.addItemToExistingRequisitionList(catalogEntryId,quantityElemId,ajaxAddToCart);}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU_REQ_LIST']);}},addBundleToExistingRequisitionList:function(form,ajaxAddToCart){var reqListSelection=document.getElementsByName("RequisitionListTableDisplay_RequisitionListSelection");for(var i=0;i<reqListSelection.length;i++){if(reqListSelection.item(i).checked){var requisitionListId=reqListSelection.item(i).value;}}
if(ajaxAddToCart){var params=[];params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;params["requisitionListId"]=requisitionListId;var productCount=form["numberOfProduct"].value;for(var i=1;i<=productCount;i++){var catEntryId=form["catEntryId_"+i].value;if(this.selectedProducts[catEntryId]){catEntryId=this.getCatalogEntryIdforProduct(this.selectedProducts[catEntryId]);}
var qty=form["quantity_"+i].value;if(qty==null||qty==""||qty<=0||!RequisitionList.isNumber(qty)){MessageHelper.displayeErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);return;}else if(qty!=null&&qty!=''&&catEntryId!=null){this.updateParamObject(params,"catEntryId",catEntryId,false,-1);this.updateParamObject(params,"quantity",qty,false,-1);this.baseItemAddedToCart=true;}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU_REQ_LIST']);return;}}
if(!submitRequest()){return;}
cursor_wait();wc.service.invoke("requisitionListAddItem_popup",params);}else{form.action="RequisitionListItemUpdate?requisitionListId="+requisitionListId;if(this.ajaxMyAccount){form.URL.value="AjaxLogonForm?page=editrequisitionlist&requisitionListId="+requisitionListId+"&editable=true";}else{form.URL.value="RequisitionListDetailView?requisitionListId="+requisitionListId+"&editable=true";}
if(!submitRequest()){return;}
cursor_wait();form.submit();}},addItemToExistingRequisitionList:function(catalogEntryId,quantityElemId,ajaxAddToCart){if(catalogEntryId!=null){var quantity=document.getElementById(quantityElemId).value;if(!RequisitionList.isNumber(quantity)||quantity<=0){if(quantityElemId=="productPopUpQty"){MessageHelper.displayErrorMessage(MessageHelper.messages['QUANTITY_INPUT_ERROR']);if(dijit.byId('second_level_category_popup')!=null){hidePopup('second_level_category_popup');}
return;}else{MessageHelper.formErrorHandleClient(quantityElemId,MessageHelper.messages["QUANTITY_INPUT_ERROR"]);return;}}
var reqListSelection=document.getElementsByName("RequisitionListTableDisplay_RequisitionListSelection");for(var i=0;i<reqListSelection.length;i++){if(reqListSelection.item(i).checked){var requisitionListId=reqListSelection.item(i).value;}}
if(ajaxAddToCart){var params={};params["requisitionListId"]=requisitionListId;params["catEntryId"]=catalogEntryId;params["quantity"]=quantity;params.storeId=this.storeId;params.catalogId=this.catalogId;params.langId=this.langId;if(!submitRequest()){return;}
cursor_wait();wc.service.invoke('requisitionListAddItem_popup',params);}else{var form=document.forms["RequisitionListPopupForm"];form.requisitionListId.value=requisitionListId;form.quantity.value=quantity;form.catEntryId.value=catalogEntryId;if(this.ajaxMyAccount){form.URL.value="AjaxLogonForm?page=editrequisitionlist&requisitionListId="+requisitionListId+"&editable=true";}else{form.URL.value="RequisitionListDetailView?requisitionListId="+requisitionListId+"&editable=true";}
if(!submitRequest()){return;}
cursor_wait();form.submit();}}else{MessageHelper.displayErrorMessage(MessageHelper.messages['ERR_RESOLVING_SKU_REQ_LIST']);}},setCurrentPageType:function(pageType){this.currentPageType=pageType;},setCurrentCatalogEntryId:function(catalogEntryId){this.currentCatalogEntryId=catalogEntryId;},handleCategorySubscription:function(formId,ajaxEnabled){if(ajaxEnabled==true||ajaxEnabled=="true"){var form=document.forms[formId];var params={};params["DM_ReqCmd"]=form.DM_ReqCmd.value;params["storeId"]=form.storeId.value;params["catalogId"]=form.catalogId.value;params["langId"]=form.langId.value;params["categoryId"]=form.categoryId.value;if(!submitRequest()){return;}
cursor_wait();wc.service.invoke("AjaxCategorySubscribe",params);}else{var form=document.forms[formId];form.URL.value=location.href;form.submit();}}}
categoryDisplayJS.HistoryTracker.prototype.back=categoryDisplayJS.goBack;categoryDisplayJS.HistoryTracker.prototype.forward=categoryDisplayJS.goForward;
