// =======================================================================
// [File : behaviour.js]
//
// Project:      TFL LUIP
// Version:      1.0
// Created:      20/10/08
// Last change:  22/10/08
// Assigned to:  Diego Lago - diego.lago@webtechnologygroup.co.uk
// Primary use:  TFL website
//
// [Table of contents]
//
// 01. Animated Local Navigation
// 02. jQuery calls
//
// ==================================================================
// 01. Animated Local Navigation
// if JavaScript is enabled the list items of the local 
// navigation will slide on hover. 
// jQuery implementation
// ==================================================================
function slide(navigation_id, pad_out, pad_in, time, multiplier) {
  // creates the target paths
  var list_elements = navigation_id + ' li';

  // creates the hover-slide effect for all list elements 
  $(list_elements).each(function(i) {
    $(this).hover(
      function() {
        $(this).animate({ paddingLeft: pad_out }, 150);
      },
      function() {
        $(this).animate({ paddingLeft: pad_in }, 150);
      });
  });
}

// ==================================================================
// 02. jQuery calls
// ==================================================================
$(document).ready(function() {
  // call Animated Local Navigation
  $('#local-navigation ul li').addClass('sliding-element');
  slide('#local-navigation ul', 6, 0, 150, .8);

  // call Slideshow
  $('#slideshow').cycle({ 
    pause: 1,          // true to enable "pause on hover"
    autostop: 1,       // true to end slideshow based on autostopCount
    autostopCount: 13  // 3 images, 4 full loops + return to original image then autostopCount = 13
  }); 
});