var transitionRunning = false;
var myFx;
var updateContainer;
window.addEvent('domready', function() {
	updateContainer = $('live_content');
	
	myFx = new Fx.Slide($('live_content'));
	myFx.hide();

	$('link_contact').addEvent('click', function(e) {
		if (e) e.stop();
		
		if (!transitionRunning) {
			transitionRunning = true;
			
			if (myFx.open) {
				this.removeClass('isOpen');
				myFx.slideOut().chain(function() {
					updateContainer.empty();
					transitionRunning = false;
				}.bind(this));
			} else {
				new Request.HTML({
					url: 'contact.html',
					update: updateContainer,
					noCache: true,
					evalScripts: false,
					onComplete: function(responseTree, responseElements, responseHTML, responseJavaScript) {
						myFx.hide();
						this.addClass('isOpen');
						myFx.slideIn().chain(function() {
							$exec(responseJavaScript);
							transitionRunning = false;
						});
					}.bind(this)
				}).send()
			}
		}
	});
});
