function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false;
	try
	{
		// Creacion del objet AJAX para IE
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			
			// Creacion del objeto AJAX para navegadores no IE
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(E)
		{
			if (!xmlhttp && typeof XMLHttpRequest!='undefined') xmlhttp=new XMLHttpRequest();
		}
	}
	return xmlhttp; 
}

// Declaro los selects que componen el documento HTML. Su atributo ID debe figurar aqui.
/*var listadoSelects=new Array();
listadoSelects[0]="ID_PAIS";
listadoSelects[1]="IDE_CIUDAD";*/

/*function buscarEnArray(array, dato)
{
	// Retorna el indice de la posicion donde se encuentra el elemento en el array o null si no se encuentra
	var x=0;
	while(array[x])
	{
		if(array[x]==dato) return x;
		x++;
	}
	return null;
}*/

function cargarFirmador(id)
{
		if (id=='pdf')
		{document.getElementById('pdf').className = 'activo';
		document.getElementById('sri').className = '';
		document.getElementById('cms').className = '';
		}
		if (id=='sri')
		{document.getElementById('sri').className = 'activo';
		document.getElementById('pdf').className = '';
		document.getElementById('cms').className = '';
		}
		if (id=='cms')
		{document.getElementById('cms').className = 'activo';
		document.getElementById('sri').className = '';
		document.getElementById('pdf').className = '';
		}

		var tipo=id;
		var ajax=nuevoAjax();
		ajax.open("GET", "http://www.idsegura.com/firmador/firmadores.php?tipo="+tipo, true);
		ajax.onreadystatechange=function() 
		{ 
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				//selectDestino.length=0;
				//var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando...";
				//selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;
				var contenedor = document.getElementById("firmadores");
				contenedor.innerHTML = "<div align='center' vertical-align:middle'><img src='http://www.idsegura.com/images/ajax-loader.gif' /></div>";
				
			}
			if (ajax.readyState==4)
			{
				var contenedor = document.getElementById("firmadores");
				contenedor.innerHTML = ajax.responseText;
			} 
		}
		ajax.send(null);
		
		
		
	//}
}
