	var infoBox;
	
	window.addEvent('domready', function() {
		// Only activate on contact page
		if ($('contact-section')){
   			initInfoBox();
			initContactFormCheck();
		}
	});

	function initInfoBox(){
		$('infoBox').erase('class');
		$('infoBox').set('text','');
		infoBox = new Fx.Slide('infoBox');
		infoBox.hide();
	}

	function initContactFormCheck(){
		$('ajaxLoader').setStyle('display', 'none');
		new FormCheck('frmContact', {
			submitByAjax: true,
			onAjaxRequest: function(){
				$('ajaxLoader').setStyle('display', 'inline');
			},
		    onAjaxSuccess: function(response){
				$('ajaxLoader').setStyle('display', 'none');
				if (response.test("SEND")) {
					clearContactFields();
					var infoMsg = "You're request has been send successfully.";
					$('infoBox').set('text', infoMsg);
					$('infoBox').addClass('blue');
				} else {
					var infoMsg = "You're request could not be send.  Please try again later.  We're sorry for this inconvenience.";
					$('infoBox').set('text', infoMsg);
					$('infoBox').addClass('red');
				}
				infoBox.slideIn();
			},
			onAjaxFailure: function(response){
				$('ajaxLoader').setStyle('display', 'none');
				var infoMsg = "You're request could not be processed.  We're sorry for this inconvenience.";
				$('infoBox').set('text', infoMsg);
				$('infoBox').addClass('red');
                infoBox.slideIn();
			},
			display: {
				showErrors: 1,
				closeTipsButton: 1,
				checkValueIfEmpty: 0,
				scrollToFirst: true
			}
		});
	}
	
	function clearContactFields(){
		$('name').set('value','');
		$('email').set('value','');
		$('topic').set('value','');
		$('msg').set('value','');
	}

