$(document).ready(function() {
  
      	$("a[rel=portfolio]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				                  return '<span id="fancybox-title-over">Projekt ' + (currentIndex + 1) + ' z ' + currentArray.length + (title.length ? ' &nbsp; &nbsp; ' + title : '') + '</span>';
			}
		});
				
    	$("#wyslij_mail").fancybox({
    		'width'				: 450,
    		'height'			: 600,
            'autoScale'     	: false,
            'transitionIn'		: 'none',
    		'transitionOut'		: 'none',
    		'type'				: 'iframe'
    	});

			
        
        //Rozwijane menu
        $('ul#lista_menu li').children('h2').click(function(){
            $(this).next('p').show('fast');
            $('ul#lista_menu li h2').not(this).next('p:visible').hide('fast');
        });
  
 });
      
      $(window).load(function(){
      	//for each description div...
      	$('div.description').each(function(){
      		//...set the opacity to 0...
      		$(this).css('opacity', 0);
      		//..set width same as the image...
      		$(this).css('width', $(this).siblings('img').width());
      		//...get the parent (the wrapper) and set it's width same as the image width... '
      		$(this).parent().css('width', $(this).siblings('img').width());
      		//...set the display to block
      		$(this).css('display', 'block');
      	});
      	
      	$('.project a').hover(function(){
      		//when mouse hover over the wrapper div
      		//get it's children elements with class descriptio
      		//and show it using fadeTo
      		$(this).children('.description').stop().fadeTo(200, 1.0);
      	},function(){
      		//when mouse out of the wrapper div
      		//use fadeTo to hide the div
      		$(this).children('.description').stop().fadeTo(800, 0);
      	});
      	
      });

