$(document).ready(function()
{
var element_activ=0;
var finish=0;


// 	menu po kliknieciu
// 	$(".menu_label").click(function(){
//
// 		if (element_activ && element_activ == this){
// 			$(element_activ).find(".menu_slider").animate({marginTop: "0px", height: "0px"}, 100 );
// 			element_activ =0;
//
// 		}
// 		else
// 		{
// 		 	if (element_activ)
// 			$(element_activ).find(".menu_slider").animate({marginTop: "0px", height: "0px"}, 100 );
//
//
// 			//var slider_height= $(this).find(".menu_slider").css("height");
// 			var slider_height = $(this).find(".menu_slider").attr('class').split(' ').slice(-1);
//
// 			var sl_margin = parseInt(slider_height) + 25;
//
// 			element_activ = this;
// 		     $(this).find(".menu_slider").animate({marginTop: "-" + sl_margin, height: slider_height}, 500);
// 			}
//
//
//
//
//
// 	});

$(".menu_label").hover(function(){
		finish=0;
 		if (element_activ && element_activ != this)
 			$(element_activ).find(".menu_slider").animate({marginTop: "0px", height: "0px"}, 100);

		var slider_height = $(this).find(".menu_slider").attr('class').split(' ').slice(-1);
		var sl_margin = parseInt(slider_height) + 25;
		element_activ = this;
	     $(this).find(".menu_slider").animate({marginTop: "-" + sl_margin, height: slider_height}, 500, function() { finish=1 } );
	});

$(".menu_label").click(function(){

		if (element_activ ==0 && finish ==1 )
		{
			var slider_height = $(this).find(".menu_slider").attr('class').split(' ').slice(-1);
			var sl_margin = parseInt(slider_height) + 25;
			element_activ = this;
	     	$(this).find(".menu_slider").animate({marginTop: "-" + sl_margin, height: slider_height}, 500, function() { finish=1 } );
		}

 		else if (element_activ && element_activ == this && finish ==1)
 			{
 			$(element_activ).find(".menu_slider").animate({marginTop: "0px", height: "0px"}, 100 );
			element_activ=0;
			}


	});


});






// backup 	$(".menu_label").hover(function(){
//
//  		if (element_activ && element_activ == this){
//  			$(element_activ).find(".menu_slider").animate({marginTop: "0px", height: "0px"}, 100 );
//  			element_activ =0;
//
//  		}
//
//  		else
//  		{
// 		 	if (element_activ)
// 			$(element_activ).find(".menu_slider").animate({marginTop: "0px", height: "0px"}, 100 );
//
//
// 			//var slider_height= $(this).find(".menu_slider").css("height");
// 			var slider_height = $(this).find(".menu_slider").attr('class').split(' ').slice(-1);
//
// 			var sl_margin = parseInt(slider_height) + 25;
//
// 			element_activ = this;
// 		     $(this).find(".menu_slider").animate({marginTop: "-" + sl_margin, height: slider_height}, 500);
// // 			}
//
// 	});
//
// });



