/* Rutinas para auspiciantes */
var fotosOnSide = new Array();
function getFotosOnSide() {
	$.ajax({
		type: "GET",
		url: "js.lib/xmlLoader.php?path=fotosOnSide",
		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;
			}
			parseFotosOnSide(data);
		},
		error: function(){
			
		}
	});
}
function parseFotosOnSide(xml) {
	$(xml).find('fotos').each(function(){
		$(this).find('foto').each(function(){
			var unaFoto = new Array();
				unaFoto.push( $(this).find('pie').text() );
				unaFoto.push( $(this).find('imagen').text() );
			fotosOnSide.push( unaFoto );
		});
	});
	crateFotosOnSideComponent();
}
function crateFotosOnSideComponent() {
	var cadena = '';
		cadena += '<div class="header icono_quienesomos">Fotos</div>';
		cadena += '<div class="destacado_top" style="margin-bottom: -1px;"></div>';
		cadena += '<div class="destacado_middle" id="fotosOnSide">';
		cadena += '</div>';
		cadena += '<div class="destacado_bottom"></div>';
	$('#fotosOnSideComponent').html( cadena );
	showFotosOnSide();
}
function showFotosOnSide() {
	var rn = Math.floor(Math.random()*(fotosOnSide.length));
	var cadena = '<img src="datos/fotosOnSide/'+fotosOnSide[rn][1]+'" alt="'+fotosOnSide[rn][0]+'" /><br />'+fotosOnSide[rn][0]+'';
	$('#fotosOnSide').html( cadena );
	var countDown = setTimeout('showFotosOnSide();',5000);
}

