    $(document).ready(function(){
        var fade_portfolio=0.5;
        var fade_speed=400;
        
        if($.browser.msie) 
        {
          fade_speed=0;
          fade_portfolio=0.2;
        }
    
      	$("a.zoom[rel=galeria]").fancybox({  
      		'titleShow'     : true,
      		'transitionIn'	: 'elastic',
      		'transitionOut'	: 'elastic',
      		'speedIn'      : 700,     
      		'speedOut'      : 600,              		
      		'easingIn'      : 'easeOutBack',
      		'easingOut'     : 'easeInBack',
      		'titlePosition' 	: 'inside'  		
      	});
      	
      	
      	$("a.zoom").css('opacity','0');
      	$("a.link").css('opacity','0');
      	$("div.frame").animate({ top: "0px"}, 0);      	
      	
        $("div.portfolio").hover(function(){                                                        
        			jQuery(this).stop(true, true)
              .find('a.zoom').stop(true, true).animate({opacity: 0.8}, 400).end()
        			.find('a.link').stop(true, true).animate({opacity: 0.8}, 400).end()
              .parent().stop(true, true).animate({opacity: fade_portfolio}, 400);
        		}, function(){  
        			jQuery(this).stop(true, true)
              .find('a.zoom').stop(true, true).animate({opacity: 0}, 400).end()
        			.find('a.link').stop(true, true).animate({opacity: 0}, 400).end()
              .parent().stop(true, true).animate({opacity: 1}, 400);
        		});  


        
        
        $("div.portfolio").hover(
          function () {
              $(this).parent().parent().stop().animate({ marginTop: "0px"}, 400);
          }, 
          function () {
              $(this).parent().parent().stop().animate({ marginTop: "15px"}, 300);
          }
        );   
         
      	
        $('ul#menu').lavaLamp();
                
        $("#menu a").hover(
          function () {
              $(this).stop().animate({ marginTop: "-15px"}, 400);
          }, 
          function () {
              $(this).stop().animate({ marginTop: "0px" });
          }
        ); 
        $('#rotator').flash({
          src: 'flash/piecemaker.swf',
          width: 960,
          height: 360,
          wmode: 'transparent'
        }, { version: 10 }
        
        );   
        
        
        $('#laptop').flash({
          src: 'flash/laptop.swf',
          width: 270,
          height: 175,
          wmode: 'transparent',
          update: false
        }, { version: 10 }
        
        );           
        
        
        $('textarea').autoResize({
            onResize : function() {
            },
            animateCallback : function() {
            },
            animateDuration : 300,
            extraSpace : 0
        });   

        
        $('.picon').tipsy({gravity: 's', offset: 10});  
        $('.oferta, .tip_up').tipsy({gravity: 'e',  fade: true, html: true, title: function (){ return $(this).prev().html(); } });    
        
      	$.waypoints.settings.scrollThrottle = 30;
        
        $('#sticky').waypoint(function(event, direction) {
      
      		$(this).parent().toggleClass('sticky', direction === "down");
      
      		event.stopPropagation();
              
      	});   
        
       /*         
       var $win = $(window);
       var top='first';
       var bottom='first';
       
       $win.scroll(function () {
           if ($win.scrollTop() == 0 && top=='first'){
              //woopraTracker.track("http://www.artgate.pl/portfolio_pl.html", "My Page Title Top");
              top='';
              //$.ajax({ url: document.location+"?top" });             
           }
           else if ($win.height() + $win.scrollTop() == $(document).height() && bottom=='first') {
              //woopraTracker.track("/my-url.html_bottom", "My Page Title Bottom");
              bottom=''; 
              //$.ajax({ url: document.location+"?bottom" });                
           }
       });
       
       $('#zapytanie').submit(function () {
       $(this)=$('#zapytanie'); $(this).attr('action', $(this).attr('action')+$(this).find('input[name=imie]').val()+' '+$(this).find('input[name=telefon]').val()+' '+$(this).find('input[name=mail]').val());  
       
       });
       */
            
    });
