this.imagePreview = function(){	
		
		xOffset = 10;
		yOffset = 60;
		
		marginLeft = "0px";
		marginTop = "0px";

	$(".preview").hover(function(e){
		this.t = this.title;
		this.title = "";
		
		marginLeft = "-450px";
		marginTop = "-50px";
		
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Nasze realizacje' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.css("margin-left",marginLeft)
			.css("margin-top",marginTop)
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$(".preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.css("margin-left",marginLeft)
			.css("margin-top",marginTop)
	});			
};

$(document).ready(function(){
	imagePreview();
});




$(document).ready(function() {
					   
//fadeThis
	  $('.fadeThis').append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(400, 1);
	  }, function () {
	    $span.stop().fadeTo(400, 0);
	  });
	});

//box clickable
	$(".box").click(function(){
   	  window.location=$(this).find("a").attr("href");
   	  return false;
	});
	  

//akordeon Facility Management
$( "#accordion" ).accordion();

//fadein

    $('.fadein img:gt(0)').hide();
    setInterval(function(){
      $('.fadein :first-child').fadeOut(2000)
         .next('img').fadeIn(2000)
         .end().appendTo('.fadein');}, 
      5000);


});

// tooltip script written by Alen Grakalic (http://cssglobe.com)

this.tooltip = function(){	
		xOffset = -15;
		yOffset = 10;		
	$(".tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.show("fast");
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

// starting the script on page load
$(document).ready(function(){
	tooltip();
});


jQuery(document).ready(function(){
jQuery(".page_item ul").hide();
jQuery(".current_page_item ul:first").slideDown();
jQuery(".current_page_item").parents("ul, li")
.map(function () {
jQuery(this).slideDown();
});
});
