var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

//Maneja todos los mensajes de FSCommands de la pelicula menu_banner
function menu_banner_DoFSCommand(command, args) 
{
	//Cojemos el Objeto banner-menu por si queremos hacer algo
	var PeliculaObj = InternetExplorer? menu_banner : document.menu_banner;
	
		ObtenerDatos(args,'contenido');
}



if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1)
{
document.write('<SCRIPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('Sub menu_banner_FSCommand(ByVal command, ByVal args)\n');
document.write(' call menu_banner_DoFSCommand(command, args)\n');
document.write('end sub\n');
document.write('</SCRIPT\> \n');
}


<!-- PARA LLAMADAS AJAX
var peticion = false; 
if (window.XMLHttpRequest) {
      peticion = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
            peticion = new ActiveXObject("Microsoft.XMLHTTP");
}

function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
}


function actualizaTitle(enlace,idioma){
		ajax=nuevoAjax();
		ajax.open("GET", "titulo.php?enlace="+enlace+"&lang="+idioma, true);
		ajax.onreadystatechange=function()
		{ 
			if (ajax.readyState==1)
			{
				document.title = "Cargando nuevo titulo";
			}
			if (ajax.readyState==4)
			{ 
				document.title = ajax.responseText;
			} 
		}
		ajax.send(null);
}

function ObtenerDatos(datos,divID) { 

//Cambio de titulo via ajax :P
pagina=datos.split(".");
idioma=datos.split("=");
actualizaTitle(pagina[0],idioma[1]);

if(peticion) {
     var obj = document.getElementById(divID); 
     peticion.open("GET",datos); 
	 obj.style.opacity=0.5;
     peticion.onreadystatechange = function()  { 
          if (peticion.readyState == 4) { 
               obj.innerHTML = peticion.responseText; 
			   obj.style.opacity=1;
			   
          } 
     } 
peticion.send(null); 
}
}

//Para llamar a la página de listado de los
//productos de una familia
function hijos(id) { 
	 
	 var datos="lista_productos.php?id="+id;
	 ObtenerDatos(datos,"derecha");
}
//Para llamar a la pagina de detalle de un producto
function detalle(id) { 
	 
	 var datos="detalle.php?id="+id;
	 ObtenerDatos(datos,"contenido");
}


function CambiarEstilo(id) {
	var elementosMenu = getElementsByClassName(document, "li", "activo");
	for (k = 0; k< elementosMenu.length; k++) {
	elementosMenu[k].className = "inactivo";
	}
	var identity=document.getElementById(id);
	identity.className="activo";
}

/*
    function getElementsByClassName
    Written by Jonathan Snook, http://www.snook.ca/jonathan
    Add-ons by Robert Nyman, http://www.robertnyman.com
*/

function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}


function EnviaFicha(formID) { 
	 
	 var formbarco = document.getElementById(formID); 
	 suemail=formbarco.su_email.value;
	 idioma=formbarco.idioma.value;
	 barco=formbarco.barco.value;

	 var datos="libreria/send_barco.php?idioma="+idioma+"&idbarco="+barco+"&email="+suemail;
	 ObtenerDatos(datos,"email");
}

function EnviaLista(formID) { 
	 
	 var formbarco = document.getElementById(formID); 
	 suemail=formbarco.su_email.value;
	 idioma=formbarco.idioma.value;

	 var datos="libreria/send_lista.php?idioma="+idioma+"&email="+suemail;
	 ObtenerDatos(datos,"email");
}


function ProcesaFormulario(formID) { 
	 
	 var formulario = document.getElementById(formID); 
	 nombre=formulario.nombre.value;
	 email=formulario.email.value;
	 telefono=formulario.telefono.value;
	 hora_llamada=formulario.hora_llamada.value;
	 mensaje=formulario.mensaje.value;
	 barco=formulario.barco.value;
	 idioma=formulario.idioma.value;
	 
	 var datos="libreria/send_mail.php?idioma="+idioma+"&nombre="+nombre+"&email="+email+"&telefono="+telefono+"&hora_llamada="+hora_llamada+"&mensaje="+mensaje+"&barco="+barco;
	 ObtenerDatos(datos,"derecha");
}


//FUNCIÓN PARA HACER UN FOCUS EN IE CON CSS: input.sffocus
sfFocus = function() {
	var sfEls = document.getElementsByTagName("INPUT");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfFocus);


//FUNCION PARA ABRIR Y REDIMENSIONAR IMAGENES
function PopupPic(sPicURL) { 
     window.open( "popup.htm?"+sPicURL, "",  
     "resizable=1,HEIGHT=100,WIDTH=100"); 
 } 
 
 function aparecer(id)
 {
	if (document.getElementById(id).style.display=='block')
	{
	document.getElementById(id).style.display='none'; 
	}
	else
	{
	document.getElementById(id).style.display='block'; 
	}
	
 }