var accordion ;
var npos;
var Site = {

	start: function(){		
		//if ($('Secundario')) Site.parseEfectos();
		if ($('Fotografias')) 
		{
			Site.parseZoom();			
		}
		if ($('Seleccion')) 
		{
			Site.parseAcordeon();			
		}
		
	},	
	start2: function(){	
		accordion.display(npos);
	},	
	parseAcordeon:function(){	
		accordion = new Accordion('li.atStart', 'div.atStart', {
			onActive: function(toggler, element){
				toggler.setStyle('color', '#ff3300');
			},
		 
			onBackground: function(toggler, element){
				toggler.setStyle('color', '#5e563b');
			}
		}, $('Seleccion'));
	},	
	parseZoom: function(){
		var efectogals = $$('#Fotografias .fotogaleria');
		var fx = new Fx.Elements(efectogals, {wait: false, duration: 1000, transition: Fx.Transitions.Elastic.easeOut});
		efectogals.each(function(efectogal, i)
		{
			efectogal.addEvent('mouseenter', function(e)
			{
				var obj = {};
				obj[i] = 
				{
					'width': [efectogal.getStyle('width'), '200px']
				};				
				efectogals.each(function(other, j)
				{
					if (other != efectogal)
					{
						var w = other.getStyle('width');
						obj[j] = {'width': [w, '150px']};
					}
				});
				fx.start(obj);
			});
		
			efectogal.addEvent('mouseleave', function(e){
				var obj = {};
				efectogals.each(function(other, j)
				{
					obj[j] = {'width': [other.getStyle('width'), '150px']};
				});
				fx.start(obj);
			});		
		});
	},
	parseEfectos: function(){
		var efectos = $$('#Secundario .efecto');
		var fx = new Fx.Elements(efectos, {wait: false, duration: 1000, transition: Fx.Transitions.Elastic.easeOut});
		efectos.each(function(efecto, i)
		{
			efecto.addEvent('mouseenter', function(e)
			{
				var obj = {};
				obj[i] = 
				{
					'background-position': [efecto.getStyle('background-position'), '0px -5px']
				};				
				efectos.each(function(other, j)
				{
					if (other != efecto)
					{
						var w = other.getStyle('background-position');
						obj[j] = {'background-position': [w, '0px 0px']};
					}
				});
				fx.start(obj);
			});
		
			efecto.addEvent('mouseleave', function(e){
				var obj = {};
				efectos.each(function(other, j)
				{
					obj[j] = {'background-position': [other.getStyle('background-position'), '0px 0px']};			
				});
				fx.start(obj);
			});		
		});
	}
};
//window.addEvent('load', Site.start);

window.addEvent('domready', function(){
	var Tips1 = new Tips($$('.Tips1'));	
	var Tips2 = new Tips($$('.Tips2'), {
		initialize:function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 300, wait: false}).set(0);
		},
		onShow: function(toolTip) {
			this.fx.start(1);
		},
		onHide: function(toolTip) {
			this.fx.start(0);
		}
	});
	var Tips3 = new Tips($$('.Tips3'), {
		showDelay: 400,
		hideDelay: 400,
		fixed: true
	});
	var Tips4 = new Tips($$('.Tips4'), {
		className: 'custom'
	});
});
