            
/* ================================================================ 
This copyright notice must be untouched at all times.
Copyright (c) 2009 Stu Nicholls - stunicholls.com - all rights reserved.
=================================================================== */

$(document).ready(function() {
  current = 5;
  button = 1;
  images = 5;
  width = 600;

  $("#buttons li").mouseover(function() {
    button = current;
    overButton = $(this).attr('id');
    current = parseInt(overButton.slice(1));
    if (current > button) { animateLeft(current, button) }
    if (current < button) { animateRight(current, button) }
  });
		
  function animateLeft(current, button) {
    $('#p' + current).css("left", width + "px");
    $('#p' + current).animate({ "left": "0px" }, 400, "swing");
    $('#p' + button).animate({ "left": -width + "px" }, 400, "swing");
    setbutton()
  }

  function animateRight(current, button) {
    $('#p' + current).css("left", -width + "px");
    $('#p' + current).animate({ "left": "0px" }, 400, "swing");
    $('#p' + button).animate({ "left": width + "px" }, 400, "swing");
    setbutton()
  }

});
