$.fn.lavalamp = function(option)
{	
    /* option */
    option = jQuery.extend({
        startEl : '',
        efectSpeed : 300,
        fadeSpeed : 300,
        helpEl : ''
    }, option);
    
    /* function */
    
    $(this).each(function(){
        $(this).css('position', 'relative').append('<li id="lavaBox">'+ option.helpEl +'</li>');
        
        var lava = false;
        var dimension = {
            value: [],
            method: function(el){
                        this.value['x'] = $(el)[0].offsetWidth;
                        this.value['y'] = $(el)[0].offsetHeight; 
                        this.value['posX'] = $(el)[0].offsetLeft;
                        this.value['posY'] = $(el)[0].offsetTop;
                    }
        };
        if(option.startEl == '' || $(''+ option.startEl +'', this).size() == 0){
            $('#lavaBox', this).hide();
        }
        else{
            $(''+ option.startEl +'', this).each(function(){
                dimension.method($(this));
                $('#lavaBox').css({
                    'width' : dimension.value['x'],
                    'height': dimension.value['y'],
                    'left'  : dimension.value['posX'],
                    'top'   : dimension.value['posY']
                });    
            });
            lava = true;
        }
        
        $('li > label', this).bind('click', function(e){
           dimension.method($(this));
           if($('#lavaBox').is(':hidden') == false && lava == true){
           $('#lavaBox').stop();
                $('#lavaBox').animate({
                    'width' : dimension.value['x'],
                    'height': dimension.value['y'],
                    'left'  : dimension.value['posX'],
                    'top'   : dimension.value['posY']
                }, option.efectSpeed);    
           }
           else{
                $('#lavaBox').css({
                    'width' : dimension.value['x'],
                    'height': dimension.value['y'],
                    'left'  : dimension.value['posX'],
                    'top'   : dimension.value['posY']
                });
                $('#lavaBox').fadeIn(option.fadeSpeed, function(){lava=true});
            }
        });  
    });
};
