window.addEvent('domready', function()
{
	var anterior = false;
	
	$$('.galeria_mini').each(function(elemento)
	{
		var efecto = new Fx.Slide(elemento, {transition: Fx.Transitions.Back.easeOut, wait: false});
		efecto.hide();
		
		elemento.efecto = efecto;
	});
	
	$$('.vermas').each(function(elemento)
	{
		elemento.addEvent('click', function()
		{
			var id = elemento.getProperty('id');
			
			if($('galeria-' + id) != anterior)
			{
				$('galeria-' + id).efecto.toggle();
			
				if(anterior != false)
				{
					anterior.efecto.stop();
					anterior.efecto.hide();
				}
				anterior = $('galeria-' + id);
			}
			else
			{
				$('galeria-' + id).efecto.toggle();
				anterior = false;
			}
		});
	});
});

window.addEvent('load', function(){
			
			
		
		/*var efecto_cargando = $('cargando').effects({duration: 750, transition: Fx.Transitions.Quart.easeInOut});
		//escondemos cargando
		efecto_cargando.start({'opacity': 0});*/

var enlaces_img = $$('a img');
			enlaces_img.each(function(elemento_img)
			{
				   
					   var efecto_img = elemento_img.effects({duration: 300, transition: Fx.Transitions.Quart.easeInOut});
					   efecto_img.start({'opacity': 1});
					   elemento_img.addEvent('mouseenter', function(event){ 
							efecto_img.start({'opacity': 0.7});
						});
					   elemento_img.addEvent('mouseleave', function(event){ 
							efecto_img.start({'opacity': 1})
						});
					   $('contenido').addEvent('mouseenter', function(event){ 
							efecto_img.start({'opacity': 1})
						});
			 
			 });
						


		/*boton zoom de catalogo */
		if (isset($('zoom'))) {
			$('zoom').setOpacity(.3);
			var efecto_zoom = $('zoom').effects({duration: 150, transition: Fx.Transitions.Quart.easeInOut});
			$('zoom_a').addEvent('mouseenter', function(){ efecto_zoom.start({ 'opacity': .7 }); });
			$('zoom_a').addEvent('mouseleave', function(){ efecto_zoom.start({ 'opacity': .3 }); });
		}
});

function isset(variable_name) {
    try {
         if (typeof(eval(variable_name)) != 'undefined')
         if (eval(variable_name) != null)
         return true;
     } catch(e) { }
    return false;
   }
function muestraGaleria(id) {
	var efecto = $('galeria'+id).effects({duration: 850, transition: Fx.Transitions.Quart.easeInOut});
	altura=$('galeria'+id).getStyle('height');
	if (altura=='0px')
	efecto.start({ 'height': '0px', 'padding':'0px' });
	else
	efecto.start({ 'height': '', 'padding':'15px' });
}