	$(document).ready(function() {
	
		$('.fancybox').fancybox();
	
		// function getHeight(el,fn) {
		// 	    var img = new Image();
		// 	    img.onload = function() { fn(img.height); };
		// 	    img.src = el.attr("src");
		// 	}
		// 	
		// 	function getWidth(el,fn) {
		// 	    var img = new Image();
		// 	    img.onload = function() { fn(img.width); };
		// 	    img.src = el.attr("src");
		// 	}
		// 	
		// 	$("img.listingIcon, img.certPhoto, .realizationImages img").click(
		// 		function() {
		// 			
		// 			var clone = $(this).clone();
		// 
		// 			getHeight(clone, function(h){
		// 				marginTop = -1 * 0.5 * h;
		// 				clone.css("height", h);
		// 				clone.css("margin-top", marginTop);
		// 			});
		// 			
		// 			getWidth(clone, function(w){
		// 				marginLeft = -1 * 0.5 * w;
		// 				clone.css("width", w);
		// 				clone.css("margin-left", marginLeft);
		// 			});
		// 			
		// 			var cssObj = {
		// 				"z-index": "10000",
		// 				"position": "fixed",
		// 				"display": "block",
		// 				"top": "50%",
		// 				"left": "50%",
		// 				"width": "auto",
		// 				"cursor": "pointer",
		// 				"border": "4px solid #fff"
		// 		    }
		// 		
		// 			clone.addClass("nowyObrazek");
		// 			clone.removeClass("buttonsPhoto");
		// 			clone.css(cssObj);
		// 			$('body').append(clone);
		// 			clone.hide();
		// 			clone.css
		// 			clone.fadeIn("slow");
		// 			$(clone).click(function(){
		// 				$(this).fadeOut("slow");
		// 			});
		// 	});
		
		$(".przycisk_dialog div.buttonsPhoto").click(
			function() {
				
				var clone = $(this).find("img.buttonsPhoto").clone();

				getHeight(clone, function(h){
					marginTop = -1 * 0.5 * h;
					clone.css("height", h);
					clone.css("margin-top", marginTop);
				});
				
				getWidth(clone, function(w){
					marginLeft = -1 * 0.5 * w;
					clone.css("width", w);
					clone.css("margin-left", marginLeft);
				});
				
				var cssObj = {
					"z-index": "10000",
					"position": "fixed",
					"display": "block",
					"top": "50%",
					"left": "50%",
					"width": "auto",
					"cursor": "pointer",
					"border": "4px solid #fff"
			    }
			
				clone.addClass("nowyObrazek");
				clone.removeClass("buttonsPhoto");
				clone.css(cssObj);
				$('body').append(clone);
				clone.hide();
				clone.css
				clone.fadeIn("slow");
				$(clone).click(function(){
					$(this).fadeOut("slow");
				});
		});
	
		$(".dynamicTab_content").hide(); 
		$("ul.dynamicTabs li:first").addClass("active").show(); 
		$(".dynamicTab_content:first").show(); 

		$("ul.dynamicTabs li").click(function() {

			$("ul.dynamicTabs li").removeClass("active"); 
			$(this).addClass("active"); 
			$(".dynamicTab_content").hide(); 

			var activeTab = $(this).find("div").attr("id"); 
			$(activeTab).fadeIn(); 
			
			$.fx.speeds._default = 600;
		});

		
		$(".przycisk_dialog").each(function() {
			$(this).dialog({ 
				autoOpen: false, 
				show: "fade", 
				hide: "fade", 
				modal: false, 
				draggable: false, 
				resizable: false, 
				minWidth: 800, 
				position: 'center'
			});
		});

		$( ".przycisk" ).click(function() {
			var activeDialog = $(this).attr("href"); 
				$( activeDialog ).dialog( "open" );
			return false;
		});
		

		$("#slides").slides({
			pagination: false,
			generatePagination: false,
			play: 5000,
			slideSpeed: 550,
			effect: 'slide, fade',
			preload: false
		});	

	  // $('.listingIcon').fadeTo('fast', 0.7)
	  //       $('.listingIcon').hover(function(){
	  //                 $(this).fadeTo('fast', 1);
	  //                 $("#primarycontainer").stop().fadeTo('fast', 0.7);
	  //             },function(){
	  //                 $(this).fadeTo('fast', 0.7);
	  //                 $("#primarycontainer").stop().fadeTo('fast', 1);
	  //             }
	  //         );


		
		// $('#bottom980 p a').hover(
		// 	function() {
		// 	  $(this).animate({
		// 		color: "#000"
		// 	  }, 250);
		// 	},
		// 	function() {
		// 	  $(this).animate({
		// 		color: "#9da09f"
		// 	  }, 250);
		// 	}
		// );
		
		$('#banner980 ul.productInfo li a').hover(
			function() {
			  $(this).animate({
				color: "#333"
			  }, 450);
			},
			function() {
			  $(this).animate({
				color: "#666"
			  }, 450);
			}
		);
		
		// $('#mainMenuBox ul#menuList li a').hover(
		// 	function() {
		// 	  $(this).animate({
		// 		color: "#dba624"
		// 	  }, 250);
		// 	},
		// 	function() {
		// 	  $(this).animate({
		// 		color: "#FFF"
		// 	  }, 250);
		// 	}
		// );
		
		$('.readmore').hide();
		$('.newsContainer').hover(
			function() {
			  $('.readmore', this).slideDown("fast");
			  $(this).animate({
				backgroundColor: "#f3f3f3",
				color: "#000",
				borderColor: "#ccc"
			  }, 250);
			},
			function() {
			 $('.readmore', this).slideUp("fast");
			  $(this).animate({
				backgroundColor: "transparent",
				color: "#666",
				borderColor: "#FFF"
			  }, 250);
			}
		);
	
	});
	
	function mapaGoogle() {
    	var latlng = new google.maps.LatLng(50.270050053586886, 21.418309028930664);
	    var myOptions = {
	      zoom: 13,
	      center: latlng,
	      mapTypeId: google.maps.MapTypeId.ROADMAP,
	      disableDefaultUI: false,
	      mapTypeControl: false,
	      marker: latlng
	    };

	    var map = new google.maps.Map(document.getElementById("map"), myOptions);

	    var marker = new google.maps.Marker({
	      position: latlng,
	      map: map,
	      title: "d"
	    });
  	}
