 $(document).ready(function() {
  $("li:first-child").addClass("first_item");
  $("li:last-child").addClass("last_item");
  $("#sequence").simplestSlideShow({'timeOut': 5000});
  $("#sequential img:gt(0)").hide();
  	$("#projectnav ul li a").not("a[href$='.pdf']").click(function(e){
			$("#projectnav ul li").removeClass('active');
  			$(this).parent('li').addClass('active');
  			$("#sequential img").fadeOut();
  			$("img[src='"+$(this).attr('href')+"']").fadeIn();
  			e.preventDefault();
  	});
 });
 
 (function($){
 $.fn.randomize= function() {
          return $(this).each(function(f){
                var $elem = $(this);
                var $items = $elem.children();
                $items.sort(function(a,b){
                      var temp = parseInt( Math.random()*10 );
                      var isOddOrEven = temp%2;
                      var isPosOrNeg = temp>5 ? 1 : -1;
                      return( isOddOrEven*isPosOrNeg );
                })
                .appendTo($elem);            
          });
    };
    })(jQuery);
    
(function($){
  $.fn.simplestSlideShow = function(settings){
    var config = {
      'timeOut': 3000,
      'speed': 'normal'
    };
    if (settings) $.extend(config, settings);
    this.each(function(){
      var $elem = $(this);
      $elem.children(':gt(0)').hide();
      setInterval(function(){
        $elem.children().eq(0).fadeOut(config['speed'])
        .next().fadeIn(config['speed'])
        .end().appendTo($elem);
      }, config['timeOut']);
    });
    return this;
  };
})(jQuery);
