
function Staffel() {
	this._prices = new Array();
}

Staffel.prototype.parse = function(data) {
	this._prices = new Array();

	var parts = data.split(",");
	for (var i in parts) {
		var values = parts[i].split("=>");
		if (values.length != 2) {
			return false;
		}
		this._prices.push( [parseInt(values[0]), parseFloat(values[1])] );
	}
}

Staffel.prototype.count = function() {
	return this._prices.length;
}

Staffel.prototype.getPricePerPiece = function(quantity) {
	for (var i in this._prices) {
		if (quantity >= this._prices[i][0]) {
			return this._prices[i][1];
		}
	}
	return false;
}

Staffel.prototype.getPrice = function(quantity) {
	return quantity * this.getPricePerPiece(quantity);
}

Staffel.prototype.getLowestQuantity = function() {
	if (this._prices.length == 0) {
		return 0;
	}
	return this._prices[this._prices.length-1][0];
}

Staffel.prototype.getItemAt = function(i) {
	return this._prices[i];
}

function showRelated( id, title, text )
{
	document.getElementById('bigimage').src='/image/' + id + '-t-350-12.jpg';
	return overlib(text , CAPTION, title, CAPCOLOR, '#FFFFFF', BGCOLOR, '#006600', BORDER, 5, CELLPAD, 10, 5);
}

function hideRelated( id )
{
	document.getElementById('bigimage').src='/image/' + id + '-t-350-12.jpg';
	nd();
}

