$(document).ready(function()
{
	$("#sections ul.level1 li").each(function()
	{
		if($(this).attr('rel') == 'empty')
		{
			var child = $(this).children('');
			var parent = $(this);
			child.attr('href','#0');
			child.bind('click',function() {
				//deactivate();
				$(this).parent().next().children('ul.level2').reactivate();
				parent.addClass('active');
				parent.attr('id','actived');
				//$(this).parent().next().children('ul.level2').slideDown('slow');
				//$(this).parent().next().children('ul.level2').addClass('display');
			});
		}
	}
	);
}
);

$.fn.reactivate = function()
{
	var element = $(this);
	var old_element = $("#sections li ul.level2.display");
	$("#sections li.active").each(function()
	{
		$(this).removeClass('active');
		$(this).attr('id','');
	});
	old_element.slideUp('slow',
	function()
	{
		$(this).removeClass('display');
		element.slideDown('slow',
		function()
		{
			element.addClass('display');
		});
	});
}

function intro(){
//hide elements
/*$("#intrologo").css('behavior','');
$("#container").hide(); $("#head").hide(); $("#intrologo").hide();
$("#language").hide(); $("#pozitiv_href").hide();
$("#sections").css('visibility','hidden');
$("#sections ul li#actived a img").css('visibility','hidden');
$("#sections  ul.level2.display").css('display','none');*/
$("#container").fadeIn(1000,function()
{
	$("#intrologo").fadeIn(1000,function()
	{
		$("#sections").css('visibility','visible');
		$("#sections").hide();
		$("#sections").fadeIn(400,function()
		{
			$("#sections  ul.level2.display").slideDown(400,function()
			{
				$("#sections ul li#actived a img").attr('style','');
				$("#language").slideDown(400);
				$("#pozitiv_href").fadeIn(400);
			});
		});
	});
});
}
