this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


	  
	  

$(document).ready(function(){
	$('div.jimgMenu ul li a').hover(function() {
		
		// if the element is currently being animated (to a easeOut)...
		if ($(this).is(':animated')) {
		  $(this).stop().animate({width: "420px"}, {duration: 450, easing:"easeOutQuad"});
		} else {
		  // ease in quickly
		  $(this).stop().animate({width: "420px"}, {duration: 400, easing:"easeOutQuad"});
		}
	  }, function () {
		// on hovering out, ease the element out
		if ($(this).is(':animated')) {
		  $(this).stop().animate({width: "165px"}, {duration: 400, easing:"easeInOutQuad"})
		} else {
		  // ease out slowly
		  $(this).stop('animated:').animate({width: "165px"}, {duration: 450, easing:"easeInOutQuad"});
		}
	  });
	  imagePreview();
	  $('p.wiedza').hide();
	  $('div.opisy').click(function(){
	  
	  if($(this).children('p.wiedza').is( ":visible" ) == false){
	  $(this).children('p.wiedza').slideDown('slow');
	  }
	  else{
	  $(this).children('p.wiedza').slideUp('slow');
	  }
	  });
	  
	  $('h2.naglowek').tooltip();
	  
	  
});	
