var call = 0;
function initJumper()
{
    var curPos      = 0;
    var totalPanels = $(".jumpToList").size();
    
    $("#jumpToSlider").css("marginLeft", "0px");
    $("#jumpToSlider").css("width", totalPanels*415+"px");
    function change(direction) 
    {
            call = call + 1;
            if (direction)
            {
                if (curPos < (totalPanels -1))
                {
                    curPos++;

                    var leftValue = $("#jumpToSlider").css("marginLeft");
                    var movement  = parseFloat(leftValue, 10) - 415 + "px";
                    
                    $("#jumpToSlider")
                        .stop()
                        .animate({
                            marginLeft: movement
                        }, 1000);
                }
            }
            else
            {       
                if (curPos > 0)
                {
                    curPos--;

                    var leftValue = $("#jumpToSlider").css("marginLeft");
                    var movement  = parseFloat(leftValue, 10) + 415 + "px";
                    
                    $("#jumpToSlider")
                        .stop()
                        .animate({
                            marginLeft: movement
                        }, 1000);
                }
            }
    }
        
    //when the left/right arrows are clicked
      $(".right").click(function(){ change(true); }); 
      $(".left").click(function(){ change(false); });
   
    $(window).keydown(function(event)
    {
      switch (event.keyCode) 
      {
            case 37: //left arrow
                $(".left").click();
                break;
            case 39: //right arrow
                $(".right").click();
                break;
      }
    });
};
