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

$(document).ready(function(){
    
    var left = $("#left").height();
    var right = $("#right").height();
    var center = $("#center").height();
	var max;
	
    if((center > left) && (center > right)){
    	$("#left").height(center);
    	$("#right").height(center);
    	max = center;
    } else {
    	if(left > right){
    		$("#right").height(left);
    		max = left;
    	} else {
    		$("#left").height(right);
    		max = right;
    	}
    }
    
    //hack dla ie6
    if(jQuery.browser.msie == true){
    	if(jQuery.browser.version == '6.0'){
    		$("#content").height(max + ($("#footer").height()) + 10);
    	}
    }
    
    $('.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");
	});
	

  });
