var fab;
var myrules = {
	'body' : function(el){ 
		inicio();
		estereotipo1();
		estereotipo2();
		estereotipo3();
		estereotipo4();
		estereotipo5();
		estereotipo7();
		//---------------------------------------------------------------------
		
		
   },
//======================= botonera superior ================================
	'#logo_arbora' : function(el){
		el.style.cursor='pointer'
		el.onclick= function(){
			var inicio = document.getElementById('inicio');
			var enlace = inicio.getElementsByTagName('a');
			mostrar_navegacion(false,'');
			var url = enlace[0].href;
			CargarContenido('contenido',url,null,'doHome();');
			desmarca_opcion();
			enlace[0].style.backgroundColor='#EEEEEE';
		 	return false;
		}
   },
	'#inicio' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  el.onclick = function(){
         mostrar_navegacion(false,'');
		 //doHome();
		 CargarContenido('contenido',url,null,'doHome();');
		 return false; 
      }
	  enlace[0].id='mi_enlace_inicio';
	  enlace[0].onclick= function(){
		desmarca_opcion();
	  	this.style.backgroundColor='#EEEEEE';
	  }
	  enlace[0].onmouseover= function(){
		if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#ECECEC';
		//if(Fat.get_bgcolor('mi_enlace_inicio') != '#eeeeee') Fat.fade_element('mi_enlace_inicio', 100, 300, '#FFFFFF', '#ECECEC');
	  }
	  enlace[0].onmouseout= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#FFFFFF';
		//if(Fat.get_bgcolor('mi_enlace_inicio') != '#eeeeee') Fat.fade_element('mi_enlace_inicio', 100, 600, '#ECECEC', '#FFFFFF');
	  }
	  preloadImages('/img/down.gif');
	  preloadImages('/img/up.gif');
	  preloadImages('/img/thumb_h.gif');
	  preloadImages('/img/thumb_v.gif');
   },
   '#compania' : function(el){ 
      var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
	  el.onclick = function(){
	  	//alert(enlace[0].childNodes[1].nodeValue)
		mostrar_navegacion(true,enlace[0].childNodes[1].nodeValue,url);
		var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		estilo_activo='compania';
		CargarContenido('contenedor_menu',url_menu,null,funcion);
		doSeccion();
		 return false; 
      }
	  enlace[0].id='mi_enlace_compania';
	  enlace[0].onclick= function(){
	  	desmarca_opcion();
		this.style.backgroundColor='#EEEEEE';
	  }
	  enlace[0].onmouseover= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#ECECEC';
		//if(Fat.get_bgcolor('mi_enlace_compania') != '#eeeeee') Fat.fade_element('mi_enlace_compania', 100, 300, '#FFFFFF', '#ECECEC');
	  }
	  enlace[0].onmouseout= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#FFFFFF';
		//if(Fat.get_bgcolor('mi_enlace_compania') != '#eeeeee') Fat.fade_element('mi_enlace_compania', 100, 600, '#ECECEC', '#FFFFFF');
	  }
   },
   '#marcas' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
	  el.onclick = function(){
		 mostrar_navegacion(true,enlace[0].childNodes[1].nodeValue,url);
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 doSeccion();
		 return false; 
      }
	 enlace[0].id='mi_enlace_marcas';
	 enlace[0].onclick= function(){
		desmarca_opcion();
	  	this.style.backgroundColor='#EEEEEE';
	  }
	  enlace[0].onmouseover= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#ECECEC';
		//if(Fat.get_bgcolor('mi_enlace_marcas') != '#eeeeee') Fat.fade_element('mi_enlace_marcas', 100, 300, '#FFFFFF', '#ECECEC');
	  }
	  enlace[0].onmouseout= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#FFFFFF';
		//if(Fat.get_bgcolor('mi_enlace_marcas') != '#eeeeee') Fat.fade_element('mi_enlace_marcas', 100, 600, '#ECECEC', '#FFFFFF');
	  }
   },
   '#personas' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
      el.onclick = function(){
		 mostrar_navegacion(true,enlace[0].childNodes[1].data,url);
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 estilo_activo='personas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 doSeccion();
		 return false; 
      } 
	 enlace[0].id='mi_enlace_personas';
	  enlace[0].onclick= function(){
		desmarca_opcion();
	  	this.style.backgroundColor='#EEEEEE';
	  }
	  enlace[0].onmouseover= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#ECECEC';
		//if(Fat.get_bgcolor('mi_enlace_personas') != '#eeeeee') Fat.fade_element('mi_enlace_personas', 100, 300, '#FFFFFF', '#ECECEC');
	  }
	  enlace[0].onmouseout= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#FFFFFF';
		//if(Fat.get_bgcolor('mi_enlace_personas') != '#eeeeee') Fat.fade_element('mi_enlace_personas', 100, 600, '#ECECEC', '#FFFFFF');
	  }
   },
   '#clientes' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
      el.onclick = function(){
	  	doSeccion();
		mostrar_navegacion(true,enlace[0].childNodes[1].nodeValue,url);
		var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 estilo_activo='clientes';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false; 
      }
	  enlace[0].id='mi_enlace_clientes';
	  enlace[0].onclick= function(){
		desmarca_opcion();
	  	this.style.backgroundColor='#EEEEEE';
		return false;
	  }
	  enlace[0].onmouseover= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#ECECEC';
		//if(Fat.get_bgcolor('mi_enlace_clientes') != '#eeeeee') Fat.fade_element('mi_enlace_clientes', 100, 300, '#FFFFFF', '#ECECEC');
		return false;
	  }
	  enlace[0].onmouseout= function(){
	  	if (this.style.backgroundColor !='#eeeeee') this.style.backgroundColor='#FFFFFF';
		//if(Fat.get_bgcolor('mi_enlace_clientes') != '#eeeeee') Fat.fade_element('mi_enlace_clientes', 100, 600, '#ECECEC', '#FFFFFF');
		return false;
	  }
   },
    '#logo_ausonia' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
      var marca = document.getElementById('marcas');
	  var enlace_marca = marca.getElementsByTagName('a');
	  el.onclick = function(){
		 mostrar_navegacion(true,enlace_marca[0].childNodes[1].nodeValue,enlace_marca[0].href);
		 desmarca_opcion();
		 enlace_marca[0].style.backgroundColor='#EEEEEE';
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 marca_activada ='ausonia';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false; 
      } 
   },
     '#logo_charmin' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
      var marca = document.getElementById('marcas');
	  var enlace_marca = marca.getElementsByTagName('a');
	  el.onclick = function(){
		 mostrar_navegacion(true,enlace_marca[0].childNodes[1].nodeValue,enlace_marca[0].href);
		 desmarca_opcion();
		 enlace_marca[0].style.backgroundColor='#EEEEEE';
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 marca_activada ='charmin';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false; 
      } 
   },
      '#logo_dodot' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
	  var marca = document.getElementById('marcas');
	  var enlace_marca = marca.getElementsByTagName('a');
      el.onclick = function(){
		 mostrar_navegacion(true,enlace_marca[0].childNodes[1].nodeValue,enlace_marca[0].href);
		 desmarca_opcion();
		 enlace_marca[0].style.backgroundColor='#EEEEEE';
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 marca_activada ='dodot';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false;
      } 
   },
      '#logo_evax' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
	  var marca = document.getElementById('marcas');
	  var enlace_marca = marca.getElementsByTagName('a');
      el.onclick = function(){
		 mostrar_navegacion(true,enlace_marca[0].childNodes[1].nodeValue,enlace_marca[0].href);
		 desmarca_opcion();
		 enlace_marca[0].style.backgroundColor='#EEEEEE';
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 marca_activada ='evax';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false; 
      } 
   },
      '#logo_kandoo' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
	  var marca = document.getElementById('marcas');
	  var enlace_marca = marca.getElementsByTagName('a');
      el.onclick = function(){
		 mostrar_navegacion(true,enlace_marca[0].childNodes[1].nodeValue,enlace_marca[0].href);
		 desmarca_opcion();
		 enlace_marca[0].style.backgroundColor='#EEEEEE';
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 marca_activada ='kandoo';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false; 
      } 
   },
       '#logo_lindor' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
	  var marca = document.getElementById('marcas');
	  var enlace_marca = marca.getElementsByTagName('a');
      el.onclick = function(){
		 mostrar_navegacion(true,enlace_marca[0].childNodes[1].nodeValue,enlace_marca[0].href);
		 desmarca_opcion();
		 enlace_marca[0].style.backgroundColor='#EEEEEE';
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 marca_activada ='lindor';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false; 
      } 
   },
       '#logo_salvacamas' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
	  var marca = document.getElementById('marcas');
	  var enlace_marca = marca.getElementsByTagName('a');
      el.onclick = function(){
		 mostrar_navegacion(true,enlace_marca[0].childNodes[1].nodeValue,enlace_marca[0].href);
		 desmarca_opcion();
		 enlace_marca[0].style.backgroundColor='#EEEEEE';
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 marca_activada ='salvacamas';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false; 
      } 
   },
       '#logo_tampax' : function(el){
	  var enlace = el.getElementsByTagName('a');
	  var url = enlace[0].href;
	  var url_menu = enlace[1].href;
	  var marca = document.getElementById('marcas');
	  var enlace_marca = marca.getElementsByTagName('a');
      el.onclick = function(){
		 mostrar_navegacion(true,enlace_marca[0].childNodes[1].nodeValue,enlace_marca[0].href);
		 desmarca_opcion();
		 enlace_marca[0].style.backgroundColor='#EEEEEE';
		 var funcion = 'menu_2();CargarContenido("contenido","'+url+'",null,null)';
		 marca_activada ='tampax';
		 estilo_activo='marcas';
		 CargarContenido('contenedor_menu',url_menu,null,funcion);
		 return false; 
      } 
   },
   //======================= estereotipo 1 ================================
   '#boton_mas_vertical' : function(el){ 
      el.onclick = function(){
		  var superior = document.getElementById('superior');
		  main = document.getElementById('main');
		  alt = document.getElementById('alt');

		  superior.style.height = superior.offsetHeight +'px';
		  var desplegar = new Accelimation(superior.style, "height", 170, 300, 0.1);
		  desplegar.onend = new Function('alt.style.display = "block";main.style.display = "none";');
		  desplegar.start();
		  
		  
		  var boton_menos = document.getElementById('boton_menos_vertical');
		  //main.style.display = 'none';
		  //alt.style.display = 'block';
		  boton_menos.style.display = 'block';
		  
		 return false; 
      } 
   },
   '#boton_menos_vertical' : function(el){ 
      el.onclick = function(){
		  var superior = document.getElementById('superior');
		  var ancho =  superior.offsetWidth;
		  crecer('superior',ancho,305,9);
		  var main = document.getElementById('main');
		  var alt = document.getElementById('alt');
		  var boton_menos = document.getElementById('boton_menos_vertical');
		  main.style.display = 'block';
		  alt.style.display = 'none';
		  boton_menos.style.display = 'none';
		 return false; 
      } 
   },
   '#boton_mas_horizontal' : function(el){ 
      el.onclick = function(){
		  fab = function(){alert("hola");}
		  var izq = document.getElementById('izq');
		  main = document.getElementById('main');
		  alt = document.getElementById('alt');
		 //-------------------desplegar panel ---------
		  izq.style.width='262px';
		  var desplegar = new Accelimation(izq.style, "width", 470, 100, 0.1);
		  //desplegar.onend = new Function('alt.style.display = "block";main.style.display = "none";update_scroll(\'cuerpo\',\'v\');');
		  desplegar.onend = function(){
			alt.style.display = "block";
			main.style.display = "none";

			scrollea('cuerpo',459,348,'v');
			parrafos_des();
			update_scroll('cuerpo','v');

			var movie = document.getElementById('movie');
			if(movie) movie.setMovement();
			//setTimeout("update_scroll(\'cuerpo\',\'v\');",1500);
			};
		  desplegar.start();
		  //setTimeout("update_scroll(\'cuerpo\',\'v\');",1000);
		  
		  return false; 
      } 
   },
   '#boton_menos_horizontal' : function(el){ 
      el.onclick = function(){
		 var izq = document.getElementById('izq');
		 main = document.getElementById('main');
		 alt = document.getElementById('alt');
		 
		 var plegar = new Accelimation(izq.style, "width", 262, 300, 0.1);
		 plegar.onend =  function(){
		 	var movie = document.getElementById('movie');
			if(movie) movie.setMovement();
		 };
		 
		 plegar.start();
		 main.style.display = "block";
		 alt.style.display = 'none';
		 
		 //Jose 24/11/2006 - Avisamos a la película flash para que resitúe la imagen
		 var movie = document.getElementById('movie');
		if(movie) movie.setStartingX();
		 
		 return false; 
      } 
   },
    '#boton_mas_oficinas' : function(el){ 
      el.onclick = function(){
		 var izq = document.getElementById('izq');
		 var contenedor_main = document.getElementById('contenedor_main');
		 main = document.getElementById('main');
		 alt = document.getElementById('alt');
		 contenedor_main.style.display ='none';
		 var plegar = new Accelimation(main.style, "height", 80, 200, 0.1);
		 plegar.onend = new Function('alt.style.display = "block";main.style.display = "none";');
		 plegar.start();

		 return false; 
      } 
   },
    '#boton_menos_oficinas' : function(el){ 
      el.onclick = function(){
		 var izq = document.getElementById('izq');
		 var contenedor_main = document.getElementById('contenedor_main');
		 main = document.getElementById('main');
		 alt = document.getElementById('alt');
		 alt.style.display = 'none';
		 main.style.display = 'block';
		 contenedor_main.style.display ='block';
		 var plegar = new Accelimation(main.style, "height", 418, 300, 0.1);
		 plegar.onend = new Function('null');
		 plegar.start();
		 return false; 
      } 
   },
  
   '.logo_pie' : function(el){
	    var nom = navigator.appName;

		var imagenes = el.getElementsByTagName("img");
		//alert(el.outerHTML)
		el.onmouseover = function(){
			/*
			if (nom == "Microsoft Internet Explorer"){
				imagenes[1].style.marginTop = "-60px";
			}
			else{
				imagenes[1].style.marginTop = "-40px";
			}
			*/
			imagenes[0].style.display = "none";
			imagenes[1].style.display = "block";
		}
		el.onmouseout = function(){
			//imagenes[1].style.marginTop = '0px';
			imagenes[0].style.display = "block";
			imagenes[1].style.display = "none";
		}
			return false;
		//------------------ apartir de aqui eran los botones con animacion que no funcionan nada bien -----------
		/*var enlaces = el.getElementsByTagName("a");
		imagenes[1].onclick= function(){
			doSeccion();
		}
		imagenes[0].onmouseover = function(){
			if(!imagenes[1].style.marginTop) imagenes[1].style.marginTop = '-60px';
			despliegue = new Accelimation(imagenes[1].style, "marginTop", -60, 500, 0.1);
			despliegue.start();
			despliegue.onend = new Function('null');
			//alert(el.id);
			setTimeout('oculta_logo_marcas("'+el.id+'")',1500);
			return false;
		}
		imagenes[0].onmouseout = function(){
			if(!imagenes[1].style.marginTop) imagenes[1].style.marginTop = '0px';
			despliegue = new Accelimation(imagenes[1].style, "marginTop", 0, 200, 0.1);
			despliegue.start();
			despliegue.onend = new Function('null');
			return false;
		}*/
	},
	 '#idioma' : function(el){
   		 var select_idioma = document.getElementById('select_idioma');
		 select_idioma.style.display='none';
		 el.onmouseover = function(){ 	
			/*despliegue = new Accelimation(select_idioma.style, "width", 300, 200, 0.1);
			despliegue.start();
			despliegue.onend = new Function('null');*/
			select_idioma.style.display='block';
			el.style.display='none';
			return false;
		}
		select_idioma.onmouseout = function(){
			select_idioma.style.display='none';
			el.style.display='block';
			return false;
		}
   	}
}; 

Behaviour.register(myrules);