
$(document).ready(function(){
    
	$('#dnegocio li').hover( function() {
		$(this).find('div:first').css({visibility: "visible", display: "none"}).stop(true, true).delay(100).fadeIn("fast");
	}, function() {
		$(this).find('div:first').stop(true, true).delay(100).fadeOut("fast");
	});
	
	$('#actividades li').hover( function() {
		$(this).find('div:first').css({visibility: "visible", display: "none"}).stop(true, true).delay(100).fadeIn("fast");
	}, function() {
		$(this).find('div:first').stop(true, true).delay(100).fadeOut("fast");
	});
    

	$("div.bo").hide();
		
	$('.cajalistab ul li a').click(function() {
		if ($(this).attr("name") == 'click') $this.click();
		else {
			$('.cajalistab ul li a').removeClass("ui-tabs-selected");
			$("div.bo").hide();
			var urlImg = $(this).attr("urlImg");
			if (urlImg) $("#flash img")[0].src = urlImg;
			var bloque = $(this).attr("href");
			if ($(bloque).length == 0) {
				$('.tabs_cont').append('<div id="'+bloque.substr(1)+'" class="bo"/>');
			}
			$(bloque).fadeIn();
			if ( $(this).attr("name").indexOf('pagina') != -1 ) {
				$(bloque).load($(this).attr("id"), function(resp, stat, xhr) {
					if (window.postProceso) postProceso();
				});
			}
			if ( $(this).attr("name").indexOf('submenu') != -1 ) {
				$(this).parent().find('ul').slideToggle();
			}
			$(this).addClass("ui-tabs-selected");
			return true;	
		}
	});
	
	if ((this.location.hash != null) && (this.location.hash != "")) {
		//$(this.location.hash + "_m").click();
		$('a[href="'+this.location.hash+'"]').click();
	}
	else {
		$("div.bo2").show();
	}

}); 
  
// Ocula o muestra una capa
function muestra( id ) {
	$(id).slideToggle();
}

function cambiaIdioma(idioma) {
	var auxHref = document.location.pathname;
	if (auxHref.indexOf("/" + idioma + "/") == 0) return false;
	var ind = auxHref.indexOf("/",1);
	document.location.href = "/" + idioma + "/" + auxHref.substr(ind + 1) + document.location.hash;
	return false;
}

/*
$("#dnegocio li").hover(
      function () {
        $(this).find("div:first").fadeIn("fast");
     }, 
      function () {
        $(this).find("div:first").fadeOut("fast");
      }
    ); */
