/* ===========================================
	Funkcje potrzebne do inicjacji SlideShow
   =========================================== */
var slideShowCurrent = 0;
function DoSlideShow()
{
	slideShowNext = slideShowCurrent + 1;
	if (slideShowNext > $('ul.slideShow2 li').length - 1)
		slideShowNext = 0;

	h = $('ul.slideShow2 li:eq('+slideShowNext+')').height();

	$('ul.slideShow2 li:eq('+slideShowCurrent+')').slideUp(250,function(){
		$('ul.slideShow2 li:eq('+slideShowNext+')').css('top',Math.round((75 - h) / 2)).slideDown(250);
	});
	
	slideShowCurrent = slideShowNext;
	setTimeout(DoSlideShow,5000);
}

/* ===========================================
	Funkcje potrzebne do inicjacji Menu
   =========================================== */
var currentMenuResetTimeoutID;
function MenuReset()
{
	rel = $('#jasdl-mainnav ul li').removeClass('active').filter('.default').addClass('active').children('a').get(0).rel;
	$('#jasdl-subnav ul').hide();
	$('#'+rel).show();
}


/* ===========================================
	Inicjacja
   =========================================== */
$(function(){
	// Inicjacja SlideShow
	setTimeout(DoSlideShow,10);

	// Inicjacja Menu
	/*$('#jasdl-mainnav ul li').bind('click',function(){					
		clearTimeout(currentMenuResetTimeoutID);
		$(this).
			parent().find('li').removeClass('active').end().end().
			addClass('active');
		$('#jasdl-subnav ul').hide();
		$('#'+$(this).children('a').get(0).rel).show();

	}).bind('mouseout',function(){				
		currentMenuResetTimeoutID = setTimeout(MenuReset,1500);
	})*/;
	$('#jasdl-subnav').bind('mouseover',function(){
		clearTimeout(currentMenuResetTimeoutID);
	}).bind('mouseout',function(){
		currentMenuResetTimeoutID = setTimeout(MenuReset,1500);
	});

	// Inicjacja galerii (LightBox)
	$('a.lightbox').lightBox();
});
