/*
	Comportamientos genéricos del diseño general de la web.
*/
addLoadEvent
(
	function() 
	{
		// Preparar el buscador general.
		if (document.getElementById)	// DOM
		{
			var oBotonBusqueda = document.getElementById('buscarbot');		// Botón de búsqueda
			var oCampoBusqueda = document.getElementById('buscandotext');	// Campo de búsqueda
			if (oCampoBusqueda)
			{
				// Proporcionar un texto orientativo en el buscador.
				oCampoBusqueda.value = oCampoBusqueda.title;
				oCampoBusqueda.className = 'buscartext_default';
				oCampoBusqueda.onblur = function()
				{
					if (this.value == '')
					{
						this.value = this.title;
						this.className = 'buscartext_default';
					}
				};
				oCampoBusqueda.onfocus = function()
				{
					if (this.value == this.title)
					{
						this.value = '';
						this.className = 'buscartext';
					}
				};
				// Controlar que no se realice una búsqueda sin que el usuario haya introducido un texto que no es el de por defecto.
				if (oBotonBusqueda)
				{
					oBotonBusqueda.onclick = function()
					{
						if (this.form.q.value == this.form.q.title) 
						{
							alert('Debe escribir algún valor de búsqueda.'.replace('ú', '\xFA').replace('ú', '\xFA')); 
							return false;
						}
					};
				}
			}
			
		}
		
		// Emular hover del menu en IE6.
		// Creado para que en IE6, el menu horizontal sea funcional.
		if (document.all && document.getElementById) 
		{
			var navRoot = document.getElementById("navmenu");
			for (i = 0; i < navRoot.childNodes.length; i++) 
			{
				var node = navRoot.childNodes[i];
				if (node.nodeName.toUpperCase() == "LI") 
				{
					node.onmouseover = function() { this.className += " over"; }
					node.onmouseout=function() { this.className = this.className.replace(" over", ""); }
				}
			}
		}

	}
);
