var priceCalGepaeck = function() {

	this.objectID = 0;
	this.priceObject = {};
	this.allStationCount = 0;
	this.stations = [];
	this.allPriceStation = 115;
	this.additionalPriceStation = {};
	this.additional = 19;
	this.idPersonen = '';

	this.price = 0.0;

	this.calPrice = function() {

		if (this.stations.length == this.allStationCount) {
			this.price = this.allPriceStation;

			var personen = this.getPersonen();
			if (personen > 6) {
				personen = personen - 6;
				this.price = this.price+(this.additional*personen);
			}
		} else {
			this.price = 0;
			for(i=0; i<this.stations.length; i++) {
				this.price = this.price+this.priceObject[this.stations[i]];
			}

			var personen = this.getPersonen();
			if (personen > 6) {
				var addPrice = 0;
				for(i=0; i<this.stations.length; i++) {
					var stationPrice = 0
					if (parseFloat(this.additionalPriceStation[this.stations[i]])) {
						stationPrice = parseFloat(this.additionalPriceStation[this.stations[i]]);
					}
					addPrice = addPrice+stationPrice;
				}
				this.price = this.price+(addPrice*personen);
			}
		}



		this.drawPrice();
	};

	this.getPersonen = function() {
		if ($(this.idPersonen)) {
			return $(this.idPersonen).value*1;
		} else {
			return 1;
		}
	}

	this.drawPrice = function() {
		var priceObjects = $('product_addtocart_form').getElementsByClassName('price');

		for (i=0; i<priceObjects.length; i++) {

			var returnPrice = (Math.round((this.price*1)*100)/100);
			returnPrice = returnPrice+'';
			returnPrice = returnPrice.replace(/\./g, ',');

			if (returnPrice.indexOf(',') == -1) {
				returnPrice = returnPrice+',00';
			} else {
				var laenge = returnPrice.length - returnPrice.indexOf(',')
				if (laenge == 2) {
					returnPrice = returnPrice+'0';
				}
			}

			priceObjects[i].innerHTML = returnPrice+' €';
		}
	};


}




