var $j = jQuery.noConflict();

$j(document).ready(function(){
							
	$j(document).pngFix();
	
	$j('form[name="formularz-szukajka"]').jqTransform({imgPath:'../.img/jqtransformplugin/'});
	
	$j('input[name="email"]').focus(function(){ $j(this).css('border', '1px solid #fff'); });
	$j('input[name="email"]').blur(function(){ $j(this).css('border', '1px solid #313131'); });
	
	//$j('#CM_tekst table').css('opacity', 0.7);
	
	$j('.wizualizacje, #CM_formatka_galeria').nivoSlider({
		effect:'fold', // Specify sets like: 'fold,fade,sliceDown'
		slices: 14, // For slice animations
		boxCols: 8, // For box animations
		boxRows: 4, // For box animations
		animSpeed: 600, // Slide transition speed
		pauseTime: 4000, // How long each slide will show
		startSlide:0, // Set starting Slide (0 index)
		directionNav:false, // Next & Prev navigation
		directionNavHide:true, // Only show on hover
		controlNav:true, // 1,2,3... navigation
		controlNavThumbs:false, // Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, // Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', // Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
		keyboardNav:true, // Use left & right arrows
		pauseOnHover:false, // Stop animation while hovering
		manualAdvance:false, // Force manual transitions
		captionOpacity:0.6, // Universal caption opacity
		prevText: 'Prev', // Prev directionNav text
		nextText: 'Next', // Next directionNav text
		beforeChange: function(){}, // Triggers before a slide transition
		afterChange: function(){}, // Triggers after a slide transition
		slideshowEnd: function(){}, // Triggers after all slides have been shown
		lastSlide: function(){}, // Triggers when last slide is shown
		afterLoad: function(){} // Triggers when slider has loaded
	});	
	
	$j('.mapa-lokalizacja').css('left', '980px');

	$j('.toggler').toggle(
		function(){
			$j('.toggler').animate({
				right: '0'
			}, 800, 'easeInOutCubic', function(){ 
				$j('.toggler').animate({ width: '50' }, 200, function(){ $j('.toggler').html('<span>&laquo;</span> rozwiń'); });
			});
			
			$j('.toggler-mapa').animate({ right: '-100' }, 800, 'easeInOutCubic');
						
			$j('.szukajka').animate({ right: '-280' }, 800, 'easeInOutCubic');
			$j('.orange-bar').animate({ right: '0' }, 800, 'easeInOutCubic');
			$j('.szukajka-bcg').animate({ right: '-280' }, 800, 'easeInOutCubic');
			$j('.uslugowe-button').animate({ right: '25' }, 800, 'easeInOutCubic');
		},
		function(){
			$j('.toggler').animate({
				right: '239'
			}, 600, 'easeOutCubic', function(){ 
				$j('.toggler').animate({ width: '41' }, 200, function(){ $j('.toggler').html('zwiń <span>&raquo;</span>'); }); 
			});
				
			$j('.toggler-mapa').animate({ right: '180' }, 600, 'easeInOutCubic');
				
			$j('.szukajka').animate({ right: '0' }, 600, 'easeOutCubic');
			$j('.orange-bar').animate({ right: '280' }, 600, 'easeOutCubic');
			$j('.szukajka-bcg').animate({ right: '0' }, 600, 'easeOutCubic');
			$j('.uslugowe-button').animate({ right: '303' }, 600, 'easeOutCubic');
	});
	
	
	$j('.toggler-mapa, #lokalizacja').toggle(
		function(){
			$j('.toggler-mapa').animate({
				right: '25'
			}, 800, 'easeInOutCubic');
			
			$j('.toggler-mapa').html('<img src="./.img/toggler-mapa-zamknij.gif" width="8" height="6" alt="x" border="0" /> Zamknij'); 
			
			$j('.mapa-lokalizacja').animate({ left: '0' }, 800, 'easeInOutCubic');
			
			$j('#galeria-zdjec').animate({opacity: 0}, 400, 'easeInOutCubic');
			$j('#lokalizacja').html('Zamknij podgląd'); 

			$j('.button-orange').css('z-index', '96');

			$j('.szukajka').animate({ right: '-280' }, 800, 'easeInOutCubic');
			$j('.orange-bar, .toggler').animate({ right: '0' }, 800, 'easeInOutCubic');
			$j('.szukajka-bcg').animate({ right: '-280' }, 800, 'easeInOutCubic');
			$j('.uslugowe-button').animate({ right: '25' }, 800, 'easeInOutCubic');
		},
		function(){
			$j('.toggler-mapa').animate({
				right: '180'
			}, 600, 'easeOutCubic');
			
			$j('.toggler-mapa').html('Przybliż widok <img src="./.img/toggler-mapa-przybliz.gif" width="8" height="6" alt="&gt;" border="0" />'); 
			
			$j('.mapa-lokalizacja').animate({ left: '980' }, 300, 'easeInOutCubic');
			
			$j('#galeria-zdjec').animate({opacity: 1.0}, 400, 'easeInOutCubic');
			$j('#lokalizacja').html('Mapa okolicy'); 
			
			$j('.button-orange').css('z-index', '52');
			
			$j('.toggler').animate({ right: '239px' }, 600, 'easeInOutCubic');

			$j('.szukajka').animate({ right: '0' }, 600, 'easeOutCubic');
			$j('.orange-bar').animate({ right: '280' }, 600, 'easeOutCubic');
			$j('.szukajka-bcg').animate({ right: '0' }, 600, 'easeOutCubic');
			$j('.uslugowe-button').animate({ right: '303' }, 600, 'easeOutCubic');
	});
	
	
	
	$j('#ap1, #ap2, #ap3, #ap4, #ap5').css({"top" : "-120px", "opacity" : 0});
	
	$j('.apartamenty-button').click(function(){
		$j('#ap1, #ap2, #ap3, #ap4, #ap5').animate({ top : '0px', opacity: 1.0 }, 800, "easeOutBack");
	});
	
	$j('button.jqTransformButton').hover(function(){ 
			$j(this).find('span').css("text-decoration", "none");						 
		}, function(){ 
			$j(this).find('span').css("text-decoration", "underline");						 
	});
	
	$j('.etap1, .etap2').each(function(){
		$j(this).hover(function(){ 
				$j(this).stop().animate({backgroundPosition: '0 -60px'}, 200, "easeOutQuad"); 
			}, function(){
				$j(this).stop().animate({backgroundPosition: '0 0'}, 100, "easeInQuad"); 
		});
	});
	
	$j('.apartamenty-button').hover(function(){ 
			$j(this).fadeTo(100, 1.0);
			$j(this).animate({left: '0'}, 400, "easeOutQuad"); 
		}, function(){ 
			$j(this).fadeTo(100, 0.9);
			$j(this).animate({left: '-10'}, 200, "easeInQuad"); 
	});
	
	$j('#aktualnosc-image').find('img').css({'width' : '55px', 'height' : '55px'});
	
});

