function iniCoverPic(galleryData, coverName, numItems, intervalTime, preview)
{
		if (preview == null) preview = false;
	
		var galery = {
			setData : function(pos)
			{
				$("#picMenu-bt"+activeImg).removeClass(coverName+"-on");
				$("#picMenu-bt"+pos).addClass(coverName+"-on");
				$('.secondPic').attr({src: getContent('imagen', pos-1)}).fadeTo(700, 1);
		  	$('.firstPic').fadeTo(700, 0, function(){ newPic(); });
		  	$('#'+coverName+'-principal h1 a').hide();
				$('#'+coverName+'-principal p').hide();
				if(getContent('provincia', pos-1)!="")$('.hrural-area').html('').show();
				activeImg = pos;
			}
		};
		
		var xml;
		var activeImg = 1;
		var limite = numItems == null? 4:numItems;
		var tiempo = intervalTime == null? 7000:intervalTime;
		var intervalo; 
		var galleryData = galleryData;
		
		
		for (i=1; i< (limite+1); i++) {
			$('#picMenu-bt'+i).click(function()
			{
				clearInterval(intervalo);
				galery.setData($(this).attr('id').substring(10));
				return false;
			});
		}
				
		intervalo = setInterval(timerPic, tiempo);
		
		function timerPic(){
			if((activeImg*1)+1<=limite)galery.setData((activeImg*1)+1);
			else galery.setData(1);
			clearInterval(intervalo); 
		}
			
			
		function newPic()
		{
			$('#'+coverName+'-principal 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)});
	  	
	  	$('#'+coverName+'-principal p').html(getContent('texto', activeImg-1)).show();
			$('.secondPic').css({'opacity':'0', 'filter':'alpha(opacity=0)'});
			
			if(getContent('provincia', activeImg-1)!=""){
				$('.hrProvincia').html(getContent('provincia', activeImg-1)).show();
				$('.hrProvincia').attr('href', getContent('provincia_url', activeImg-1));
				$('.hrPueblo').html(getContent('localidad', activeImg-1)).show();
			}
			intervalo = setInterval(timerPic, tiempo);
		}
			
		function getContent(tipo, id) {
			return galleryData[id][tipo];
		}
		
}