bloqueado = false;
bloqueado2 = false;
bloqueadoMenu = false;

function inicio()
{
	ver2("introduccion.html");
}

function mostrarContenidos2()
{

        submenu4 = document.getElementById("submenu3");

        if (navigator.appName.indexOf("Explorer") == -1)
        {
        oculto2 = document.getElementById("oculto");
        oculto2.focus();
        }

        if(!bloqueadoMenu)
        {

                bloqueadoMenu = true;

                if(submenu4.style.display == "none")
                        Effect.BlindDown(submenu4,{duration:0.5});
                        else
                                Effect.BlindUp(submenu4,{duration:0.5});

                window.setTimeout('desbloquearMenu()',550);

        }



}

function mostrarContenidos()
{

	submenu2 = document.getElementById("submenu");
	
	if (navigator.appName.indexOf("Explorer") == -1)
	{
	oculto2 = document.getElementById("oculto");
	oculto2.focus();
	}
	
	if(!bloqueadoMenu)
	{

		bloqueadoMenu = true;
		
		if(submenu2.style.display == "none")
			Effect.BlindDown(submenu2,{duration:0.5});
			else
				Effect.BlindUp(submenu2,{duration:0.5});
	
		window.setTimeout('desbloquearMenu()',550);
				
	}
			
	
	
}

function ver(pagina)
	{
		if(!bloqueado)
		{
		
		if (navigator.appName.indexOf("Explorer") == -1)
		{
		oculto2 = document.getElementById("oculto");
		oculto2.focus();
		}
			
			
		bloqueado = true;
			
		contentHtml = document.getElementById("info_contents");
		foot = document.getElementById("footer");
		
		Effect.Fade(contentHtml,{duration:1});
		Effect.Fade(foot,{duration:1});
		window.setTimeout('verAjax("'+pagina+'")',1050);
		
		
		
		}
		
	
	}
	
	function ver2(pagina)
	{
		
		if((!bloqueado) && (!((pagina=="contenidos.html")&&(submenu2.style.display == ""))) &&  
		   (!((pagina=="matricula.html")&&(submenu4.style.display == ""))))
		{
		
		if (navigator.appName.indexOf("Explorer") == -1)
		{
		oculto2 = document.getElementById("oculto");
		oculto2.focus();
		}
			
			
		bloqueado = true;
			
		contentHtml = document.getElementById("info_contents");
		foot = document.getElementById("footer");
		
		Effect.Fade(contentHtml,{duration:1});
		Effect.Fade(foot,{duration:1});
		
		window.setTimeout('verAjax2("'+pagina+'")',1050);
		
		//verAjax2(pagina);
		
		
		}
		
	
	}


function verAjax(pagina)
{

		new Ajax.Request('xml/'+pagina+'.xml', {method:'post', postBody:'', onSuccess:verOk, onFailure:errFunc});
}

function verAjax2(pagina)
{
		new Ajax.Request('html/'+pagina, {method:'post', postBody:'', onSuccess:verOk2, onFailure:errFunc});
		
}
	
function errFunc()
	{
		alert("pagina no implementada");
		
	}

function verOk(t)
{

	contentHtml = document.getElementById("info_contents");
	contentHtml.innerHTML="";
	var iHTML="";
	
	var xml = t.responseXML;
	
	
	var titulo = xml.getElementsByTagName('titulo')[0].childNodes[0].data;
	
	iHTML += '<div id="info_title">'+titulo+"</div>";
	iHTML += '<div><img src="images/l2.jpg" /></div>';
	iHTML += '<div id="info_text">';
	
	var contenidos = xml.getElementsByTagName('contenidos')[0].childNodes[0].data;
	iHTML += '<div class="subtitle">Contenidos</div>';
	iHTML += '<div><img src="images/l3.jpg" /></div>';
	iHTML += '<div class="text">'+contenidos+'</div>';
	
	var horas = xml.getElementsByTagName('horas')[0].childNodes[0].data;
	iHTML += '<div class="subtitle">N&uacute;mero de horas</div>';
	iHTML += '<div><img src="images/l3.jpg" /></div>';
	iHTML += '<div class="text">'+horas+'</div>';
	
	html = "";
	x= xml.getElementsByTagName('profesores');
	total = (x[0].childNodes.length -1 )/2;
	
	for(i=0;i<total;i++)
		html += "<li>"+xml.getElementsByTagName('profesor')[i].childNodes[0].data+"</li>";
	
	iHTML += '<div class="subtitle">Profesores</div>';
	iHTML += '<div><img src="images/l3.jpg" /></div>';
	iHTML += '<div class="text"><ul>'+html+'</ul></div>';
	
	
	html = "";
	x= xml.getElementsByTagName('temario');
	total = (x[0].childNodes.length -1 )/2;
	
	for(i=0;i<total;i++)
		html += "<li>"+xml.getElementsByTagName('tema')[i].childNodes[0].data+"</li>";
	
	iHTML += '<div class="subtitle">Temario</div>';
	iHTML += '<div><img src="images/l3.jpg" /></div>';
	iHTML += '<div class="text_bg"><ol>'+html+'</ol></div>';
	
	
	html = "";
	x= xml.getElementsByTagName('ejemplos');
	total = (x[0].childNodes.length -1 )/2;
	
	for(i=0;i<total;i++)
		html += "<a href='http://"+xml.getElementsByTagName('ejemplo')[i].childNodes[0].data+"' target='_blank'><li>"+xml.getElementsByTagName('ejemplo')[i].childNodes[0].data+"</a></li>";
	
	iHTML += '<div class="subtitle">Ejemplos</div>';
	iHTML += '<div><img src="images/l3.jpg" /></div>';
	iHTML += '<div class="text"><ul>'+html+'</ul></div>';
	
	iHTML += '</div>';
	
	contentHtml.innerHTML=iHTML;
	//cargarHtml = document.getElementById("cargando");
	//cargarHtml.style.display = "none";
	
	foot = document.getElementById("footer");
	
	
	Effect.Appear(contentHtml,{duration:1});
	Effect.Appear(foot,{duration:1});
	
	//document.getElementById("info_contents").style.display = "";
	
	window.setTimeout('desbloquear()',1050);
}

function verOk2(t)
{
	contentHtml = document.getElementById("info_contents");
	contentHtml.innerHTML=t.responseText;
foot = document.getElementById("footer");
	
	
	Effect.Appear(contentHtml,{duration:1});
	Effect.Appear(foot,{duration:1});
	
	//document.getElementById("info_contents").style.display = "";
	
	window.setTimeout('desbloquear()',1050);
}

function desbloquear()
{
	bloqueado = false;
	
}

function desbloquearMenu()
{
	bloqueadoMenu = false;
	
}

