﻿function hideMenu() {
	//alert('ok');
	var main_menu = $$('.menu');
	main_menu.set('opacity', 0);
}
window.addEvent('domready', function(){
	var main_menu = $$('.menu');
	main_menu.set('opacity', 0);
	Element.implement({  
         show: function() {  
             this.setStyle('display','');  
         },  
         hide: function() {  
            this.setStyle('display','none');  
         }   
   }); 
	var h1 = $$('.menu_h1');
	var h2 = $$('.menu_h2');
	h1.each(function(el, i) {
		var menu_slide_name = 'menu_slide_'+i;
		var menu_slider = new Fx.Slide('menu_slide_'+i, {duration: 200});
		var mstatus = new Array();
		var menu_status = Cookie.read( menu_slide_name );
		if ( menu_status == 'true' ) {
			mstatus[i] = true;
		} else {
			menu_slider.hide();
			mstatus[i] = false;
		}
		
		el.addEvent('click', function(e){ 
			if ( mstatus[i] ) {
				menu_slider.slideOut();
				mstatus[i] = false;
				Cookie.write( menu_slide_name, 'false', {domain: 'prisikelimopartija.lt'} );
			} else {
				menu_slider.slideIn();
				mstatus[i] = true;
				Cookie.write( menu_slide_name, 'true', {domain: 'prisikelimopartija.lt'} );
			}
		});
		el.addEvent('mouseenter', function(e){ 
			e.stop();
			var tween = new Fx.Tween(el, {duration: 200});
			var tweenC = new Fx.Tween(el, {duration: 200});
			tween.start('margin-left', 0,5);
			tweenC.start('color', '#116a83', '#47bcdd');
		});
		el.addEvent('mouseleave', function(e){
			e.stop();
			var tween = new Fx.Tween(el, {duration: 200});
			var tweenC = new Fx.Tween(el, {duration: 200});
			tween.start('margin-left', 5,0);
			tweenC.start('color', '#47bcdd', '#116a83');
		});
	}, this )
	
	h2.each(function(el, i) {
		el.addEvent('mouseenter', function(e){ 
			e.stop();
			var tween = new Fx.Tween(el, {duration: 200});
			var tweenC = new Fx.Tween(el, {duration: 200});
			//tween.start('margin-left', 0,5);
			tweenC.start('color', '#497340', '#6aad5c');
		});
		el.addEvent('mouseleave', function(e){
			e.stop();
			var tween = new Fx.Tween(el, {duration: 200});
			var tweenC = new Fx.Tween(el, {duration: 200});
			//tween.start('margin-left', 5,0);
			tweenC.start('color', '#6aad5c', '#497340');
		});
	}, this )
	var main_menu = $$('.menu');
	main_menu.set('opacity', 1);
	main_menu.setStyle('display','');
});