/* PLUGIN DIRECTORY
What you can find in this file [listed in order they appear]

    1.) Console log wrapper by Paul Irish - paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
    2.) Fade on MouseOver
    3.) FadeGallery - http://www.exalted-web.com/fadegallery/

*/

// 1.) Console log wrapper by Paul Irish - paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console) {
    arguments.callee = arguments.callee.caller;
    var newarr = [].slice.call(arguments);
    (typeof console.log === 'object' ? log.apply.call(console.log, console, newarr) : console.log.apply(console, newarr));
  }
};

// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try
{console.log();return window.console;}catch(err){return window.console={};}})());



// 2.) Fade on MouseOver
(function($) {
  $.fn.fadeOnMouseOver = function() {
  
    this.hover(
        // ON MOUSE OVER, SET OPACITY TO 100%
        function () {
            $(this).stop().animate({opacity: 0.5}, "normal");
        },
        // ON MOUSE OUT SET OPACITY BACK TO 50%
        function () {
            $(this).stop().animate({opacity: 1.0}, "normal");
        }
    );

  };
})( jQuery );


// 3.) FadeGallery
/**
 * jQuery plugin: FadeGallery
 * http://www.exalted-web.com/fadegallery/
 *
 * Written by Shay from http://www.exalted-web.com
 * Release date: 28/02/2010
 * Version: 0.2
 *
 * Licensed under the GNU GPL license.
 * http://www.gnu.org/licenses/gpl.txt
 */
(function($) {
    $.fn.gallery = function(options) {
        
        var defaults = {
            FadeIn      : 1000,
            FadeOut     : 1000,
            Delay       : 2000,
            Repeat      : true
        };
        var options = $.extend(defaults, options);
        
        return this.each(function() {
            var elements = $(this).children().filter(".galItem");
            
            elements.hide();
            elements.eq(0).show();
            
            var next_item = 1;
            var hide_item = 0;
            var t = setTimeout(Fade, options.Delay);
            
            function Fade() {
                t = clearTimeout();
                
                if(next_item >= elements.length) {
                    if(!options.Repeat) {
                        return false;
                    }
                    next_item = 0;
                    hide_item = elements.length - 1;
                }
                
                elements.eq(hide_item).fadeOut(options.FadeOut, function callback() {
                    elements.eq(next_item).fadeIn(options.FadeIn, function callback() {
                        hide_item = next_item;
                        next_item++;
                        if(options.Repeat || next_item < elements.length) {
                            t = setTimeout(Fade, options.Delay);
                        }
                    });
                });
            }
            
        });
        
    };
})(jQuery);

