var DataProvider={getCalculations:function(){var a=window.localStorage.getItem("Calculations");return DataSerializer.deserializeCalculations(a)},getCalculation:function(a){for(var c=DataProvider.getCalculations(),b=0;b<c.length;b++)if(c[b].id()==a)return c[b]},removeCalculation:function(a){Log("remove function");var c=DataProvider.getCalculations(),b=-1;Log(c);for(var d=0;d<c.length;d++)if(c[d].id()==a){b=d;Log("found");break}-1!=b&&(c.splice(b,1),Log("removed"),a=DataSerializer.serializeCalculations(c),
window.localStorage.setItem("Calculations",a),Log("saved"))},saveCalculation:function(a){var c=DataProvider.getCalculations();if(0<a.id()){Log("Saving existing calculation...");for(var b=0;b<c.length;b++)if(c[b].id()==a.id()){c[b]=a;Log("Index: "+b);break}}else{Log("Creating new calculations...");for(var d=0,b=0;b<c.length;b++)c[b].id()>d&&(d=c[b].id());a.id(d+1);c.push(a)}a=DataSerializer.serializeCalculations(c);window.localStorage.setItem("Calculations",a)},getSettings:function(){Log("Retrieving settings");
var a=window.localStorage.getItem("Settings");return DataSerializer.deserializeSettings(a)},saveSettings:function(a){Log("Saving settings...");a=DataSerializer.serializeSettings(a);window.localStorage.setItem("Settings",a)},getCars:function(){Log("Retrieving cars");var a=window.localStorage.getItem("Cars");return DataSerializer.deserializeCars(a)},saveCars:function(a){Log("Saving cars...");a=DataSerializer.serializeCars(a);window.localStorage.setItem("Cars",a)},getResidualValueCharts:function(){Log("Retrieving Residual Value Charts");
var a=window.localStorage.getItem("ResidualValueCharts");return DataSerializer.deserializeResidualValueCharts(a)},saveResidualValueCharts:function(a){Log("Saving Residual Value Charts...");a=DataSerializer.serializeResidualValueCharts(a);window.localStorage.setItem("ResidualValueCharts",a)}};
