ProductJS={entitledItems:[],selectedProducts:new Object(),selectedAttributes:new Object(),errorMessages:new Object(),langId:"-1",storeId:"",catalogId:"",updateParamObject:function(_1,_2,_3,_4,_5){
if(_1==null){
_1=[];
}
if(_1[_2]!=null&&_4){
if(dojo.lang.isArrayLike(_1[_2])){
if(_5!=null&&_5!=""){
_1[_2][_5]=_3;
}else{
_1[_2].push(_3);
}
}else{
var _6=_1[_2];
_1[_2]=[];
_1[_2].push(_6);
_1[_2].push(_3);
}
}else{
if(_5!=null&&_5!=""&&_5!=-1){
_1[_2+"_"+_5]=_3;
}else{
if(_5==-1){
var i=1;
while(_1[_2+"_"+i]!=null){
i++;
}
_1[_2+"_"+i]=_3;
}else{
_1[_2]=_3;
}
}
}
return _1;
},setCommonParameters:function(_8,_9,_a){
this.langId=_8;
this.storeId=_9;
this.catalogId=_a;
},setEntitledItems:function(_b){
this.entitledItems=_b;
},setSelectedAttribute:function(_c,_d){
this.selectedAttributes[_c]=_d;
},setSelectedAttributeOfProduct:function(_e,_f,_10){
selectedAttributesForProduct=new Object();
if(this.selectedProducts[_e]){
selectedAttributesForProduct=this.selectedProducts[_e];
}
selectedAttributesForProduct[_f]=_10;
this.selectedProducts[_e]=selectedAttributesForProduct;
},getCatalogEntryId:function(){
var _11=[];
for(attribute in this.selectedAttributes){
_11.push(attribute+"_"+this.selectedAttributes[attribute]);
}
return this.resolveSKU(_11);
},getCatalogEntryIdforProduct:function(_12){
var _13=[];
for(attribute in _12){
_13.push(attribute+"_"+_12[attribute]);
}
return this.resolveSKU(_13);
},resolveSKU:function(_14){
var _15="";
var _16=_14.length;
for(x in this.entitledItems){
var _15=this.entitledItems[x].catentry_id;
var _17=this.entitledItems[x].Attributes;
var _18=0;
for(index in _17){
_18++;
}
if(_16>=_18){
var _19=0;
for(attributeName in _14){
var _1a=_14[attributeName];
if(_1a in _17){
_19++;
}
}
if(_18==_19){
return _15;
}
}
}
return null;
},PopUpAdd2ShopCartAjax:function(_1b){
var _1c=[];
var _1d=eval("("+dojo.byId(_1b).innerHTML+")");
this.setEntitledItems(_1d);
var _1e=this.getCatalogEntryId();
if(_1e!=null){
_1c.storeId=this.storeId;
_1c.catalogId=this.catalogId;
_1c.langId=this.langId;
_1c.orderId=".";
_1c.quantity="1";
_1c.catEntryId=_1e;
wc.service.invoke("AjaxAddOrderItem",_1c);
cursor_wait();
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},RetailPopUpAdd2ShopCartAjax:function(_1f){
var _20=[];
var _21=document.getElementById(_1f);
var _22=_21.options[_21.selectedIndex].value;
if(_22!=null){
_20.storeId=this.storeId;
_20.catalogId=this.catalogId;
_20.langId=this.langId;
_20.orderId=".";
_20.quantity="1";
_20.catEntryId=_22;
wc.service.invoke("AjaxAddOrderItem",_20);
cursor_wait();
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},RetailAddProduct2WishList:function(_23,_24){
var _25=document.getElementById(_24);
var _26=_25.options[_25.selectedIndex].value;
if(_26!=null){
window.location=_23+"&catEntryId="+_26;
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},RetailAddSKU2WishList:function(_27,_28){
window.location=_27+"&catEntryId="+_28;
},PopUpAdd2WishListAjax:function(_29){
var _2a=[];
var _2b=eval("("+dojo.byId(_29).innerHTML+")");
this.setEntitledItems(_2b);
var _2c=this.getCatalogEntryId();
if(_2c!=null){
_2a.storeId=this.storeId;
_2a.catalogId=this.catalogId;
_2a.langId=this.langId;
_2a.URL="SuccessfulAJAXRequest";
_2a.catEntryId=_2c;
wc.service.invoke("AjaxInterestItemAdd",_2a);
cursor_wait();
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},BundleAdd2ShopCartAjax:function(_2d){
var _2e=[];
var _2f=dojo.io.encodeForm(dojo.byId(_2d));
_2e.storeId=this.storeId;
_2e.catalogId=this.catalogId;
_2e.langId=this.langId;
_2e.orderId=".";
var _30=[];
_30=_2d.catEntryIDS.value.toString().split(",");
for(var i=0;i<_30.length;i++){
var qty=document.getElementById("quantity_"+_30[i]).value;
var _33=_30[i];
if(this.selectedProducts[_30[i]]){
_33=this.getCatalogEntryIdforProduct(this.selectedProducts[_30[i]]);
}
if(Common.IsNumeric(qty,false)&&qty!=null&&qty!=""&&_33!=null){
if(qty!=0){
this.updateParamObject(_2e,"catEntryId",_33,false,-1);
this.updateParamObject(_2e,"quantity",qty,false,-1);
}
}else{
alertDialog(this.getErrorMessage("ERR_RESOLVING_SKU"),this.storeId,this.catalogId,this.langId);
return;
}
}
wc.service.invoke("AjaxAddOrderItem",_2e);
cursor_wait();
},BundleAdd2WishListAjax:function(_34){
var _35=[];
var _36=dojo.io.encodeForm(dojo.byId(_34));
_35.storeId=this.storeId;
_35.catalogId=this.catalogId;
_35.langId=this.langId;
_35.URL="SuccessfulAJAXRequest";
var _37=[];
_37=_34.catEntryIDS.value.toString().split(",");
for(var i=0;i<_37.length;i++){
var qty=document.getElementById("quantity_"+_37[i]).value;
var _3a=_37[i];
if(this.selectedProducts[_37[i]]){
_3a=this.getCatalogEntryIdforProduct(this.selectedProducts[_37[i]]);
}
if(Common.IsNumeric(qty,false)&&qty!=null&&qty!=""&&_3a!=null){
if(qty!=0){
this.updateParamObject(_35,"catEntryId",_3a,false,-1);
this.updateParamObject(_35,"quantity",qty,false,-1);
}
}else{
alertDialog(this.getErrorMessage("ERR_RESOLVING_SKU"),this.storeId,this.catalogId,this.langId);
return;
}
}
wc.service.invoke("AjaxInterestItemAdd",_35);
cursor_wait();
},ProductPageAdd2ShopCartAjax:function(_3b,_3c,_3d){
var _3e=[];
var _3f=dojo.io.encodeForm(dojo.byId(_3b));
var _40="";
if(_3d){
_40=this.getCatalogEntryId();
}else{
_40=_3c;
}
_3e=queryToParamObject(_3f,_3e,false);
if(_40!=null){
_3e.storeId=this.storeId;
_3e.catalogId=this.catalogId;
_3e.langId=this.langId;
_3e.orderId=".";
_3e.catEntryId=_40;
wc.service.invoke("AjaxAddOrderItem",_3e);
cursor_wait();
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},ProductPageAdd2WishListAjax:function(_41,_42,_43){
var _44=[];
var _45=dojo.io.encodeForm(dojo.byId(_41));
var _46="";
if(_43){
_46=this.getCatalogEntryId();
}else{
_46=_42;
}
_44=queryToParamObject(_45,_44,false);
if(_46!=null){
_44.storeId=this.storeId;
_44.catalogId=this.catalogId;
_44.langId=this.langId;
_44.URL="SuccessfulAJAXRequest";
_44.catEntryId=_46;
wc.service.invoke("AjaxInterestItemAdd",_44);
cursor_wait();
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},Add2NewsLetterAjax:function(_47){
},Add2RSSFeedsAjax:function(_48){
},setErrorMessage:function(key,_4a){
this.errorMessages[key]=_4a;
},getErrorMessage:function(key){
var _4c=this.errorMessages[key];
if(_4c==null){
_4c="Could not get the message value for specified key "+key;
}
return _4c;
}};

