/* Rutinas para auspiciantes */
var auspiciantes = new Array();
function getAuspiciantes() {
	$.ajax({
		type: "GET",
		//url: "datos/auspiciantes.xml",
		url: "js.lib/xmlLoader.php?path=auspiciantes",
		dataType: "xml",
		processData: false,
		beforeSend: function(){
			
		},
		success: function(data){
			if (typeof data == "string") {
				xml = new ActiveXObject("Microsoft.XMLDOM");
				xml.async = false;
				xml.loadXML(data);
			} else {
				xml = data;
			}
			parseAuspiciantes(data);
		},
		error: function(){
			
		}
	});
}
function parseAuspiciantes(xml) {
	$(xml).find('auspiciantes').each(function(){
		$(this).find('auspiciante').each(function(){
			var unAuspiciante = new Array();
				unAuspiciante.push( $(this).find('nombre').text() );
				unAuspiciante.push( $(this).find('url').text() );
				unAuspiciante.push( $(this).find('foto').text() );
			auspiciantes.push( unAuspiciante );
		});
	});
	showAuspiciante();
}
function showAuspiciante() {
	var rn = Math.floor(Math.random()*(auspiciantes.length));
	var cadena = '<a href="'+auspiciantes[rn][1]+'" target="_blank"><img src="datos/auspiciantes/'+auspiciantes[rn][2]+'" alt="'+auspiciantes[rn][0]+'" /></a>';
	$('#auspiciante').html( cadena );
	var countDown = setTimeout('showAuspiciante();',5000);
}

