$(document).ready(function() {

	/* This is basic - uses default settings */	
	$(".lightbox").fancybox({
			'hideOnContentClick': true,
      'hideOnContentClick': true,
      'transitionIn'      : 'none',
      'transitionOut'     : 'none'
		});		
		
   $("a.organizer").fancybox({
        'width'             : 500,
        'height'            : '100%',
        'autoScale'         : false,
        'transitionIn'      : 'none',
        'transitionOut'     : 'none',
        'type'              : 'iframe'
    });		
		
	slide("#sliding-navigation", 12, 6, 0, 0);

  var $sel = $("[rel=fancybox-catalog]")
  $sel.fancybox({
    cyclic: true,
    titlePosition: 'over'
  });
  
});	

function slide(navigation_id, pad_out, pad_in, time, multiplier)
{
  /*
    navigation_id: This is the ID name of the navigation, which contains the elements the effect will be applied on.
    
    pad_out: This is the number of pixels to be padded left when one of the links inside the navigation is hovered.
    
    pad_in: This is the number of pixels to be padded left when one of the links inside the navigation is no longer being hovered.
    
    time: This represents the amount of time (in milliseconds) that takes for one of the link elements to slide in 
    and back in to place when the page is loaded.
    
    multiplier: The job of the multiplier is to increase or decrease the amount that takes the a following link element to 
    slide in to the screen. In other words, if the multiplier is 1, all link elements will slide in to the screen in 
    equal time intervals. However, if it is less than 0, the subsequent link elements will slide in faster, and if it is 
    more than 1 the opposite will happen.
    
  */
	// creates the target paths
	var list_elements = navigation_id + " li";
	var link_elements = list_elements + " a";

	// initiates the timer used for the sliding animation
	var timer = 0;

	// creates the slide animation for all list elements
  if(time>=1){
    $(list_elements).each(function(i)
    {
      // margin left = - ([width of element] + [total vertical padding of element])
      $(this).css("margin-left","-180px");
      // updates timer
      timer = (timer*multiplier + time);
      $(this).animate({ marginLeft: "0" }, timer);
      $(this).animate({ marginLeft: "15px" }, timer);
      $(this).animate({ marginLeft: "0" }, timer);
    });
  }
  
	// creates the hover-slide effect for all link elements
	$(link_elements).each(function(i)
	{
		$(this).hover(
		function()
		{
			$(this).animate({ paddingLeft: pad_out }, 150);
		},
		function()
		{
			$(this).animate({ paddingLeft: pad_in }, 150);
		});
	});
}

