$(document).ready(function() {
		
		$('#msg').ajaxStart(function() {
  			$(this).html('Trwa wysyłanie. Proszę czekać.');
		});		
		
		$('.podmenuitem').bind('mouseenter', function(){
			idk=$(this).attr("id").split("__");
			$('#m_'+idk[1]).addClass('mion2');
		});
		
		$('.podmenuitem').bind('mouseleave', function(){
			$('#ulmenu li a').removeClass('mion2');
		});
		
		$('.ulpodmenu').bind('mouseenter', function(){
			idk=$(this).attr("id").split("__");
			$('#m_'+idk[1]).addClass('mion2');
		});
		
		$('.ulpodmenu').bind('mouseleave', function(){
			$('#ulmenu li a').removeClass('mion2');
		});
		
		
		$('#banner').nivoSlider({
			effect:'random', //Specify sets like: 'fold,fade,sliceDown'
			slices:15,
			animSpeed:800,
			pauseTime:3000,
			startSlide:0, //Set starting Slide (0 index)
			directionNav:false, //Next and Prev
			directionNavHide:false, //Only show on hover
			controlNav:false, //1,2,3...
			controlNavThumbs:false, //Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, //Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', //Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
			keyboardNav:false, //Use left and right arrows
			pauseOnHover:false, //Stop animation while hovering
			manualAdvance:false, //Force manual transitions
			captionOpacity:0.8, //Universal caption opacity
			beforeChange: function(){},
			afterChange: function(){},
			slideshowEnd: function(){} //Triggers after all slides have been shown
		}); 
		
		
		$('.faq_link').bind('click', function(){
			atr=$(this).attr('id').split("_");
			$('#tresc_'+atr[1]).slideToggle("fast");
		});
		
		
		$("a.LB").fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true,
			'hideOnOverlayClick': true,
			'overlayColor': '#000',
			'autoScale': false
		});
        
		
});

function kontakt_form(id) {
	if(!$('#imie').val()) { alert("Proszę uzupełnić imię"); return false; }
	if(!$('#nazwisko').val()) { alert("Proszę uzupełnić nazwisko"); return false; }
	if(!$('#email').val()) { alert("Proszę podać e-mail"); return false; }
	if(!$('#tresc').val()) { alert("Proszę uzupełnić treść wiadomości"); return false; }
	
	imie=$('#imie').val();
	nazwisko=$('#nazwisko').val();
	email=$('#email').val();
	tresc=$('#tresc').val();
	
	$.ajax({
   	type: "GET",
	   url: "/ajax.php",
	   data: "akcja=wyslij_email&imie="+imie+"&nazwisko="+nazwisko+"&email="+email+"&tresc="+tresc+"",
	   success: function(msg){
	     $('#msg').html(msg);
		  $('#imie').val("");	
		  $('#nazwisko').val("");		
		  $('#email').val("");
		  $('#tresc').val("");
		  $('#telefon').val("");	
	   }
 	});
	
	return false;
}

function drukuj(akcja, id) {
	thePopup=open("/drukuj_html.php?id="+id+"&akcja="+akcja+"","Print", "menubar=no,width=708,height=600,toolbar=no");
}

function drukuj_wydarzenia(akcja, id, ide, strona) {
	thePopup=open("/drukuj_html.php?id="+id+"&akcja="+akcja+"&ide="+ide+"&strona="+strona+"","Print", "menubar=no,width=708,height=600,toolbar=no");
}

function drukuj_produkty(akcja, id, ide) {
	thePopup=open("/drukuj_html.php?id="+id+"&akcja="+akcja+"&ide="+ide+"","Print", "menubar=no,width=708,height=600,toolbar=no");
}
