jQuery(function( $ ){
   //borrowed from jQuery easing plugin
   //http://gsgd.co.uk/sandbox/jquery.easing.php
   $.easing.backout = function(x, t, b, c, d){
      var s=1.70158;
      return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
   };
   

   $('#banners #projects').cycle({ 
      fx: 'scrollHorz', 
      speed: 1500,
      timeout: 7000,
      //easing:'backout',
      delay: -500,
      pause: 1,
      cleartype:  1,
      cssBefore: { opacity: 0 },
      animOut: { opacity: 0 },
      animIn: { opacity: 1},
      next: '#banners .previous',
      prev: '#banners .next'
   });
   
   /* Global Navigation */
   $(".lavaLamp").lavaLamp({ 
     fx: "backout",
     speed: 700 
   }); 
   
   /* The Buzz about ICM */
   $('#quotes').cycle({ 
      fx: 'scrollVert', 
      speed: 500,
      timeout: 10000,
      delay: -5000,
      pause: 5,
      cleartype:  1,
      cssBefore: { opacity: 0 },
      animOut: { opacity: 0 },
      animIn: { opacity: 1 }
   }); 
   
    /* Flickr */
    $('.flickr #view').cycle({ 
      fx:     'wipe', 
      speed:   1500, 
      timeout: 6000, 
      pause:   2
   }); 

   if (location.hash) {var newHash = location.hash.substr(6);}

   /* Clients */
   $('#slideshow .single').cycle({ 
      fx:     'scrollVert', 
      speed:  700, 
      timeout: 15000, 
      cssBefore: { opacity: 0 },
      animOut: { opacity: 0 },
      animIn: { opacity: 1},
      pager:  '#featured_list',
      startingSlide: newHash-4,
     
    // callback fn that creates a thumbnail to use as pager anchor 
    //pagerAnchorBuilder: function(idx, slide) { 
        //return '<li><a href="#"><img src="' + slide.src + '" width="120" height="75" /></a></li>'; 
        
    pagerAnchorBuilder: function(idx, slide) { 
        // return selector string for existing anchor 
        return '#featured_list li:eq(' + idx + ') a';      
    } 
    });

    var query = new Object();
    window.location.search.replace(
    new RegExp( "([^?=&]+)(=([^&]*))?", 'g' ),
       function( $0, $1, $2, $3 ){
          query[ $1 ] = $3;
       }
    );
    easing = query['e'] || 'Expo';
   
    function loadEasing(e) {
       location.href = location.pathname+'?e='+e;
    }
   
    function setEasing(e) {
       loadLamps(e);
    }
});