window.addEvent('domready', function (){
	var Mybody = $('Mybody');
	var Contenedor = $('Contenedor');
	var slogan =$('slogan');
	var contenedor_navegacion = $('contenedor_navegacion');
	var contenedor_relo = $('contenedor_relo');
	var contenidos = $('contenidos');
	var footer = $('footer');
	var banderash= $('banderash');
	var sloganlogo= $('sloganlogo');
	var carga_flash = {
		wmode : 'transparent',
		swliveconnect : 'true',
		allowscriptaccess : 'always'
	};

		/*swfobject.embedSWF("swf/testimonialess.swf", "cont_flash", "863", "63", "9.0.0", '', '', carga_flash);*/
		
	

	
		
	
	
	
	Mybody.addClass('ajax');
	Contenedor.set('visibility','visible');
//	Contenedor.set({
//		'styles':{
//			'opacity':0,
//			'height':630
//		
//		}
//	});
//	
//	slogan.set({
//		'styles':{
//			'opacity':0,
//			'margin-top':-100
//			}
//	});
//	
//	contenedor_navegacion.set({
//		'styles':{
//		
//			'opacity':0,
//			'margin-top':-70
//		}
//	});
//	
//	contenedor_relo.set({
//		'styles':{
//			'opacity':0,
//			'margin-right':-129
//		}
//	});
//	
//	contenidos.set({
//		'styles':{
//			'opacity':0,
//			'margin-top':-600
//		}
//	});
//	
//	footer.set({
//		'styles':{
//			'opacity':0,
//			'margin-left':-50
//		}
//	});
//	banderash.set({
//			'styles':{
//			'opacity':0,
//			'margin-top':-100
//			}
//		
//		});
//	sloganlogo.set({
//		'styles':{
//			'opacity':0,
//			'margin-right':-30	
//			
//			
//		}	
//		
//		
//		
//	});
//	
			
	/////función para submenu
/*	$('oferta').addEvents({
		'mouseenter': function(){
			this.set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Bounce.easeOut}).tween('height', '85px');
		},
		'mouseleave': function(){
				this.tween('height', '18px');
		}
	});*/
	
	
	/////////función para cargar sección al inicio
	
	
/*		var carga_inicio = new Request.HTML({
				 
				 	url:'secciones/home/home.html',
				 	update:contenidos,
				 	onSuccess:function(){
				 	}
				 	
				 });
				 	carga_inicio.get();
*/

/////////////función para cargar el home de nuevo

	
	
	//////////función para mandar llamar cada sección
	var array_botones = $$('#contenedor_navegacion div');
	var activo="";
	
	array_botones.each(function (q){
		q.addEvent('click', function(c){
			var c = new Event(c).stop();
			menu_activo(this.id);
		});
	});
	
	function menu_activo(quien){
	/* 	alert(quien); */
		if(activo !=quien){
			if(activo && activo !=""){
				$(activo).removeClass('activo');
			};
			$(quien).addClass('activo');
			activo=quien;
			btn_accion(quien);
		};
	};
	
	
	$('contenidosf').set('src', 'secciones/home/home.html');
	
			function btn_accion (quien){		
				
				switch(quien){
				
									
					case "company":
						carga_company();
										
					break;
					
					case "key":
						carga_key();
						
					break;
					case "catalogue":
						carga_catalogue();
						
					break;
					
					case "location":
						carga_location();	
					break;
					
					case "clients":
						carga_clients();
					break;
					
					case "contact":
						carga_contact();
					break;
			
				};
				function carga_company(){
					var contenidos = $('contenidosf').empty().set('src', 'secciones/company/company.html');
					
				};
				
				function carga_key(){
					var contenidos = $('contenidosf').empty().set('src', 'secciones/services/services.html');
					
				};
				
				function carga_catalogue(){
					var contenidos = $('contenidosf').empty().set('src', 'secciones/services/catalogue.html');
					
				};
				
				function carga_location(){
					var contenidos = $('contenidosf').empty().set('src', 'secciones/location/location.html');
					
				};
				
				function carga_clients(){
					var contenidos = $('contenidosf').empty().set('src', 'secciones/clients/clients.html');
					
				};
								
				function carga_contact(){
					var contenidos = $('contenidosf').empty().set('src', 'secciones/contact/contact.html');
					
				};
				
				/*var carga_secciones = new Request.HTML({
				 
				 	url:seccion,
				 	update:contenidos,
				 	onComplete:function(){
				 			 	
				 	}
				});
				
				carga_secciones.get();
	*/
			};
			

});
				
				
					
window.addEvent('load',function (){

	var Mybody = $('Mybody');
	var Contenedor = $('Contenedor');
	var slogan =$('slogan');
	var contenedor_navegacion = $('contenedor_navegacion');
	var contenedor_relo = $('contenedor_relo');
	var contenidos = $('contenidos');
	var footer = $('footer');
	var banderash= $('banderash');
	var sloganlogo= $('sloganlogo');
	var FX_slogan = new Fx.Morph(slogan, {duration: 1500, transition: Fx.Transitions.linear});
	var FX_banderash = new Fx.Morph(banderash, {duration: 1500, transition: Fx.Transitions.linear});
	var Fx_contenedor_navegacion = new Fx.Morph(contenedor_navegacion,{duration:2000,transition:Fx.Transitions.Bounce.easeOut});
	var Fx_contenedor_relo = new Fx.Morph(contenedor_relo,{duration:1000, transition:Fx.Transitions.Elastic.easeOu});
	var Fx_contenidos = new Fx.Morph (contenidos, {duration:1000, transition: Fx.Transitions.Bounce.easeOut});
	var Fx_sloganlogo = new Fx.Morph (sloganlogo, {duration:1000, transition: Fx.Transitions.Bounce.easeOut});
	var Fx_footer = new Fx.Morph (footer,{duration:2500, transition: Fx.Transitions.Quint.easeOut});
	
	Mybody.removeClass('ajax');
	Contenedor.set({
		'styles':{
			'opacity':1,
			'height':650
		
		}
	});
	
		
/*	function Fx_pagina (){
		Fx_contenedor_relo.start({
				'opacity':1,
				'margin-right':129
		});
			
					
	};*/	

//	var tiempo = function(){
//		FX_slogan.start({
//			'opacity':1,
//			'margin-top':35
//		}).chain(function(){
//			Fx_contenedor_navegacion.start({
//				'opacity':1,
//				'margin-top':22
//			}).chain(function(){
//				Fx_contenidos.start({
//						'opacity':1,
//						'margin-top':0
//					}).chain(function(){
//						Fx_footer.start({
//								'opacity':1,
//								'margin-left':0
//							}).chain(function(){
//								Fx_sloganlogo.start({
//										'opacity':1,
//										'margin-right':0
//								}).chain(function(){
//									FX_banderash.start({
//										'opacity':1,
//										'margin-top':22
//									}).chain(function(){
//										Fx_contenedor_relo.start({
//										'opacity':1,
//										'margin-right':105
//									});
//										
//										
//									});									
//									
//									
//								});
//
//							});		
//						});
//				});
//		});
//	
//	}.delay(200);

	$('services').addEvents({
    mouseenter: function(){
      // Always sets the duration of the tween to 1000 ms and a bouncing transition
      // And then tweens the height of the element
      this.set('tween', {
        duration: 1000,
        transition: Fx.Transitions.Bounce.easeOut // This could have been also 'bounce:out'
      }).tween('height', '70px');
    },
    mouseleave: function(){
      // Resets the tween and changes the element back to its original size
      this.set('tween', {}).tween('height', '28px');
    }
  });
	
	
		
});
