/* FX.Slide */
/* toggle window for the login section */
/* Works with mootools-release-1.2 */
/* more info at http://demos.mootools.net/Fx.Slide */
function initLoginForm() {
	if ($('login')) {
		$('login').setStyle('height','auto');
		var mySlide = new Fx.Slide('login').hide();  //starts the panel in closed state  
	}
	
	if ($('toggleLogin')) {
	    $('toggleLogin').addEvent('click', function(e) {
	    	if (e)
	    		e = new Event(e);

	    	mySlide.toggle();
			
	    	if (e)
	    		e.stop();
		});
	}
    
	if ($('closeLogin')) {
	    $('closeLogin').addEvent('click', function(e) {
			e = new Event(e);
			mySlide.slideOut();
			e.stop();
		});
	}
} Onload.add(initLoginForm);


function initMenuForm() {
	if ($('topMenu')) {
		$('topMenu').setStyle('height','auto');
		var menuSlide = new Fx.Slide('topMenu').hide();  //starts the panel in closed state  
	}

	if ($('toggleMenu')) {
	    $('toggleMenu').addEvent('click', function(e) {
	    	if (parseInt($('topMenu').getStyle('margin-top'))!=0 && parseInt($('topFacebook').getStyle('margin-top'))==0) {
				var x = new Chain();
				
				var one = function() {
					facebookSlide.toggle();
				};
				
				var two = function() {
					menuSlide.toggle();
				};
				
				x.chain(one);
				x.chain(two);
				x.callChain();
				x.callChain.delay(1000, x);
				x.callChain.delay(1000, x);
	    	} else {
				menuSlide.toggle();
	    	}
	    	
			e = new Event(e);
			e.stop();
		});
	}
	
	if ($('closeMenu')) {
	    $('closeMenu').addEvent('click', function(e) {
			e = new Event(e);
			menuSlide.toggle();
			e.stop();
		});
	}
	


	if ($('topFacebook')) {
		$('topFacebook').setStyle('height','auto');
		var facebookSlide = new Fx.Slide('topFacebook').hide();  //starts the panel in closed state  
	}

	if ($('toggleFacebook')) {
	    $('toggleFacebook').addEvent('click', function(e) {
	    	if (parseInt($('topMenu').getStyle('margin-top'))==0 && parseInt($('topFacebook').getStyle('margin-top'))!=0) {
				var x = new Chain();
				
				var one = function() {
					menuSlide.toggle();
				};
				
				var two = function() {
					facebookSlide.toggle();
				};
				
				x.chain(one);
				x.chain(two);
				x.callChain();
				x.callChain.delay(1000, x);
				x.callChain.delay(1000, x);
	    	} else {
				facebookSlide.toggle();
	    	}
	    	
			e = new Event(e);
			e.stop();
		});
	}
	
	if ($('closeFacebook')) {
	    $('closeFacebook').addEvent('click', function(e) {
			e = new Event(e);
			facebookSlide.toggle();
			e.stop();
		});
	}
} Onload.add(initMenuForm);


