// JavaScript Document
$j(function() {

    // Effect buttons
    $j(".effect-button").each( function(){ $j(this).etpButtonHover("effect-button-hover"); });

    // Main menu - Superfish
    $j("ul.drop-down").superfish();

    // Tabs
    $j(".tabs").each(function(){ $j(this).tabs(); });
    $j("#tabs").tabs();

    $j(".layout-section").each(function() { $j(this).equalHeight(".section .equal-height", 0); });

});


(function($) {

    // Must define image height for webkit-browsers
    $.fn.equalHeight = function(outer, extra) {
        var highest = [];
        $(outer, $(this)).each(function() { highest.push($(this).outerHeight()); });

        var curMaxHeight = Array.max(highest);
        $(outer, $(this)).each(function() { $(this).height(curMaxHeight + extra); });
    }

    // http://muzso.hu/2008/03/07/logging-to-the-firebug-console-in-jquery
    $.fn.log = function(msg) { try { console.log("%s: %o", msg, this); } catch (e) { } return this; };

    // Function to get the Max value in Array - http://ejohn.org/blog/fast-javascript-maxmin/
    Array.max = function(array) { return Math.max.apply(Math, array); };

    // Function to get the Min value in Array - http://ejohn.org/blog/fast-javascript-maxmin/
    Array.min = function(array) { return Math.min.apply(Math, array); };


})($j);
