var Price = {
	model: null,
	color: null,
	uphols: null,
	rims: null,
	options: null,
	local_accessories: null,
	defaultCurrency: 'EUR',
	local_delivery: null,
	other: null,
	rate: 1,

	getPrice: function(v, noFormat) {
		if (isset(noFormat)) return Math.round(parseFloat(v) * this.rate);
		return Math.round(parseFloat(v) * this.rate).format(0);
	},

	getLocalExpenses: function() {
		return this.getPrice(this.local_delivery + this.other);
	},

	getTotalPrice: function(noFormat) {		
		//if (this.model === null)
		this.model = this.getModelPrice();

		
		
		if (isset(noFormat)) return this.getPrice(this.model + this.color + this.uphols + this.rims + this.options + this.local_accessories, true);
		return this.getPrice(this.model + this.color + this.uphols + this.rims + this.options + this.local_accessories);
	},

	getModelPrice: function(format) {	
		//alert(Car.engineID+':'+Car.gearboxID+':'+Car.svID);
		if (isset(format)) return this.getPrice(Configurator.matrix.data.depend[Car.engineID][Car.gearboxID][Car.svID].price);
		return Configurator.matrix.data.depend[Car.engineID][Car.gearboxID][Car.svID].price;
	},

	getLocalAccessoriesPrice: function() {
		this.local_accessories = 0;
		var so = Configurator.accessories.data.local_accessories.length;
		for (var i = 0; i < so; i++) {
			if (in_array(Configurator.accessories.data.local_accessories[i]['id'], Configurator.accessories.local_accessories)) 
				this.local_accessories += parseFloat(Configurator.accessories.data.local_accessories[i]['retail_price']);
		}
	}
};


