function iniCoverPic(xmlUrl, preview)
{

//	$(document).ready(function(){
	
		if (preview == null) preview = false;
		var galery = {
			setData : function(pos)
			{
				$("#picMenu-bt"+activeImg).removeClass("picMenu-on");
				$("#picMenu-bt"+pos).addClass("picMenu-on");
				$('.secondPic').attr({src: getContent('imagen', pos-1)}).fadeTo(700, 1);
		  	$('.firstPic').fadeTo(700, 0, function(){ newPic(); });
		  	$('#coverFirstPic h1 a').hide();
				$('#coverFirstPic p').hide();
				activeImg = pos;
			}
		};
		
		var xml;
		var activeImg = 1;
		var limite = 4;
		var intervalo; 
		
		
		$.get(xmlUrl, function(data)
			{
				xml = data;
			  for (i=1; i< 5; i++) {
			  	$('#picMenu-bt'+i).click(function()
					{
						
						clearInterval(intervalo);
						galery.setData($(this).attr('id').substring(10));
						
						return false;
					});
				}
				intervalo = setInterval(timerPic, 7000);
				
			}
		);
		
		/*
		$.ajax({
			type: 'get',
			url: xmlUrl,
			cache: true,
			dataType: 'xml', // Reconocemos el browser.
			success : function(data)
			{
				
				xml = data;
			  for (i=1; i< 5; i++) {
			  	$('#picMenu-bt'+i).click(function()
					{
						
						clearInterval(intervalo);
						galery.setData($(this).attr('id').substring(10));
						
						return false;
					});
				}
				intervalo = setInterval(timerPic, 7000);
				
			}
		});
		*/
		
		
		function timerPic(){
			if((activeImg*1)+1<=limite)galery.setData((activeImg*1)+1);
			else galery.setData(1);
			clearInterval(intervalo); 
		}
			
			
		function newPic()
		{
			$('#coverFirstPic h1 a').html(getContent('titulo', activeImg-1))
															.attr({href: getContent('enlace', activeImg-1)})
															.show();
			$('.firstPic').attr({src: getContent('imagen', activeImg-1)})
										.css({'opacity':'1', 'filter':'alpha(opacity=100)'});
	  	$('.coverLink').attr({href: getContent('enlace', activeImg-1)});
	  	$('#coverFirstPic p').html(getContent('texto', activeImg-1)).show();
			$('.secondPic').css({'opacity':'0', 'filter':'alpha(opacity=0)'});
			intervalo = setInterval(timerPic, 7000);
		}
			
		function getContent(tipo, id) {
			nodo = $(xml).find(tipo);
			return($(nodo[id]).text());
		}
		
		
//	});
}
