﻿

	
	$(document).ready(function(){
	


      $('table#sortedtable tbody tr').mouseover(function() {
         $(this).addClass('selectedRow');
      }).mouseout(function() {
         $(this).removeClass('selectedRow');
      });

      

	
	
	$('td a#ptooltip').tooltip({
		delay: 0,
		showURL: false,
		track: true,
		//fixPNG: true,
		//showBody: " - ",
		bodyHandler: function() {
			ChildImgSrc = $(this).attr('rel');
			return $('<img/>').attr('src', ChildImgSrc);
		}
	});
	
	$("form#afinder").submit(function() {
 
 var destyn     = $('#destynacja').attr('value');  //rodzaj
 var wylot     = $('#wylot').attr('value');  //rozmiar
  
//$('#contentLoading').show();
  $('#ajaxThrobber').show();
  			
		$.ajax({
			type: "POST",
			
			url: "wynik.php",
			data: "destyn="+ destyn +"& wylot="+ wylot,
				

			success: function(data){
//				var urle = "index2.php";
//				document.location.href = urle;
				$('#contentcolumn .innertube').hide().html(data).fadeIn("4000");
				
				
				
				
				
				//$('div.success').hide().html(data).fadeIn();	
// show the hover row different than other rows
$.tablesorter.addWidget({
        id: "hover",
        format: function(table) {

            $("tbody tr", table).each(function() {
                $(this).hover(
                        function () {
                            var $rows = $(this).children();
                            $rows.each(function(){
                                $(this).addClass("hover");
                            })
                        },
                        function () {
                            var $rows = $(this).children();
                            $rows.each(function(){
                                $(this).removeClass("hover");
                            })
                        }
                        );
            })
        }
    }); 

	
$.tablesorter.addWidget({ 
    // give the widget a id 
    id: "ttip", 
    // format is called when the on init and when a sorting has finished 
    format: function(table) { 
		$('td a#ptooltip').tooltip({
		delay: 0,
		showURL: false,
		track: true,
		//fixPNG: true,
		//showBody: " - ",
		bodyHandler: function() {
			ChildImgSrc = $(this).attr('rel');
			return $('<img/>').attr('src', ChildImgSrc);
		}
	});
	}
	});
				
				$("#sortedtable").tablesorter({ sortlist: [7,1], sortMultiSortKey: 'altKey' ,   headers: { 0: { sorter: false } ,8: {sorter: false} } , 
				widgets: ['zebra','ttip','hover']});
				$("#sortedtable").tablesorterPager({container: $("#pager"),positionFixed: false, size: 10}); 

				$('#ajaxThrobber').hide();
		
				
				 
				
 }
 		});
	return false;
	});
	


$('#tabs').tabs();
$('#tabsk').tabs();





$("#btnTest2").click( function() {
                    $('.divToPrint').jqprint({ debug: false, operaSupport: true  });
                    return false;
                });

$("form#kontakt").submit(function(){

var str = $("form#kontakt").serialize();

   $.ajax({
   type: "POST",
   url: "contact.php",
   data: str,
   success: function(msg){
    
$("#note").ajaxComplete(function(event, request, settings){

if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
{
result = '<div class="notification_ok">Wiadomość wysłana. Dziękujemy!</div>';
$("#fields").hide();
}
else
{
result = msg;
}

$(this).html(result);

});

}

 });

return false;

});

});




$(function() {
	
	$("#selectMonth, #selectYear").change(checkLinkedDays);
	$('.datepick-inline').each(function() { // Correct inline widths
		var months = $('.datepick-one-month', this).length / $('.datepick-new-row', this).length;
		$(this).width(months * 185);
	});
});


// Prevent selection of invalid dates through the select controls 
function checkLinkedDays() { 
    var daysInMonth = 32 - new Date($('#selectYear').val(), 
        $('#selectMonth').val() - 1, 32).getDate(); 
    $('#selectDay option').attr('disabled', ''); 
    $('#selectDay option:gt(' + (daysInMonth - 1) +')').attr('disabled', 'disabled'); 
    if ($('#selectDay').val() > daysInMonth) { 
        $('#selectDay').val(daysInMonth); 
    } 
}
