var mhl = {
	Start: function() {
		new SmoothScroll();
		if ($('contactForm')) {
			mhl.CreateAjaxForm();
			new FormValidator($('contactForm'));
			//new FormValidator($('contactForm'), { onFormValidate: function() { mhl.CreateAjaxForm(); } }); 
		} // depends on form.validator.js
		//if ($('pg_mhl')) { mhl.StartAboutmhl(); }
	},
	
	FadeOut: function(el) {
		var fx = new Fx.Style(el, 'background-color', {
														duration: 800,
														transition: Fx.Transitions.Quad.easeOut
													}).start( '#DB6060', '#F4F2EA' );
	},
	
	CreateAjaxForm: function() {
		$('contactForm').addEvent('submit', function(e) {
			// prevent default event - submit
			new Event(e).stop();
			
			var status = $('msg_status').empty().addClass('ajax_loading');
			
		    this.send({
			    update: status,
			    onComplete: function() {
				    status.removeClass('ajax_loading');
				    mhl.FadeOut(status);
			    },
			    onRequest: function() {
			    },
			    onFailure: function() {
			    }
		    });
		    
		});
	},
	
	StartAboutmhl: function() {

		$('content').setStyles({
			'height' : '440px',
			'overflow' : 'hidden'
		});

		var scroll = new Fx.Scroll('content', {
			wait: false,
			duration: 500,
			transition: Fx.Transitions.Quad.easeInOut
		});
		 
		$('mhl_history').addEvent('click', function(event) {
			event = new Event(event).stop();
			height = '440px';
			scroll.toElement('history').chain( function() { mhl.SetHeight(height) } );
		});
		
		$('mhl_rules').addEvent('click', function(event) {
			event = new Event(event).stop();
			height = '1300px';
			scroll.toElement('rules').chain( function() { mhl.SetHeight(height) } );
		});
		
		$('mhl_evaluation').addEvent('click', function(event) {
			event = new Event(event).stop();
			height = '910px';
			scroll.toElement('evaluation').chain( function() { mhl.SetHeight(height) } );;
		});
	},
	
	SetHeight: function( h ) {
		el = $('content');
		
		var fx = new Fx.Styles( el, {duration:200, wait:false});
		
		fx.start({
			'height': h
		});
	}
}

window.addEvent('domready', mhl.Start );