var BodySizeComponent;
(function(A){BodySelectionComponent=A.inherit(AbstractComponent,{PROVIDER_URL:"bodySelection",INSERT_CACHE:true,init:function(){this._requestProvider(false,true,null);
},_updateJSON:function(B){this._updateSelectionJSON(B);
}});
})(jQuery);

var BodySizeComponent;
(function(A){BodySizeComponent=A.inherit(AbstractComponent,{PROVIDER_URL:"allDimensionSelection",INSERT_CACHE:true,SORT_ASC:"asc",SORT_DESC:"desc",SORT_DEFAULT:"asc",SORT_TABLE_CLASS:"mds-vc-sort-table",SORT_LINK_CLASS:"mds-vc-sort-lnk",SORT_ATTR_NAME:"abbr",BODYSTYLE_ID_PREFIX:"mds-vc-bodystyle-",BODYSTYLE_CNT_CLASS:"mds-vc-bodystyle-cnt",_tableSort:{"row":null,"order":null},init:function(){this._requestProvider(false,true,null);
},insert:function(B){this.__base(B=false);
},sortTable:function(E){var I=A(this._getEventTarget(E));
var F=I.parents("."+this.BODYSTYLE_CNT_CLASS+":eq(0)");
var D=A("."+this.SORT_TABLE_CLASS,F);
var H=null;
var C=this;
A.each(A("."+C.SORT_LINK_CLASS,D),function(J){if(!A(this).not(I).length){H=J;
return false;
}});
var B=this.SORT_DEFAULT;
if(this._tableSort.order!=null&&H==this._tableSort.row&&H!=null){if(this._tableSort.order==this.SORT_DESC){B=this.SORT_ASC;
}if(this._tableSort.order==this.SORT_ASC){B=this.SORT_DESC;
}}var G=false;
G=this._sortTables(H,B);
if(G==true){this._tableSort.order=B;
this._tableSort.row=H;
}},onOptionChange:function(B){this.__base(B);
this.information(B);
},_updateJSON:function(B){this._updateSelectionJSON(B);
this._afterUpdate(B,false);
},_afterUpdate:function(E,C){this.__base(E,C);
if(C==true){this._initTableSort();
}else{if(this._dataObject.payload){var B=this;
var D=null;
var F=null;
A.each(this._dataObject.payload.featureSelectionSet.featureSelection,function(){if(this["selection-state"]==B.SELECTED_STATE||this["selection-state"]==B.DEFAULT_STATE){D=this["selection-control-id"];
if(this.subFeatureSelection!=null&&this.subFeatureSelection!=undefined){A.each(this.subFeatureSelection,function(){if(this["selection-state"]==B.SELECTED_STATE||this["selection-state"]==B.DEFAULT_STATE){F=this["selection-control-id"];
return false;
}});
}return false;
}});
this._applySelection(F);
this._initBodystyle(D,F);
}}},_applySelection:function(C){if(C!=null&&C!=undefined&&C!=""){var B=A("#"+C);
if(B.length==1){B.prop("checked",true);
this.onOptionChange(B);
}}},_initBodystyle:function(B,C){if(B!=null&&B!=undefined&&B!=""){A("#"+this.BODYSTYLE_ID_PREFIX+B).removeClass(this.HIDE_CSS_CLASS).siblings("."+this.BODYSTYLE_CNT_CLASS).addClass(this.HIDE_CSS_CLASS);
}if(C!=null&&C!=undefined&&C!=""){A("#"+this.INFO_CNT_ID_PREFIX+C).removeClass(this.HIDE_CSS_CLASS).siblings("."+this.INFO_CNT_CLASS).addClass(this.HIDE_CSS_CLASS);
}},_addLocalEvents:function(){var C=A("#"+this._domId);
var B=this;
this.__base();
A("."+this.SORT_LINK_CLASS,A("."+this.SORT_TABLE_CLASS,C)).unbind("click").click(function(){return false;
}).click(function(D){B.sortTable(D);
});
},_initTableSort:function(){if(this._tableSort.row!=null&&this._tableSort.row!=undefined&&this._tableSort.row!="undefined"){this._sortTables(this._tableSort.row,this._tableSort.order);
}},_sortTables:function(H,B){if(H!=null&&H!=undefined&&B!=null&&B!=undefined){var C=this;
var G=A("."+this.SORT_TABLE_CLASS,A("#"+this._domId));
var F,D,E;
A.each(G,function(){E=new Array();
A.each(A("tbody > tr",this),function(){D=A(this);
A.each(A("td["+C.SORT_ATTR_NAME+"]:eq("+H+")",this),function(){F=new Array();
F["row"]=D;
F["value"]=A(this).attr(C.SORT_ATTR_NAME);
E.push(F);
});
});
E.sort(C._sortAttr);
if(B==C.SORT_DESC){E.reverse();
}var I=A("tbody",this);
A.each(E,function(J){I.append(A(E[J]["row"]));
});
});
return true;
}else{return false;
}},_sortAttr:function(D,C){var B=0;
D=D["value"];
C=C["value"];
if((typeof (D)=="number")&&(typeof (C)=="number")){B=D-C;
}else{if((typeof (D)=="string")&&(typeof (C)=="string")){if(D<C){B=-1;
}else{if(D>C){B=1;
}else{B=0;
}}}else{if(typeof (D)=="string"){B=1;
}else{B=-1;
}}}return B;
}});
})(jQuery);

