// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

$(document).ready(
    function()
	{
		//$('#banner-wrapper').css('overflow', 'hidden');
		$('#link02 a').toggle(
		  function()
		  {
		      $('#subnav ul').fadeIn('fast');
		  },
		  function()
          {
              $('#subnav ul').hide();
          }
		);
	}
);

switch($('body').attr('class')) {
	
	case 'intradoc-page':
       var startScroll = 2;
	   var intervalScroll = 0;  
       break;
	   
   case 'intrawork-page':
       var startScroll = 1;
	   var intervalScroll = 0;
       break;
	
	case 'intrabiz-page':
	   var intervalScroll = 0;
	   var startScroll = 0;
	   break;
	
	default:
	   var intervalScroll = 15000;
	   var startScroll = 0;
	   break;
}

jQuery(function( $ ){

    $('#focus').serialScroll({
        target:'#banner-wrapper',
        items:'.slideit', // Selector to the items ( relative to the matched elements, '#sections' in this case )
        prev:'div.focus-left a',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
        next:'div.focus-right a',// Selector to the 'next' button (absolute too)
        axis:'x',// The default is 'y' scroll on both ways
        duration:700,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
        force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
        start: startScroll,
		interval: intervalScroll,
		duration: 300,
		step: 1,
		easing: 'swing',
		
        onBefore:function( e, elem, $pane, $items, pos ){
            /**
             * 'this' is the triggered element 
             * e is the event object
             * elem is the element we'll be scrolling to
             * $pane is the element being scrolled
             * $items is the items collection at this moment
             * pos is the position of elem in the collection
             * if it returns false, the event will be ignored
             */
             //those arguments with a $ are jqueryfied, elem isn't.
            e.preventDefault();
            if( this.blur )
                this.blur();
        },
        onAfter:function( elem ){
            //'this' is the element being scrolled ($pane) not jqueryfied
        }
    });
    
});

