// JavaScript Document


/* FUNCIONES ESPECIFICAS PARA AJAX */

var xmlHttp;
var curr;
var response_div;

function showData(str)
{ 
	xmlHttp=GetXmlHttpObject();
	
	response_div='responseText';
	
	if (xmlHttp==null)
	 {
	 alert ("Su navegador no soporta la tecnologa necesaria para poder ver correctamente esta pgina.")
	 return;
	 }
	 
	q='';
	
	
		switch(str)
		{
			/* saluda */
			case 'sal':
			path="ResponseText/saludas/";
			id=showData.arguments[1];
				switch(id)
				{
				case 0:
				url="ResponseText/saluda.html";
				break;
				case 1:
				url=path + "saluda_vicente.html";
				break;
				case 2:
				url=path + "saluda_alcalde.html";
				break;
				case 3:
				url=path + "saluda_alcalde_catalan.html";
				break;
				case 4:
				url=path + "saluda_genaro_romero.html";
				break;
				case 5:
				url=path + "saluda_concejal_deportes.html";
				break;
				case 6:
				url=path + "saluda_concejal_deportes_catalan.html";
				break;
				}
			break;
			
			/* jueces */
			case 'juez':
			q=showData.arguments[1];
				switch(q)
				{
				case '':
				url="ResponseText/jueces.html";
				break;
				default:
				url="ResponseText/curriculums/curriculums_jueces.php";
				response_div='responseCurr';
				}
			break;
			
			/* mapa */
			case 'map':
			 url="ResponseText/mapa.php";
			/* document.getElementById('responseText').style.opacity=1;*/
			/* document.getElementById('responseText').filters.alpha.opacity=100;*/
			response_div='responseMap';
			break;
			
			/* fotos estadio */
			case 'est':
			url="imagenes/estadio/index.html";
			/*document.getElementById('responseText').style.visibility='visible';*/
			break;
			
			/* prensa */
			case 'psa':
			q=showData.arguments[1];
			url="ResponseText/prensa.php";
			break;
			
			/* trazadores */
			case 'traz':
			url="ResponseText/trazadores.html";
			/*q=showData.arguments[1];
				switch(q)
				{
				case '':
				url="ResponseText/jueces2.html";
				break;
				default:
				url="ResponseText/curriculums/curriculums_jueces.php";
				response_div='responseCurr';
				}*/
			break;
			
			/* figurantes */
			case 'fig':
			q=showData.arguments[1];
				switch(q)
				{
				case '':
				url="ResponseText/figurantes.html";
				break;
				default:
				url="ResponseText/curriculums/curriculums_figurantes.php";
				response_div='responseFig';
				}
			break;
			
			/* material de campo */
			case 'mat':
			url="ResponseText/material_campo.html";
			break;
			
			/* resultados */
			case 'res':
			url="ResponseText/resultados.html";
			break;
			
			/* patrocinadores y colaboraciones */
			case 'publi':
			url="ResponseText/publicidad.html";
			break;
			/* galeria fotografica */
			case 'gfot':
			q=showData.arguments[1];
			url="prensa/fotos/fotos.php";
			break;
			
		}
		
		
		url=url+"?q="+q+"&sid="+Math.random();
	
	if(str!='est')
	{
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	}
		
}


function stateChanged() 
{ 
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById(response_div).style.visibility='visible';
	document.getElementById(response_div).innerHTML=xmlHttp.responseText;
	
	} 
	
}


function GetXmlHttpObject()
{
	var xmlHttp=null;
	
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	
	 }
	catch (e)
	 {
		 //Internet Explorer
		 try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		 catch (e)
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
	 }
	 
	 return xmlHttp;
}




/* OTRAS FUNCIONES */

/* X roja en la esqina superior derecha para cerrar el contenido cargado desde ajax */
function cerrar()
{	
	with(document)
	{
	getElementById('responseText').style.visibility='hidden';
	getElementById(response_div).style.visibility='hidden';
	}
}


function newWindow(url)
{
//window.open(URL,name,specs,replace)
window.open(url,'','width=800,height=700,left=0,top=0,location=0,menubar=0,toolbar=0,titlebar=0,status=1,resizable=0,scrollbars=yes','');
}


function MM_openBrWindow(theURL,winName,features) 
{
window.open(theURL,winName,features);
}
