/*
	---------------------
	** REQUIRES jQuery **
	---------------------
	
	includes scripts to:
		+ add functionality to allow text boxes a default value that will be cleared on focus (ie. 'Search...')
		+ equalize the heights of elements matching the given selector rules

*/


var iomer = {
	searchDefault :		'Search...',	// default value for search boxes if initialized
	
	initSearchText : function (selector, defValue) {
		// example selectors to pass in: .searchText, .sf_searchText
		if (selector === '') return;
		defValue = defValue || iomer.searchDefault;
		
		$(selector).focus (function () {
			$(this).attr({value: ''});
		})
		.blur (function () {
			if ($(this).attr('value') == '') {
				$(this).attr({value: defValue});
			}
		})
		.attr({value: defValue});
    }
};

(function($) {
    $.fn.addFade = function(options) {
        var opts = $.extend({}, $.fn.addFade.defaults, options);
        return this.each(function() {
            var $this = $(this);

            var $span = $("<span class=\"fhover\"></span>").css("display", "none").prependTo($this);
            $this.children('a')
            .bind("mouseover", function() {
                $span.stop(true, true).fadeIn(opts.duration);
            })
            .bind("mouseout", function() {
                $span.stop(true, true).fadeOut(opts.duration);
            });
        });
    };
    $.fn.addFade.defaults = {
        duration: 'fast'
    };

    // to equalize the heights of a set of panels
    $.fn.equalizePanels = function() {
        var maxH = 0;
        return this.each(function() {
            var panelH = $(this).height();
            maxH = panelH > maxH ? panelH : maxH;
        }).height(maxH);
    }
})(jQuery);
