   jQuery.easing.easeOutBounce = function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	};
	
	jQuery.extend( jQuery.easing,
         {easeOutExpo: function (x, t, b, c, d) {return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;}}
    );

  // Cycle Plugin nav controler
  function onAfter(curr, next, opts) {
    var index = opts.currSlide;
    $('#prev')[index == 0 ? 'hide' : 'show']();
    $('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
  }

  $(function () {

     // Happens when page load
     $(window).load(function() {
          $('#loading').hide(); 
          $('#inner').animate({opacity:'1'},{queue:false,duration:1000}); 
                    
          $('#menu p.01').animate({ top:'-5px'},1400, 'easeOutBounce');
          $('#menu p.02').animate({ top:'-5px'},1600, 'easeOutBounce');
          $('#menu p.03').animate({ top:'-5px'},1800, 'easeOutBounce');
          $('#menu p.04').animate({ top:'-5px'},2000, 'easeOutBounce');
          $('#menu p.05').animate({ top:'-5px'},2200, 'easeOutBounce');
          $('#menu p.06').animate({ top:'-5px'},2400, 'easeOutBounce');
                    
         $('.bp').click(function(){ 
          setTimeout(
            function(){
               $('.hide_detail').fadeIn();
            }, 1000);
          });

          $('.bp2').click(function(){
             $('.bp').fadeIn(500);
          });

          setTimeout(
            function(){
             $('img.front').fadeIn(3000);
            }, 1000);

          setTimeout(
            function(){
             $('img.jbs').animate({opacity:'1'},{queue:false,duration:2000});
            }, 1000);
            
          setTimeout(
            function(){
             $('img.ascot2').animate({opacity:'0.6'},{queue:false,duration:2000});
            }, 2000);

     });
                       
     // Menu Hover Action
     $('#menu img.m01').hover(function(){
          $('#menu_text p.01').show();
          }, function(){
          $('#menu_text p.01').hide();
     });
     $('#menu img.m02').hover(function(){
          $('#menu_text p.02').show();
          }, function(){
          $('#menu_text p.02').hide();
     });
     $('#menu img.m03').hover(function(){
          $('#menu_text p.03').show();
          }, function(){
          $('#menu_text p.03').hide();
     });
     $('#menu img.m04').hover(function(){
          $('#menu_text p.04').show();
          }, function(){
          $('#menu_text p.04').hide();
     });
     $('#menu img.m05').hover(function(){
          $('#menu_text p.05').show();
          }, function(){
          $('#menu_text p.05').hide();
     });
     $('#menu img.m06').hover(function(){
          $('#menu_text p.06').show();
          }, function(){
          $('#menu_text p.06').hide();
     });

     // Jacket Page Background
     $('div#p1_1').click(function(){
          $(this).fadeOut(500);
     });
     $('div#p2_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p3_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p5_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p6_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p7_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p8_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p9_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p11_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p12_1').click(function(){
          $(this).fadeOut(1000);
     });
     $('div#p13_1').click(function(){
          $(this).fadeOut(1000);
     });

     $('.div_right a img').hover(function(){
          $(this).css({opacity:'0.6'});
          }, function(){
          $(this).css({opacity:'1'});
     });

     $('.bp').hover(function(){
          $('.bp img.details').animate({ left:'20px'},300, 'easeOutBounce');
          }, function(){
          $('.bp img.details').animate({left:'0px'},300, 'easeOutBounce');
     });

         $('img.detail').hide();
         $('.bp').hover(function(){
          $('img.detail').show();
          $('img.detail').stop(true, true).animate({ top:'20px'},300, 'easeOutBounce');
          }, function(){
          $('img.detail').stop(true, true).animate({top:'35px'},300, 'easeOutBounce');
          $('img.detail').fadeOut();

     });

     // JQ Cycle Plugin
     
     $('.front_img').cycle({
        fx : 'fade', 
     	nowrap : 1,
     	speed : 1000, 
     	delay : 1000,
        timeout : 2000
     });
     
     $('.pics').cycle({
        fx : 'fade', 
        speed : 500, 
        prev :'#prev',
        next : '#next',
        timeout : 0, 
        after: onAfter, 
        pager : '#nav',
        pagerAnchorBuilder:function (idx, slide){
            // return sel string for existing anchor            
            return '#nav li:eq(' + (idx) + ') a';
        }
     });
     
       // Image Popups
     $(".popup").fancybox({
        'titleShow' : true,
        'overlayOpacity' : 0.5, 
        'overlayColor' : '#000', 
        'padding' : 0, 
        'autoScale' : true, 
        'scrolling' : 'no' 
     });
     
                    
  });
