function show_tip(id, url){
  	  
  	  var a = $("#tip2"+id);
	  var offset = a.offset();	

	  $("#tip"+id).remove();
	  $("body").append("<div id=\"tip"+id+"\" class=\"tooltip\" style=\"top:"+(offset.top+20)+"px;left:"+(offset.left+5)+"px;\"></div>");
      $("#tip"+id).html('czekaj... trwa pobieranie opisu.');
      
      $.post(url, {id: id },
  		
      	function(data){
    		if(data.length > 0){
    			$("#tip"+id).html(data); 
    		} else {
    			alert('Coś poszło nie tak');
    		}
  		});
  		

};

function send_form(id){
	$("#"+id).submit();
}

$(document).ready(function(){
      
    $('.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();
    });
    
	$(".shadow table tr:even").addClass("abc");
	$(".shadow table tr:odd").addClass("def");
	$(".shadow table tr").mouseover(function() {
    	$(this).addClass("tr_hover");
	}).mouseout(function() {
    	$(this).removeClass("tr_hover");
	});
	
	$(".obrazek_ramka").mouseover(function() {
    	$(this).addClass("obrazek_ramka_hover");
	}).mouseout(function() {
    	$(this).removeClass("obrazek_ramka_hover");
	});
	
	$("#shadow table tr:even").addClass("abc");
	$("#shadow table tr:odd").addClass("def");
	$("#shadow table tr").mouseover(function() {
    	$(this).addClass("tr_hover");
	}).mouseout(function() {
    	$(this).removeClass("tr_hover");
	});
	
   	$('.close_btn').click(function(){
   		alert('hello');
    	var id = this.id;

    	setTimeout(function(){$("#tip"+id).fadeOut();}, 300);
    	setTimeout(function(){$("#tip"+id).remove();}, 700);
    	 
    }); 
    
    $('#new_koment_link').toggle(
  		function () {
    		$("#add_koment_form").fadeIn("slow");
    		$('#new_koment_link').html('[-] Skomentuj ten obrazek');
  		},
 		 function () {
    		$("#add_koment_form").fadeOut("slow");
    		$('#new_koment_link').html('[+] Skomentuj ten obrazek');
  		}
	);
    $('#new_message_link').toggle(
  		function () {
    		$("#add_koment_form").fadeIn("slow");
  		},
 		 function () {
    		$("#add_koment_form").fadeOut("slow");
  		}
	);	
 });
