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 getAjaxValue(link, div, strona){
	$('#'+div+' .loading_div').fadeIn();
	
	$.post(link, {strona: strona },
      	function(data){
    		if(data.length > 0){
    			$("#"+div).html(data); 
    		} else {
    			alert('Coś poszło nie tak');
    		}
  		}
  	);
}
function send_form(id){
	$("#"+id).submit();
}
function getMiasta(select_id, url, class_name){
	$("#miasta_list").attr("disabled", "disabled");
    $("#loading_bar").fadeIn("slow");
	var id = $("#"+select_id).val();
			
	$.post(url, { id : id, class_name : class_name },
  	function(data){
    	if(data.length > 0){
    		$("#miasta").html(data); 
    	} else {
    		alert('Coś poszło nie tak');
    	}
    	$("#loading_bar").fadeOut("slow");
    	$("#miasta_list").attr("disabled", false);
  	});
}
$(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");
	});
	
	$(".div_anons_list").mouseover(function() {
    	$(this).css("border","2px solid #de107b");
    	$(this).css("color","#de107b");
	}).mouseout(function() {
    	$(this).css("border","2px solid #C752C7");
    	$(this).css("color","#C752C7");
	});
	
	$("#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");
  		}
	);


 });