document.observe("dom:loaded", function() {

	$('nav').observe('click', function(event) {
		// Store element if the clicks on nav-button (a-tag)
		var element = (event.element().tagName.toUpperCase() === 'A') ? event.element() : false;
				
		if (element && !element.up('li').hasClassName('nth-child1')) {
			// Stop default action
			Event.stop(event);
			
			// Store href
			var href = element.href;
			
			// Start animation
			$('header').morph('height:147px', {
				duration: 1,
				transition: 'easeFromTo',
			});
			$('nav').morph('top:158px', {
				duration: 1,
				transition: 'easeFromTo'
			});
			$('quick-search').morph('top:200px', {
				duration: 1,
				transition: 'easeFromTo',
				after: function(){ document.location=element.href }
			});
		}
	});
});
