 var Kwix = {

	start: function(){
		Kwix.parseKwicks();
	},

	parseKwicks: function(){

		var squeeze_to = 231;
		var max_width = 450;

		//get original widths
		var start_widths = new Array();
		var kwicks = $$('#kwick .kwick');
		var fx = new Fx.Elements(kwicks, {wait: false, duration: 250, transition:Fx.Transitions.Cubic.easeOut});
		kwicks.each(function(kwick, i){

			start_widths[i] = kwick.getStyle('width').toInt();

			//mouse is in, squeeze and expand
			kwick.addEvent('mouseenter', function(e){

				var obj = {};
				obj[i] = {
					'width': [kwick.getStyle('width').toInt(), max_width]
				};

				var counter = 0;

				kwicks.each(function(other, j){
					if (other != kwick){
						var w = other.getStyle('width').toInt();
						if (w != squeeze_to) obj[j] = {'width': [w,squeeze_to] };
					}
				});
				fx.start(obj);
			}
			);
		});

		//mouse is out, squeeze back
		$('kwick').addEvent('mouseleave', function(e){
			var obj = {};
			kwicks.each(function(other, j){
				obj[j] = {'width': [other.getStyle('width').toInt(), start_widths[j]]};
			});
			fx.start(obj);
		});
	}
};

//lock and load!
//window.addEvent('domready',Kwix.start);

window.addEvent('domready', function(){
									 //
			$('accomodationMenu').set({
				'opacity': 0
			});
			$('climateMenu').set({
				'opacity': 0
			});
			$('activitiesMenu').set({
				'opacity': 0
			});
	//First Example
	var el = $('climateMenu'),
		color = el.getStyle('backgroundColor');
	
	// We are setting the opacity of the element to 0.5 and adding two events
/*	$('welcome').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 1
			});
			$('accomodationMenu').morph({
				'opacity': 0
			});
			$('activitiesMenu').morph({
				'opacity': 0
			});
		},
	});*/
	$('accomodation').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 0
			});
			$('accomodationMenu').morph({
				'opacity': 1
			});
			$('activitiesMenu').morph({
				'opacity': 0
			});
		},
	});
	$('activities').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 0
			});
			$('accomodationMenu').morph({
				'opacity': 0
			});
			$('activitiesMenu').morph({
				'opacity': 1
			});
		},
	});
	$('weddings').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 0
			});
			$('accomodationMenu').morph({
				'opacity': 0
			});
			$('activitiesMenu').morph({
				'opacity': 0
			});
		},
	});
	$('spa').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 0
			});
			$('accomodationMenu').morph({
				'opacity': 0
			});
			$('activitiesMenu').morph({
				'opacity': 0
			});
		},
	});
	$('contact').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 0
			});
			$('accomodationMenu').morph({
				'opacity': 0
			});
			$('activitiesMenu').morph({
				'opacity': 0
			});
		},
	});
	$('conference').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 0
			});
			$('accomodationMenu').morph({
				'opacity': 0
			});
			$('activitiesMenu').morph({
				'opacity': 0
			});
		},
	});
	$('cusine').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 0
			});
			$('accomodationMenu').morph({
				'opacity': 0
			});
			$('activitiesMenu').morph({
				'opacity': 0
			});
		},
	});
	$('park').addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			$('climateMenu').morph({
				'opacity': 0
			});
			$('accomodationMenu').morph({
				'opacity': 0
			});
			$('activitiesMenu').morph({
				'opacity': 0
			});
		},
	});
	Kwix.start();
});

