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"));
}
},PopUpAdd2WishListAjax:function(_1f){
var _20=[];
var _21=eval("("+dojo.byId(_1f).innerHTML+")");
this.setEntitledItems(_21);
var _22=this.getCatalogEntryId();
if(_22!=null){
_20.storeId=this.storeId;
_20.catalogId=this.catalogId;
_20.langId=this.langId;
_20.URL="SuccessfulAJAXRequest";
_20.catEntryId=_22;
wc.service.invoke("AjaxInterestItemAdd",_20);
cursor_wait();
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},BundleAdd2ShopCartAjax:function(_23){
var _24=[];
var _25=dojo.io.encodeForm(dojo.byId(_23));
_24.storeId=this.storeId;
_24.catalogId=this.catalogId;
_24.langId=this.langId;
_24.orderId=".";
var _26=[];
_26=_23.catEntryIDS.value.toString().split(",");
for(var i=0;i<_26.length;i++){
var qty=document.getElementById("quantity_"+_26[i]).value;
var _29=_26[i];
if(this.selectedProducts[_26[i]]){
_29=this.getCatalogEntryIdforProduct(this.selectedProducts[_26[i]]);
}
if(Common.IsNumeric(qty,false)&&qty!=null&&qty!=""&&_29!=null){
if(qty!=0){
this.updateParamObject(_24,"catEntryId",_29,false,-1);
this.updateParamObject(_24,"quantity",qty,false,-1);
}
}else{
alertDialog(this.getErrorMessage("ERR_RESOLVING_SKU"),this.storeId,this.catalogId,this.langId);
return;
}
}
wc.service.invoke("AjaxAddOrderItem",_24);
cursor_wait();
},BundleAdd2WishListAjax:function(_2a){
var _2b=[];
var _2c=dojo.io.encodeForm(dojo.byId(_2a));
_2b.storeId=this.storeId;
_2b.catalogId=this.catalogId;
_2b.langId=this.langId;
_2b.URL="SuccessfulAJAXRequest";
var _2d=[];
_2d=_2a.catEntryIDS.value.toString().split(",");
for(var i=0;i<_2d.length;i++){
var qty=document.getElementById("quantity_"+_2d[i]).value;
var _30=_2d[i];
if(this.selectedProducts[_2d[i]]){
_30=this.getCatalogEntryIdforProduct(this.selectedProducts[_2d[i]]);
}
if(Common.IsNumeric(qty,false)&&qty!=null&&qty!=""&&_30!=null){
if(qty!=0){
this.updateParamObject(_2b,"catEntryId",_30,false,-1);
this.updateParamObject(_2b,"quantity",qty,false,-1);
}
}else{
alertDialog(this.getErrorMessage("ERR_RESOLVING_SKU"),this.storeId,this.catalogId,this.langId);
return;
}
}
wc.service.invoke("AjaxInterestItemAdd",_2b);
cursor_wait();
},ProductPageAdd2ShopCartAjax:function(_31,_32,_33){
var _34=[];
var _35=dojo.io.encodeForm(dojo.byId(_31));
var _36="";
if(_33){
_36=this.getCatalogEntryId();
}else{
_36=_32;
}
_34=queryToParamObject(_35,_34,false);
if(_36!=null){
_34.storeId=this.storeId;
_34.catalogId=this.catalogId;
_34.langId=this.langId;
_34.orderId=".";
_34.catEntryId=_36;
wc.service.invoke("AjaxAddOrderItem",_34);
cursor_wait();
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},ProductPageAdd2WishListAjax:function(_37,_38,_39){
var _3a=[];
var _3b=dojo.io.encodeForm(dojo.byId(_37));
var _3c="";
if(_39){
_3c=this.getCatalogEntryId();
}else{
_3c=_38;
}
_3a=queryToParamObject(_3b,_3a,false);
if(_3c!=null){
_3a.storeId=this.storeId;
_3a.catalogId=this.catalogId;
_3a.langId=this.langId;
_3a.URL="SuccessfulAJAXRequest";
_3a.catEntryId=_3c;
wc.service.invoke("AjaxInterestItemAdd",_3a);
cursor_wait();
}else{
alert(this.getErrorMessage("ERR_RESOLVING_SKU"));
}
},Add2NewsLetterAjax:function(_3d){
},Add2RSSFeedsAjax:function(_3e){
},setErrorMessage:function(key,_40){
this.errorMessages[key]=_40;
},getErrorMessage:function(key){
var _42=this.errorMessages[key];
if(_42==null){
_42="Could not get the message value for specified key "+key;
}
return _42;
}};

