/*****************************************************************************************************************
 *      Especial:      Retrato de un pais                                                                         *
 *      Medio:         ElPais.com                                                                                 *   
 *      Autor:         Elpais                                                                                     *
 *      Script:        retrato-pais.js                                                                            *
 *      Descripcion:   Controla el carrusel y la páginación por scroll de portada a partir de la libreria         *
 *                     mootools                                                                                   *
 *      Fecha:         22/06/2009                                                                                 *
 *****************************************************************************************************************/

var pag = "f1";


  /* CARRUSEL MOOTOOLS

 **************************************************/



 /* OVER DE LAS FOTOS */



 /********************/

  var velocidad = 700; // velocidad de transición del carrusel de portada

 /********************/



 window.addEvent('domready', function(){ 



	/* MOUSEOVER PORTADA */

	

	$$('.e_carrusel').addEvent('mouseover', function(el){							 

		var foto = this.getElement("a").getProperty('id'); 

		target = "c_" + foto;

		if($(target).getProperty('class') == "marcado_bloqueado")

			return false;		

		$(target).setProperty('class', 'marcado');

 	});	

	

	/* MOUSEOUT PORTADA */

	

	$$('.e_carrusel').addEvent('mouseout', function(el){							 

		

		var foto = this.getElement("a").getProperty('id'); 

		target = "c_" + foto;

		if($(target).getProperty('class') == "marcado_bloqueado")

			return false;			

		$(target).removeProperty('class');



 	});

	

	/* MOUSEOVER MINIATURAS */

	

	$$('#miniaturas #contenidos li').addEvent('mouseover', function(el){							 

		this.setProperty('class', 'marcado');		

 	});	

	

	/* MOUSEOUT MINIATURAS */

	

	$$('#miniaturas #contenidos li').addEvent('mouseout', function(el){							 

		this.removeProperty('class');		

 	});	
	
	$$('.foto').addEvent('mouseover', function(el){							 
		
		var n_foto = "." + this.getProperty('id')	
		var c_foto = this.getProperty('id') + " marcado";
		if($$("#paginacion " + n_foto).getProperty('class') != this.getProperty('id') + " marcado bloqueado")
			$$("#paginacion " + n_foto).setProperty('class', c_foto);
		
 	});	
	
	$$('.foto').addEvent('mouseout', function(el){							 

		var n_foto = "." + this.getProperty('id')	
		var c_foto = this.getProperty('id') + " marcado";
		if($$("#paginacion " + n_foto).getProperty('class') != this.getProperty('id') + " marcado bloqueado")
			$$("#paginacion " + n_foto).setProperty('class', this.getProperty('id'));
		
 	});	

	

	/* PAGINACION PORTADA */



	$$('#paginacion .TipNav').addEvent('click', function(el){	

		$$(".bloqueado").setProperty('class', pag);

		var foto = this.getProperty('href');

		pag = foto.split("#")[1]


		$$("." + pag).setProperty('class', pag + " marcado bloqueado");
		
		target = "c_" + pag;

		if($$('.marcado_bloqueado'))

			$$('.marcado_bloqueado').removeProperty('class');

		$(target).setProperty('class', 'marcado_bloqueado');

					

	});
	
	$$('.pag_ant_sig .siguiente').addEvent('click', function(el){	
		alert("entra")

		$('contenidos').scrollTo(0, 100);
					

	});


	



	
	new SmoothScroll({ duration:900 }, window); 

});



 



 