//	TOLY globals
// ----------------------------------------------------------------
	$(document).ready( function() {
// ----------------------------------------------------------------

// --------------------------- external links

			$('a[rel="external"]').click( function() {
        		window.open( $(this).attr('href') );
        		return false;});
			
// --------------------------- no spam mail

			$('a[rel="mail"]').each( function() {
			   this.href = this.href.replace('(at)',"@");
       		   return true;});

// --------------------------- blur remove

			$("a").focus(function() {
  			$(this).blur();
			});
			
			$("input.radio").focus(function() {
  			$(this).blur();
			});			


// -------------------------- fancybox

			$("a.youtube").fancybox({
								'padding' : 0,
				'frameWidth'			:	445,
				'frameHeight'			:	364
				});
			
			$("a.mapy").fancybox({
								'padding' : 0,
				'frameWidth'			:	750,
				'frameHeight'			:	480,
				'scrolling'				:   'no'
				});			
		
			$("a.produkt_foto").fancybox({
				'transitionIn'		: 'fade',
				'transitionOut'		: 'fade'
			});

			
// --------------------------- products scroll

		$('#products_all').slide({autoplay: true, duration: 4000, showSlideIndex: false});


// --------------------------- accordion
	$.easing.def="jswing";
	$('.wojewodztwa_lista_btn h3').click(function(e){var a=$(this).parent().next();
		$('.wojewodztwa_lista_content').not(a).slideUp('slow');
		a.slideToggle('slow');
		e.preventDefault()
		})

// ----------------------------------------------------------------
		});
// ----------------------------------------------------------------




// ---------------------------- formularz kontaktowy

// ---------------------------- podmiot odpowiedzialny			

				$().ajaxify({
				    link:'podmiot_odpowiedzialny.php',
					target: '#podmiot_odpowiedzialny',
					method:'POST'
				});									  			
/* form - zapytanie kontakt */
$ (function(){
	$("#form-kontakt").submit(function(){
	   var str = $("form").serialize();
	   $.ajax({
	   type: "POST",
	   url: "/form_ajax_contact.php",
	   data: str,
	   success: function(msg){
		
		$("#note").ajaxComplete(function(event, request, settings){
	
		if(msg == 'OK') {
			result = '<div class="notification_ok">Dziękujemy za wypełnienie formularza. <br />Wiadomość została wysłana. <br /><br /><strong>Nasz przedstawiciel skontaktuje się z Państwem najszybciej, jak to będzie możliwe!</strong></div>';
			$("#fields").hide();
		}  else {
			result = msg;
		}
	
		$(this).html(result);
	});	
	}
	 });
	return false;
	});
});

/* form - wspolpraca */
$ (function(){
	$("#form-wspolpraca").submit(function(){
	   var str = $("#form-wspolpraca").serialize();
	   $.ajax({
	   type: "POST",
	   url: "/form_ajax_wspolpraca.php",
	   data: str,
	   success: function(msg){
		
		$("#note").ajaxComplete(function(event, request, settings){
	
		if(msg == 'OK') {
			result = '<div class="notification_ok">Dziękujemy za wypełnienie formularza. <br />Wiadomość została wysłana. <br /><br /><strong>Nasz przedstawiciel skontaktuje się z Państwem najszybciej, jak to będzie możliwe!</strong></div>';
			$("#fields").hide();
		}  else {
			result = msg;
		}
	
		$(this).html(result);
	});	
	}
	 });
	return false;
	});
});


$ (function(){
	$("#firma_nie").click(function(){
		if($('#wybor').fadeOut('slow')) {
			$('#wybor').show();
			$('#div_firma_nie').fadeIn('slow');
		}			
	});
	$("#firma_tak").click(function(){
		if($('#wybor').fadeOut('slow')) {
			$('#wybor').show();	
			$('#div_firma_tak').fadeIn('slow');
		}			
	});	
});
