function sendForm(div, action){
	var form = $("#"+div);
	form.attr('action', action);
	form.submit();
}

$(document).ready(function(){
	
    $('#search-text').click(function(){
  	  var val = $('#search-text').val();
  	  if(val == 'Szukaj')  $('#search-text').val('');
    });
    
    $('.tip').mouseover(function(){
  		
  	  var id = this.id;
  	  var tresc = $("#tresc_"+id).html();
  	  
  	  var a = $("#"+id);
	  var offset = a.offset();	
	  
	  $("#info_"+id).remove();
	  $("body").append("<div id=\"info_"+id+"\" class=\"tooltip\" style=\"top:"+(offset.top+20)+"px;left:"+(offset.left+5)+"px;\"></div>");
      $("#info_"+id).html(tresc);
		

    });
    
    $('.tip').mouseout(function(){
  	  var id = this.id;
  	  var tresc = this.title;	  
	  $("#info_"+id).remove();
    });
    
    $(".kolej_div").dblclick(function(){ 
    	var id = $(this).attr('id');
    	id = id.substring(2, id.length);
    	
    	$(".kolej_div").each(function(i){ 
    		var id_buf = $(this).attr('id');
    		id_buf = id_buf.substring(2, id_buf.length);
    		$(this).empty(); 
    		$(this).html('<div class="kolej_span">'+id_buf+'</div>');
    	});

    	$(this).empty(); 
    	$(this).html('<div class="kolej_span"><input type="text" class="kolejnoscInput" name="kolej_item['+id+']" value="'+id+'" /></div>');
    });
    
    $("#checked_box").toggle(
      function () {
      	$("#checked_box").attr('checked', 'true');
        $('.ptaszki').attr('checked', 'true');
      },
      function () {
      	$("#checked_box").removeAttr('checked');
        $('.ptaszki').removeAttr('checked');
      }
    );
    
    $(".wyniki tr:even").addClass("abc");
	$(".wyniki tr:odd").addClass("def");
	$(".wyniki tr").mouseover(function() {
    	$(this).addClass("tr_hover");
	}).mouseout(function() {
    	$(this).removeClass("tr_hover");
	});
	

  });

