/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
(function(){
    $.fn.extend({
        RubenMenu: function(options){

            var defaults = {
                xOff: 1,
                yOff: 1
            };

            options = $.extend(defaults,options);


            return $(this).each(function(){

                $(this).mouseenter(function(){
                    $(this).find('.btn_bg_img').each(function(){
                        //zmieniamy polozenie obrazka o offset
                        var left = parseInt($(this).css('left'));
                        var top = parseInt($(this).css('top'));

                        $(this).css({
//                            'left': left-options.xOff+'px',
                            'top' : top+options.yOff+'px'
                        });

                        //oraz jego rozmiar o tyle samo
                        var width  = parseInt($('.btn_bg_img img').css('width'));
                        var height = parseInt($('.btn_bg_img img').css('height'));
                        $(this).find('img').each(function(){
                            $(this).css({
                               'width': width-options.xOff,
                               'height': width-options.yOff
                            });
                        });
                    });
                    $(this).find('.menu_descr').each(function(){
                       $(this).css({'color':'#C29F75'});
                    });
                });
                $(this).mouseleave(function(){
                    // analogicznie jak w/w funkcji, tylko z powrotem
                    $(this).find('.btn_bg_img').each(function(){
                        var left = parseInt($(this).css('left'));
                        var top = parseInt($(this).css('top'));

                        $(this).css({
//                            'left': left+options.xOff+'px',
                            'top' : top-options.yOff+'px'
                        });

                        var width  = parseInt($('.btn_bg_img img').css('width'));
                        var height = parseInt($('.btn_bg_img img').css('height'));
                        $(this).find('img').each(function(){
                            $(this).css({
                               'width': width+options.xOff,
                               'height': width+options.yOff
                            });
                        });
                    });
                    $(this).find('.menu_descr').each(function(){
                       $(this).css({'color':'#FFF'});
                    });
                });
            })
        }
    })
})(jQuery);


