// JavaScript Document

/* PRICES */		
var Price = {
	start: function(){
		if ($('prices')) Price.parsePrice();
	},
	
	parsePrice: function(){
		var boxes = $$('#prices .priceItem .priceTitle');
		var content = $$('#prices .priceItem .priceContent');
		var open = false;
		var fx = new Fx.Elements(content, {wait: false, duration:350, transition: Fx.Transitions.Quart.easeOut});
		
		boxes.each(function(box, i){
			box.open = false;
			box.addEvent('click', function(){
				var obj = {};
				if(!this.open){
					obj[i] = {'height': [content[i].getStyle('height').toInt(), content[i].scrollHeight]};
					//alert(content[i].scrollHeight);
					//box.style.backgroundImage = 'url(/assets/templates/dgp/img/close.gif)';
					this.open = true;
				}
				else{
					obj[i] = {'height': [content[i].getStyle('height').toInt(), 0]};
					//box.style.backgroundImage = 'url(/assets/templates/dgp/img/open.gif)';
					this.open = false;
				}
				boxes.each(function(other, j){
					if (other != box){
						var w = content[j].getStyle('height').toInt();
						if (w != 0){
							obj[j] = {'height': [w, 0]};
							//boxes[j].style.backgroundImage = 'url(/assets/templates/dgp/img/open.gif)';
							boxes[j].open = false;
						}
					}
				});
				fx.start(obj);
			});
		});
	}
}