var ieVer=/*@cc_on function(){ switch(@_jscript_version){ case 1.0:return 3; case 3.0:return 4; case 5.0:return 5; case 5.1:return 5; case 5.5:return 5.5; case 5.6:return 6; case 5.7:return 7; }}()||@*/0;
var varOnload = window.onload;

	
function getFlash(){
	if(document.getElementById("flash")){
		oBox = document.getElementById("flash");
		flashName = ""+rutaFlash+oBox.getElementsByTagName("span")[0].id;
		fo = new FlashObject(flashName,"flash", "1007", "168", "7,0,19,0", "#EAEAE8");
		fo.write("flash");
	}
}


$(document).ready(function () {
	
	if (ieVer<=6) {
	window.onload = function(){
		//sfHover();
		eval(varOnload);
		getFlash();
	}	
	}else{
		window.onload = function(){
			eval(varOnload);
			getFlash();
		}
	}
	
	//getFlash();
	
    $("div.divContenedor").css("display","none");
    $("li.enlaceMenu a").mouseover(function(e){
    	$(this).parent().siblings().children("div.divContenedor").css("display","none");
    	$(this).next("div.divContenedor").fadeIn("normal");
    });
    $("li.enlaceMenu a").focus(function(e){
    	$(this).parent().siblings().children("div.divContenedor").css("display","none");
    	$(this).next("div.divContenedor").fadeIn("normal");
    });
    
    $(".destacado a, .fondoGris a, #middleBox a, #boton").focus(function(e){
    	$("div.divContenedor").css("display","none");
    	
    });
    
    $("*").filter("#flash, #middleBox, .fondoGris, #middleBoxXCM, #mainArea").mouseover(function(e){
    	$("div.divContenedor").css("display","none");
    });
    
    
    /*Control de las listas desplegables del menu de XCM*/
    $("ul.listaDesplegable").css("display","none");
    $("li.liSelectSub ul.listaDesplegable").css("display","block");
    $("ul.menuXCM>li").click(function(e){
    	$(this).children("ul.listaDesplegable").slideDown("slow");
    	$(this).addClass("liSelectSub");
    	$(this).addClass("liSelectSubAbajo");
    	$(this).children("ul.listaDesplegable").children("li").removeClass("level3NoSelect");
    	$(this).children("ul.listaDesplegable").children("li").addClass("level3SiSelect");
    	$(this).siblings().children("ul.listaDesplegable").slideUp("slow");
    	$(this).siblings().removeClass("liSelectSub");
    	$(this).siblings().removeClass("liSelectSubAbajo");
    	$(this).siblings().children("ul.listaDesplegable").children("li").removeClass("level3SiSelect");
    	$(this).siblings().children("ul.listaDesplegable").children("li").addClass("level3NoSelect");
    });
    
    $("ul.menuXCM>li>div>span>a.despliega").click(function(e){
    	$(this).parent().parent().parent().children("ul.listaDesplegable").slideDown("slow");
    	$(this).parent().parent().parent().addClass("liSelectSub");
    	$(this).parent().parent().parent().addClass("liSelectSubAbajo");
    	$(this).parent().parent().parent().children("ul.listaDesplegable").children("li").removeClass("level3NoSelect");
    	$(this).parent().parent().parent().children("ul.listaDesplegable").children("li").addClass("level3SiSelect");
    	$(this).parent().parent().parent().siblings().children("ul.listaDesplegable").slideUp("slow");
    	$(this).parent().parent().parent().siblings().removeClass("liSelectSub");
    	$(this).parent().parent().parent().siblings().removeClass("liSelectSubAbajo");
    	$(this).parent().parent().parent().siblings().children("ul.listaDesplegable").children("li").removeClass("level3SiSelect");
    	$(this).parent().parent().parent().siblings().children("ul.listaDesplegable").children("li").addClass("level3NoSelect");
    	return false;
    });
    
    $("a.fancybox").fancybox({
    	'overlayShow': true,
    	'hideOnContentClick':true
    }); 
    
    $("a.fancyboxlancy").fancybox({
    	'width'				: '30%',
		'height'			: '63%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'centerOnScroll' 	: true,
		'overlayShow'		: true,
		'hideOnContentClick':true
    }); 
    
    /*$(".contentRight").mouseover(function(e){
    	$("ul.listaDesplegable").slideUp("slow");
    })*/
    
    $("ul.tablaIzq li").mouseover(function(e){
    
    });
    
    
    //Temario de los Cursos
    if(document.getElementById("verTemario")){
	    var verTemario = document.getElementById("verTemario").firstChild.nodeValue;
	    var ocultarTemario = document.getElementById("ocultarTemario").firstChild.nodeValue;
	    $(".temarioTitulo").html('<a href="#">'+verTemario+'</a>');
	    $(".temarioTitulo a").addClass("verTemario");
	    $(".temario .temarioOculto").hide();
	    $(".verTemario").toggle(function(e){
	    	$(".temario .temarioOculto").fadeIn("normal");
	    	$(".temarioTitulo a").text(ocultarTemario);
	    	$(".temarioTitulo a").addClass("verTemario");
	    	return false;
	    },function(e){
	    	$(".temario .temarioOculto").fadeOut("normal");
	    	$(".temarioTitulo a").text(verTemario);
	    	$(".temarioTitulo a").addClass("verTemario");
	    	return false;
	    })
    }
    
    /*$("").mouseover(function(e){
    	if($("div.divContenedor").is(":visible")){
    		
    		$("div.divContenedor").css("display","none");
    	}
    });*/
});


/* <script type="text/javascript">	
		var fo = new FlashObject("<%=rutaFlash%>banner.swf","flash", "1008", "189", "7,0,19,0", "#EAEAE8" );
		fo.write("flash");
	</script> */

/*Roadshow*/
$(document).ready(function () {
	changeSem();
			
		});

	  	function changeSem(){		
		  	
			  					  			
	    $("#roadshows").change(function () {
	          var str = "";
	          var pos = 0;
	          
	              $("select option:selected").each(function () {							
	                pos  = $('option').index($(this));
	                $('#lista-seminarios li').addClass('oculta-seminario');
	                $('#lista-seminarios li:eq('+pos+')').removeClass('oculta-seminario');
	              });
              }).change();
	  	}
	