var CompareBodystyleComponent;
(function(A){CompareBodystyleComponent=A.inherit(AbstractCompareComponent,{PROVIDER_URL:"bodyCompare"});
})(jQuery);

mrm.conf.app.vc={"components":{"image":{"domId":"mds-vc-cmp-img"},"totalprice":{"domId":"mds-vc-cmp-totalprice"},"detailprice":{"domId":"mds-vc-cmp-detailprice"},"compare-trim":{"domId":"mds-vc-cmp-compare"},"compare-bodystyle":{"domId":"mds-vc-cmp-compare"},"compare-capabilities":{"domId":"mds-vc-cmp-compare"},"legal":{"domId":"mds-vc-cmp-legal"},"legalpf":{"domId":"mds-vc-cmp-legal-pf"},"managedcontent":{"domId":"mds-vc-cmp-followup"},"compare-engine":{"domId":"mds-vc-cmp-compare"},"bodyselection":{"domId":"mds-vc-cmp-bodyselection"},"bodysize":{"domId":"mds-vc-cmp-bodysize"},"capabilities":{"domId":"mds-vc-cmp-capabilities"},"dimensions":{"domId":"mds-vc-cmp-dimension_information"},"trim":{"domId":"mds-vc-cmp-trim"},"engine":{"domId":"mds-vc-cmp-engine"},"colour":{"domId":"mds-vc-cmp-colour"},"options":{"domId":"mds-vc-cmp-options"},"accessories":{"domId":"mds-vc-cmp-accessories"},"summary":{"domId":"mds-vc-cmp-sumdetail"},"payment-estimator":{"domId":"mds-vc-cmp-payment_estimator"},"lnv":{"domId":"mds-vc-cmp-lnv"},"tracking":{"domId":"mds-vc-cmp-omniture"}},"view":{"compare-bodystyles":{"viewId":"compare-bodystyles","active":false,"orderNo":1,"button":{"domId":null},"component":{"image":{"onViewChange":false,"onInit":true,"priority":1},"totalprice":{"onViewChange":false,"onInit":true,"priority":1},"detailprice":{"onViewChange":false,"onInit":true,"priority":0},"compare-bodystyle":{"onViewChange":false,"onInit":false,"priority":0},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"legalpf":{"onViewChange":false,"onInit":false,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}},"compare-trims":{"viewId":"compare-trims","active":false,"orderNo":2,"button":{"domId":null},"component":{"image":{"onViewChange":false,"onInit":true,"priority":1},"totalprice":{"onViewChange":false,"onInit":true,"priority":1},"detailprice":{"onViewChange":false,"onInit":true,"priority":0},"compare-trim":{"onViewChange":false,"onInit":false,"priority":0},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"legalpf":{"onViewChange":false,"onInit":false,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}},"compare-engines":{"viewId":"compare-engines","active":false,"orderNo":3,"button":{"domId":null},"component":{"image":{"onViewChange":false,"onInit":true,"priority":1},"totalprice":{"onViewChange":false,"onInit":true,"priority":1},"detailprice":{"onViewChange":false,"onInit":true,"priority":0},"compare-engine":{"onViewChange":false,"onInit":false,"priority":0},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"legalpf":{"onViewChange":false,"onInit":false,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}},"bodystyle":{"viewId":"bodystyle","active":false,"orderNo":4,"button":{"domId":"mds-vc-btn-bodystyle"},"component":{"image":{"onViewChange":false,"onInit":true,"priority":5},"totalprice":{"onViewChange":false,"onInit":true,"priority":5},"detailprice":{"onViewChange":true,"onInit":true,"priority":5},"bodyselection":{"onViewChange":false,"onInit":true,"priority":5},"bodysize":{"onViewChange":false,"onInit":true,"priority":5},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}},"trim":{"viewId":"trim","active":false,"orderNo":5,"button":{"domId":"mds-vc-btn-trim"},"component":{"image":{"onViewChange":false,"onInit":true,"priority":5},"totalprice":{"onViewChange":false,"onInit":true,"priority":5},"detailprice":{"onViewChange":true,"onInit":true,"priority":5},"trim":{"onViewChange":false,"onInit":true,"priority":5},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}},"engine":{"viewId":"engine","active":false,"orderNo":6,"button":{"domId":"mds-vc-btn-engine"},"component":{"image":{"onViewChange":false,"onInit":true,"priority":5},"totalprice":{"onViewChange":false,"onInit":true,"priority":5},"detailprice":{"onViewChange":true,"onInit":true,"priority":5},"engine":{"onViewChange":false,"onInit":false,"priority":5},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}},"colour":{"viewId":"colour","active":false,"orderNo":7,"button":{"domId":"mds-vc-btn-colour"},"component":{"image":{"onViewChange":false,"onInit":true,"priority":5},"totalprice":{"onViewChange":false,"onInit":true,"priority":5},"detailprice":{"onViewChange":true,"onInit":true,"priority":5},"colour":{"onViewChange":false,"onInit":false,"priority":4},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}},"options":{"viewId":"options","active":false,"orderNo":8,"button":{"domId":"mds-vc-btn-options"},"component":{"image":{"onViewChange":false,"onInit":true,"priority":5},"totalprice":{"onViewChange":false,"onInit":true,"priority":5},"detailprice":{"onViewChange":false,"onInit":true,"priority":5},"options":{"onViewChange":false,"onInit":false,"priority":6},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}},"summary":{"viewId":"summary","active":false,"orderNo":9,"button":{"domId":"mds-vc-btn-summary"},"component":{"image":{"onViewChange":false,"onInit":true,"priority":0},"totalprice":{"onViewChange":false,"onInit":true,"priority":5},"detailprice":{"onViewChange":false,"onInit":true,"priority":5},"summary":{"onViewChange":false,"onInit":false,"priority":5},"payment-estimator":{"onViewChange":false,"onInit":true,"priority":0},"legal":{"onViewChange":false,"onInit":true,"priority":0},"managedcontent":{"onViewChange":true,"onInit":true,"priority":0},"tracking":{"onViewChange":true,"onInit":true,"priority":0}}}},"log":{"console":true,"service":true}};

mrm.$(document).ready(function(){mds_vc_ViewController=new mrm.app.mds.vc.ViewController();
mds_vc_ViewController.registerComponent("image",new ImageComponent());
mds_vc_ViewController.registerComponent("bodysize",new BodySizeComponent());
mds_vc_ViewController.registerComponent("bodyselection",new BodySelectionComponent());
mds_vc_ViewController.registerComponent("trim",new TrimsSeriesComponent());
mds_vc_ViewController.registerComponent("options",new OptionsComponent());
mds_vc_ViewController.registerComponent("totalprice",new TotalPriceComponent());
mds_vc_ViewController.registerComponent("detailprice",new DetailPriceComponent());
mds_vc_ViewController.registerComponent("colour",new ColourFabricComponent());
mds_vc_ViewController.registerComponent("engine",new EngineTransmissionComponent());
mds_vc_ViewController.registerComponent("summary",new SummaryComponent());
mds_vc_ViewController.registerComponent("managedcontent",new ManagedContentComponent());
mds_vc_ViewController.registerComponent("legal",new LegalInformationComponent());
mds_vc_ViewController.registerComponent("legalpf",new CompareLegalComponent());
mds_vc_ViewController.registerComponent("compare-trim",new CompareTrimComponent());
mds_vc_ViewController.registerComponent("compare-bodystyle",new CompareBodystyleComponent());
mds_vc_ViewController.registerComponent("compare-engine",new CompareEngineComponent());
mds_vc_ViewController.registerComponent("tracking",new TrackingComponent());
mds_vc_ViewController.registerComponent("payment-estimator",new PaymentEstimatorComponent());
mds_vc_ErrorController.init();
mds_vc_ViewController.init();
});


