window.addEvent('domready', function(){

	//menu
	menu = $$('.menu ul li .seccion');
	men = {};
	menu.each(function(els, idx) {
			men[idx] = new Fx.Styles(menu[idx], {duration:125, wait:false});
			els.addEvent('mouseenter', function(){ men[idx].start({ 'color': '#FFFFFF',
																	'background-color': '#1A9ED5' }); });
			els.addEvent('mouseleave', function(){ men[idx].start({ 'color': '#000000',
																	'background-color': '#FFFFFF' }); });
	});	
});

/* menu  */
	Element.extend(
	{
		hide: function() 
		{
			return this.setStyle('display', 'none');
		},
		
		show: function() 
		{
			return this.setStyle('display', '');
		}
	});

	var DropdownMenu = new Class({	
		initialize: function(element)
		{
			$A($(element).childNodes).each(function(el)
			{
				if(el.nodeName.toLowerCase() == 'li')
				{
					$A($(el).childNodes).each(function(el2)
					{
						if(el2.nodeName.toLowerCase() == 'ul')
						{
							$(el2).hide();
							
							el.addEvent('mouseover', function()
							{
								el2.show();

								return false;
							});
	
							el.addEvent('mouseout', function()
							{
								el2.hide();
							});
							new DropdownMenu(el2);
						}
					});
				}
			});
			return this;
		}
	});
	
	Window.onDomReady(function() {new DropdownMenu($('dropdownMenu'))});
	
	
window.addEvent('domready', function(){	
									 
var scroll = new Fx.Scroll('paisaje', {
	wait: false,
	duration: 1000,
	offset: {'x': 0, 'y': 0},
	transition: Fx.Transitions.Quad.easeInOut
});

		paginas = $$('.paginador a, .paginador2 a');
		paginas.each(function(el_pag, id_pag) {
		el_pag.addEvent('click', function(event){ 
			event = new Event(event).stop();
			scroll.toElement('pag_'+el_pag.title);
			
			enlaces_pag = $$('.paginador a, .paginador2 a');
			enlaces_pag.each(function(el_pag2, id_pag2) {
				el_pag2.removeClass('activado');
			});
			
			el_pag.addClass('activado');
		});
		});
		
		
	abrir_noticia = $$('.abrir_noticia');
	cerrar_noticia = $$('.cerrar_noticia');
	toggles = $$('.noticia');
	togs = {};
	
	var alturas= new Array();
	
	abrir_noticia.each(function(el, idx) {
		togs[idx] = new Fx.Styles(toggles[idx], {duration:550, transition: Fx.Transitions.Circ.easeOut, wait:false});
		/*var boton_abrir = new Fx.slide(el);
		boton_abrir.hide();*/
		
		el.addEvent('click', function(){ 
									  
									  if (alturas[idx]=='110' || typeof alturas[idx] == "undefined")
									  {
										  togs[idx].start({ 'height': 600 });
										  alturas[idx]=220;
										  el.setHTML('CERRAR');
									  }
										else
									  {
										  togs[idx].start({ 'height': 130 });
										  alturas[idx]=110;
										  el.setHTML('VER M&Aacute;S');
									  }
	});	
});	
});
