//JS no intrusivo
	function addLoadEvent(func) 
	{
		if ( typeof wpOnload!='function')
		{
			wpOnload=func;
		}
		else
		{ 
		var oldonload=wpOnload;
		wpOnload=function()
			{
				oldonload();
				func();
			}
		}
	}
	
	
	
	addLoadEvent(function ()  { 
		clickBotones();
	});
	
	
	
	
	function clickBotones(){
		var rutaImg = 'img/collages/';
		//var vEnlaces = document.querySelectorAll('section.enlaces dl dt a'); selectores no aceptados por IE
		//var imgFondo = document.querySelector('section.cuerpo img');
		//var vDds = document.querySelectorAll('section.enlaces dl dd');
		var vEnlaces = new Array();
		vEnlaces[0] = document.getElementById('Barbastro');
		vEnlaces[1] = document.getElementById('Calatayud');
		vEnlaces[2] = document.getElementById('Teruel');
		
		var imgFondo = document.getElementById('principal');
		var listaEnlaces = document.getElementById('listaEnlaces');
		var vDds = listaEnlaces.getElementsByTagName('dd');
		
		vDds[1].style.display = "none"; vDds[2].style.display = "none";
		for(var i=0;i<vEnlaces.length;i++){
			//vEnlaces[i].addEventListener('click', function (event) { addEventListener no aceptado por IE
			vEnlaces[i].onclick = function() {	
				imgFondo.src = rutaImg + "c" + this.id + ".jpg";
				imgFondo.className = "transparente";
				
				
				//quitamos el seleccionado de todos
				for(var j=0;j<vEnlaces.length;j++){
					if(this==vEnlaces[j]){vEnlaces[j].className = "seleccionado"; vDds[j].style.display = "block";}
					else{vEnlaces[j].className = ""; vDds[j].style.display = "none";}
					
				};
	
			};//, false); 
		
		}
		
	}
	
