// v2.1 - victor malca
// menu desplegable para todos los sites
$(document).ready(function()
{
	$('.WEB_CONTE_menuSuperior li')
	.filter(
		function()
		{
			if($(this).children().hasClass('WEB_CONTE_menuSuperiorListado'))
			{
				var qty_cols = $(this).children().children('.WEB_CONTE_menuSuperiorColumna').length;
				
				if($(this).children('.WEB_CONTE_menuSuperiorListado').width() < 200)
				{
					$(this).children('.WEB_CONTE_menuSuperiorListado')
					.css(
						'width',
						$(this).children('.WEB_CONTE_menuSuperiorListado').width() * qty_cols + 'px'
					);
				}
				else
				{
					$(this).children('.WEB_CONTE_menuSuperiorListado')
					.css(
						'width',
						$(this).children('.WEB_CONTE_menuSuperiorListado').width() + 'px'
					);
				}
				

				$(this)
				.bind(
					'mouseenter mouseleave', 
					function(e)
					{
						if(e.type=='mouseenter')
						{
							$(this).children('div').css('top', $(this).offset().top + $(this).height() + 'px');
							if($(this).children().hasClass('posIzq'))
							{
								$(this).children('div').css('left', $(this).offset().left + 'px');
							}
							else
							{
								$(this).children('div').css('left', $(this).offset().left - $(this).children('div').width() + $(this).width() + 'px');
							}
							
							$(this).children('div').show();
							$(this).children('span').addClass('menu-selected');
							$(this).children('a').addClass('menu-selected');
						}
						if(e.type=='mouseleave') 
						{
							$(this).children('div').hide();
							$(this).children('span').removeClass('menu-selected');
							$(this).children('a').removeClass('menu-selected');
						}
					}
				);

			}
			
		}
	);


});

