$.fn.extend({
   shimmer: function(opts)
   {
       var template = $.fn.shimmer.template,
           options  = $.extend({}, $.fn.shimmer.defaults, (opts || {}));
           
           options.origleft = -options.width + 'px';
           options.origtop = 'bottom';
           options.maxleft  = options.width + 'px';
           options.maxtop = 'bottom';

       return this.each(function()
       {
           var $this = $(this);
     
           $this
           
            // Inject cloned <span>, and hide it
            .append(template.clone().css({
                backgroundPosition: options.origleft + ' ' + options.origtop
            }))
            
            .mouseover(function()
            {    
                $(this)
                    // Stop any running animations
                    .children('span').stop()
                    
                    // Set the background to the starting position
                    .css({
                        backgroundPosition: options.origleft + ' ' + options.origtop
                    })
                    
                    // Slide it to the ending position
                    .animate({
                       backgroundPosition: options.maxleft + ' ' + options.maxtop
                    }, {
                        duration: options.duration
                    });
            });
       })
   } 
});

$.fn.shimmer.defaults = {
    // Width of the background element (required)
    width: 173,
    
    // (optional)
    duration: 350
};

$.fn.shimmer.template = $('<span></span>');

$.fx.step.flank = function(fx)
{
    console.log(fx);
    
//    fx.elem.style.position = 'relative';
    
    if (fx.pos > 0.5)
    {
//        fx.elem.style.left = fx.now + fx.unit;
    }
    else 
    {
//        fx.elem.style.top = (fx.now/2) + fx.unit;  
    }

};



$(function() 
{
   /*
    * Corner elements
    */
   var tl = $('<div class="corner tl"></div>'),
       tr = tl.clone().removeClass('tl').addClass('tr');
       
   $('#header').append(tl).append(tr);
   
    
   /*
    * Equal height columns
    */
   $('#sidenav').css('height', $('#sidenav').parent().height() + 'px');
   
   if (typeof dp !== 'undefined')
   {
       //dp.SyntaxHighlighter.HighlightAll('code');
   }
   
   /*
    * Top Nav Animation
    */
   
   
   $('#top-nav li a').shimmer();
   
   
    
});

