/**
 * jQuery showbox plugin
 * 
 * @name jquery-showbox-0.9.js
 * @author Antea Studio - http://www.anteastudio.com
 * @version 0.9
 * @date January 05, 2011
 * @category jQuery plugin
 * @copyright (c) 2011 Antea Studio - http://www.anteastudio.com
 * @license http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 */
(function($){

$.fn.showbox = function(box, params) {

    params = $.extend({
        event:    'mouseenter',   //event that shows the box (click, mouseover, mouseenter)
        /* effect:   'show',         //effect used to display the box (show, fadeIn, slideDown) [next-release] */
        duration: 'fast',         //duration of show effect (milliseconds, fast, slow )
        delay:    '1500',         //milliseconds before to hide the box
        callback: function(){}    //callback to show effect
    }, params);
  
    return this.each(function(){
        var t = $(this),
            p = params;

        $(t)
            .bind(p.event, function(){ $(box).fadeIn() })
            .bind('mouseleave', function(){ $(box).fadeOut() });

        $(box)
            .hide()
            .bind('mouseenter', function(){ $(box).show() })
            .bind('mouseleave', function(){ $(box).delay(p.delay).fadeOut() })
            //IE8 and lower doesn't support mouseover on select>option
            .find('select').bind('change', function(){ $(box).stop(true,true) })
            //FF hides box on select>option mouseenter
            .find('option').bind('mouseenter mouseover', function(){ $(box).stop(true,true) })
    });
};

}(jQuery));
