						   
$(document).ready(function() {
	// Muestra y oculta los menús
	$('ul.menuIdioma li:has(ul)').hover(
		function(e)
		{
			$(this).find('ul').slideDown();
		},
		function(e)
		{
			$(this).find('ul').slideUp();
		}
	);
	
	// Altura de las páginas
	$(".contenedor").height(function() {
		// If the value is less than 7, add a red border
		if ($(this).height() < 500) {
				//$(this).css("border", "5px solid red");
					$('.contenedor') .css({'height': (($(window).height()) - 220)+'px'});
						$(window).resize(function(){
					    $('.contenedor') .css({'height': (($(window).height()) - 0)+'px'});
					});	
		}
		// Else if the value is greater than 7, add an orange border
		else if($(this).height() > 700) {
		   // $('.contenedor').css({'height', 'auto'});
		}
		
	});
	
	// Alto de la página Home

	$(".contenedorHome").height(function() {
		if ($(this).height() < 600) {
					$('.contenedorHome') .css({'height': (($(window).height()) - 500)+'px'});
						$(window).resize(function(){
					    $('.contenedorHome') .css({'height': (($(window).height()) - 500)+'px'});
					});	
		}
		else if($(this).height() > 600) {
		}
	});


	// Buscador ejemplos de prevencion
		
	//$('.menuitemPrevencion img').animate({width: 100}, 0);
	//$('.menuitemPrevencion').mouseover(function(){
	//		gridimage = $(this).find('span').show();
	//		gridimage = $(this).find('img');
	//		gridimage.stop().animate({width: 100}, 150);
	//	}).mouseout(function(){
	//		gridimage = $(this).find('span').hide();
	//		$('.menuitemPrevencion span').hide();
	//		gridimage.stop().animate({width: 100}, 150);
	//});
	$('#desplegar').click(function() {
		$('#buscInvisible').slideToggle('slow', function() {
		// Animation complete.
		});
	});

	$('#ocultar').click(function () {
        $('#buscInvisible').slideToggle('slow', function() {
		// Animation complete.
		});
    });
    
  	var selectedOptions = $('#buscInvisible option:selected');

    var tienenContenido = false;

    $.each(selectedOptions, function (key, value) {
        if ($(value).val() != "")
            tienenContenido = true;
    });

    if (!tienenContenido)
        $('#buscInvisible').hide();
});



