/*
 * e-safeguard menu slider
 * author: Patryk Hańćkowiak
 * e-mail: patryk.hanckowiak@e-safeguard.pl
 * www: http://www.e-safeguard.pl/
 */
$(
	function(){
		ESafeguardMenuSlider.init();
		
		
		
		
		
	}
);

// Define main menu slider object
var ESafeguardMenuSlider = {
			menu_wrapper_el: null,
			menu_el: null,
			menu_button_el: null,
			menu_descr_link_els: null,
			is_menu_visible: false,
			menu_width: 160,			
			// initialize events
			init: function(){
				// Initialize menu wrapper container el
				this.menu_wrapper_el = $('.fixedmenuleft' );
				// Initialize menu main container el
				this.menu_el = $('.fixedmenuleft #fixedmenu' );
				// Initialize menu button container el
				this.menu_button_el = $('.fixedmenuleft #fixedmenu_button' );
				// Initialize menu description link els
				this.menu_descr_link_els = $('.fixedmenuleft #fixedmenu li ul li a' );
								
				// Attach show event handler to menu button
				this.menu_button_el.mouseenter(
					function( es_menu_slider_obj ){
						return function(){
							es_menu_slider_obj.showMenu();
						}
					}(this)
				)
				
				// Attach hide event handler to main menu container
				this.menu_el.mouseleave(
					function( es_menu_slider_obj ){
						return function(){
							es_menu_slider_obj.hideMenu();
						}
					}(this)
				)
				
				// Disable descr menu links
				this.menu_descr_link_els.click(
					function(){
						return false;
					}
				)
				
				
				
			},
			// Hide menu event function
			hideMenu: function(){
				this.menu_wrapper_el.animate({
				    left: '-' + this.menu_width + 'px',
				   
				  }, "slow", function() {
				    // Animation complete.
				  });
				  
			},
			// Show menu event function
			showMenu: function(){
				//this.menu_el.show("slow");
				
				this.menu_wrapper_el.animate({
				    left: '0px',
				   
				  }, "slow", function() {
				    // Animation complete.
				  });
				  
				
			}
			
						
		}
