// JavaScript Document
function calculateTimeout(currSlide, nextSlide, options, isForward) {
  var index = options.currSlide;
  if (index == 0) {
    return 5500;
  } else {
    return 4500;
  }
};

$.fn.cycle.transitions.eftpos = function($cont, $slides, opts) {
        $cont.css('overflow','hidden');
        opts.before.push($.fn.cycle.commonReset);
        var w = $cont.width();
        opts.cssBefore = {left: 267, opacity: 0};
        opts.animIn = {left: 0, opacity: 1};
        opts.animOut = {left: -267, opacity: 0};
        opts.cssAfter = {left: -w}
};
$(document).ready(function() {
	$('#slider-wrapper').cycle({
		fx: 'eftpos',
		speed: 750,
    delay: 3000,
    prev: "#previous",
    next: "#next",
    easing: 'jswing',
    pager:  '#legend-items',
    activePagerClass: 'active',
    animIn: {opacity: 1},
    animOut: {opacity: 0},
    pagerAnchorBuilder: function(idx, slide) { return '<li><a id="'+ slide.id +'" href="#"></a></li>'; },
	  timeoutFn: calculateTimeout
    }); 

    //slider hover
    $("#a-feature-slider-tt").mouseenter(function(){
        $("#a-feature-slider-tt #controls div").stop().animate({
           opacity: 0.3
        });
    });

    $("#a-feature-slider-tt").mouseleave(function(){
        $("#a-feature-slider-tt #controls div").stop().animate({
           opacity: 0 
        });
    });

    //link hover
    $("#a-feature-slider-tt #controls div").hover(
      function () {
        $(this).stop().animate({ opacity: 0.8 });
      },  
      function () { 
        $(this).stop().animate({ opacity: 0.3 });
      }
    );
});



