/* Custom easing */

$.easing.easeOutQuint = function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	};
	
/* Ticker */
	
(function($){
  $.fn.list_ticker = function(options){
    
    var defaults = {
      speed:8000
    };
    
    var options = $.extend(defaults, options);
    
    return this.each(function(){
      
      var obj = $(this);
      var list = obj.children();
      list.not(':first').hide();
      
      setInterval(function(){
        
        list = obj.children();
        list.not(':first').hide();
        
        var first_li = list.eq(0)
        var second_li = list.eq(1)
		
				first_li.fadeOut(function(){
				second_li.fadeIn();
				first_li.remove().appendTo(obj);
			});
      }, options.speed)
    });
  };
})(jQuery);


/* Jump menu */

$(function (){  
        $("#jump-menu").change(function(e) {
            window.location.href = $(this).val();
        });
    });



$().ready(function() {


	/* Intro slideshow and dot navigation */
	
	$("#slidenav").tabs(".slide.intro p", {

		effect: 'fade',
		fadeInSpeed: 500,
		fadeOutSpeed: 500,
		rotate: true,
		autoplay: true

	}).slideshow({autoplay: true, interval: 5000});
	
	
	/* Expanding kwicks-style accordion */
	
	$('#tabs').kwicks({
		min : 50,
		spacing : 0,
		isVertical : true,
		duration : 500,
		easing: 'easeOutQuint'
	});
	
	/* Tab hover panel switching */
	
	$("#tabs li.tab", this).hover(
    function() {
        $(".detail", this).show();
        $("#tabs h3").hide();
        $("h3", this).show();
        $("#tabs li.tab").addClass("inactive");
    },
    function() {
        $(".detail", this).hide();        
    }
	);
	
	$("#tabs").hover(
    function() { $(".slide.intro").fadeOut(500); },
    function() { $(".slide.intro").fadeIn(500); $("#tabs h3").show(); $("#tabs li.tab").removeClass("inactive");  }
	);
	
	$("#tabs li.block1").hover(
    function() { $(".slide.block1").fadeIn(500); },
    function() { $(".slide.block1").fadeOut(500);  }
	);
	
	$("#tabs li.block2").hover(
    function() { $(".slide.block2").fadeIn(500); },
    function() { $(".slide.block2").fadeOut(500); }
	);
	
	$("#tabs li.block3").hover(
    function() { $(".slide.block3").fadeIn(500); },
    function() { $(".slide.block3").fadeOut(500); }
	);
	
	$("#tabs li.block4").hover(
    function() { $(".slide.block4").fadeIn(500); },
    function() { $(".slide.block4").fadeOut(500); }
	);
	
	$("#tabs li.block5").hover(
    function() { $(".slide.block5").fadeIn(500); },
    function() { $(".slide.block5").fadeOut(500); }
	);
	
	
	/* Fading ticker */
	
	$('.ticker').list_ticker();

		
});
