// JavaScript Document

$(document).ready(function()
{
    //give a number to all pictures
    $('#nav_list li a').each(function(i) 
    {
      $(this).addClass(""+i);
    });
    
    $("#nav_list a:first").attr("id","selitem_gal");

    //Create easing equation
    jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
    	return -c * ((t=t/d-1)*t*t*t - 1) + b;
      };
    
    //Create scroller  
    $('#nav').serialScroll({
		items:'li',
	
		offset:-289, //when scrolling to photo, stop 230 before reaching it (from the left)
		start:0, //as we are centering it, start at the 2nd
		duration:1200,
		force:true,
		stop:true,
		lock:false,
		next:'a.next',
		prev:'a.prev',
		
		cycle:false, //don't pull back once you reach the end
		easing:'easeOutQuart', //use this easing equation for a funny effect
		jump: true //click on the images to scroll to them
	});

  //create slideshow
  $('#big_picture').cycle({ 
          fx:     'fade', 
          speed:  'slow', 
          timeout: 0, 
          prev:'a.prev',
          pause:1,    
	       	next:'a.next',
          pager:  '#nav_hide', 
          pagerAnchorBuilder: function(idx, slide) { 
              // return selector string for existing anchor 
              return '#nav_hide li:eq(' + idx + ') a'; 
          },
          prevNextClick: function(isNext, zeroBasedSlideIndex, slideElement) 
          {
            $('a#selitem_gal').attr("id","");
            $('#nav_list li:eq('+zeroBasedSlideIndex+') a').attr("id","selitem_gal");
          }
          
      });

//create page to command slideshow
$('#nav_list li a').click(function() 
{
  
  var nom_class=$(this).attr('class');
  
  $("a#selitem_gal").attr("id","");
  $(this).attr("id","selitem_gal");
  $('#nav_hide li:eq('+nom_class+') a').trigger('click');
});

//create pretty photo
//$('#big_picture a').flyout();

});

