/*
 * 	Button Style 1.0 - jQuery plugin
 *	written by Martin Mendez	
 *
 *	Copyright (c) 2011 Martin Mendez (http://www.smartproducciones.com.ar)
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */
 
 (function($){
 
    $.fn.extend({
         
        //pass the options variable to the function
        buttonStyle: function(options) {
 
 
            //Set the default values, use comma to separate the settings, example:
            var defaults = {
                imagenTopLeft: 'images/boton/top-left.png',
                imagenTopRight: 'images/boton/top-right.png',
                imagenBottomLeft: 'images/boton/bottom-left.png',
				imagenBottomRight: 'images/boton/bottom-right.png',
				imagenBase: 'images/boton/base.png'
            }
                 
            var options =  $.extend(defaults, options);
 
            return this.each(function() {
                var o = options;
				
				//Assign current element to variable, in this case is UL element
                var obj = $(this);  
                 
				 //Get all LI in the UL
                var items = $("li", obj);
				
                //code to be inserted here
                //you can access the value like this
				items.addClass('estylized');
				items.find('a').css({'background-image': 'url('+o.imagenBase+')'});
				items.prepend('<div class="latRight"><div class="topRight"></div><div class="bottomRight"></div>');
                items.prepend('<div class="latLeft"><div class="topLeft"></div><div class="bottomLeft"></div></div>');
				$('.topLeft').css({'background-image': 'url('+o.imagenTopLeft+')'});
				$('.bottomLeft').css({'background-image': 'url('+o.imagenBottomLeft+')'});
				
				$('.topRight').css({'background-image': 'url('+o.imagenTopRight+')'});
				$('.bottomRight').css({'background-image': 'url('+o.imagenBottomRight+')'});
             
			 	items.hover(
				function(){
					$(this).find('a').stop().animate({ 
							paddingTop:'20px',
							height:'30px'
							},300);
					$(this).stop().animate({ 
							height:'50px'
							},300);
					$(this).find('.latRight').stop().animate({ 
							height:'50px'
							},300);
					$(this).find('.latLeft').stop().animate({ 
							height:'50px'
							},300);
				},
				function(){
					$(this).find('a').stop().animate({ 
							paddingTop:'4px',
							height:'23px'
							},200);
					$(this).stop().animate({ 
							height:'27px'
							},200);
					$(this).find('.latRight').stop().animate({ 
							height:'27px'
							},200);
					$(this).find('.latLeft').stop().animate({ 
							height:'27px'
							},200);
				});
            });
        }
    });
     
})(jQuery);
