var menuVisibleDuration = 5;

$(document).ready(function() {

	/* Główne menu */
	
	$('#menu-launcher').mouseover(function(){
		$('#menu-container').show('fast',startCounting);
	});
	
	$('#menu-container').mouseover(function(){
		stopCounting();
	});
	
	$('#menu-container').mouseout(function(){
		startCounting();
	});
	
	/* KONTAKT */
	
	$('#submit-kontakt').click(function(){
		
		if ($('#first-name').val()=='')
		{
			alert('Proszę podać imię');
			return false;
		}
		
		if ($('#subject').val()=='')
		{
			alert('Proszę podać temat listu');
			return false;
		}
		
		if ($('#email-address').val()=='')
		{
			alert('Proszę podać email');
			return false;
		}
		
		if ($('#content').val()=='')
		{
			alert('Proszę wpisać treść wiadomości');
			return false;
		}
		
		return true;
	});
	
	/* FAQ */
	
   $('.faq-read').toggle(
      function () {
      	
      	$(this).html('Ukryj odpowiedź');
      	
		var elIndex = $('.faq-read').index(this);
		var elDom 	= $('.faq-answer').get(elIndex);
		
		$(elDom).show('slow');
      },
      function () {
      	
      	$(this).html('Pokaż odpowiedź');
      	
		var elIndex = $('.faq-read').index(this);
		var elDom 	= $('.faq-answer').get(elIndex);
		
		$(elDom).hide('slow');
      }
    );
    
    /* RÓŻNE */
    
    $('.delete').css('color','red').click(function(){
    	if (confirm('Czy napewno usunąć element ?'))
    	{
    		return true;
    	}
    	
    	return false;
    });
})

function closeMenu ()
{
	$('#menu-container').hide('slow');
}

function startCounting ()
{
	toVisible = setTimeout('closeMenu()',menuVisibleDuration*1000);
}

function stopCounting ()
{
	clearTimeout(toVisible);
}