  var currentMenu = null;
  var currentMenuItem = null;
  var currentTimeout = null;
  var canHide = false;

  function mEnter(e) {
    e.style.background = "#FFFFFF";
    e.style.color = "#000000";
  }
  function mExit(e) {
    e.style.background = "#000000";
    e.style.color = "#FFFFFF";
  }

  function showMenu(menuid, m, nombre) {
    // Nasconde il menu precedentemente visualizzato (se esiste)
    if (currentTimeout != null) {
      clearTimeout(currentTimeout);
      canHide = true;
      hideMenu();
    }
    // Trova la barra ed il menu indicato
    var menubar = document.getElementById(nombre);
    var menu = document.getElementById(menuid);
    // Imposta su false il flag per nascondere automaticamente
    canHide = false;
    // Seleziona il menu corrente
    currentMenu = menu;
    currentMenuItem = m;
    // Evidenzia la voce selezionata nella barra
   // mEnter(m);
    // Calcola la posizione e rende visibile il menu
    var x = menubar.offsetLeft + m.offsetLeft;
    var y = menubar.offsetTop + m.offsetTop + 21;
    menu.style.left = x + "px";
    menu.style.top = y + "px";
    menu.style.visibility = "visible";
    // Avvia il nuovo timeout
    currentTimeout = setTimeout("hideMenu()", 1000);
  }

  function hideMenu() {
    if (currentMenu != null && currentMenuItem != null && canHide) {
      currentMenu.style.visibility = "hidden";
      //mExit(currentMenuItem);
      currentMenu = null;
      currentMenuItem = null;
      canHide = false;
    } else currentTimeout = setTimeout("hideMenu()", 1000);
  }

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function comprueba_busqueda(miformulario){

	if(miformulario.busqueda.value==""){
		alert("No has introducido el criterio de busqueda");
		return false;
	}else{
		return true;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function cambia_productos(n,k){

if(k==1){
 
	var miformulario=eval("document.f1"+n);
    var especialidades = miformulario.especialidades[miformulario.especialidades.selectedIndex].value;
    mis_productos=eval("n_" + n + "productos_" + especialidades);
	num_productos = mis_productos.length;
    miformulario.c_productos.length = num_productos;
       for(i=0;i<num_productos;i++){ 
          miformulario.c_productos.options[i].value=mis_productos[i];
          miformulario.c_productos.options[i].text=mis_productos[i];
       } 
    miformulario.c_productos.options[0].selected = true;

    var productos = miformulario.especialidades.selectedIndex;
	mis_homologaciones=eval("n_"+ n+"homologaciones_" + productos +"_0");
    num_homologaciones = mis_homologaciones.length;
    miformulario.homologaciones.length = num_homologaciones;
       for(i=0;i<num_homologaciones;i++){ 
          miformulario.homologaciones.options[i].value=mis_homologaciones[i];
          miformulario.homologaciones.options[i].text=mis_homologaciones[i];
       } 
    miformulario.homologaciones.options[0].selected = true;	
}
}

function cambia_homologaciones(n){
	var miformulario=eval("document.f1"+n);
    var especialidad = miformulario.especialidades.selectedIndex;
	var productos = miformulario.c_productos.selectedIndex;
	mis_homologaciones=eval("n_" + n+"homologaciones_" + especialidad +"_" + productos);
    num_homologaciones = mis_homologaciones.length;
    miformulario.homologaciones.length = num_homologaciones;
	   for(i=0;i<num_homologaciones;i++){ 
		  miformulario.homologaciones.options[i].value=mis_homologaciones[i];
		  miformulario.homologaciones.options[i].text=mis_homologaciones[i];
	   } 
    miformulario.homologaciones.options[0].selected = true;
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
  
}
function getMouseLoc(e)
{
  if(!document.all)  //NS
  {
    mouseLocation.x = e.pageX;
    mouseLocation.y = e.pageY;
  }
  else               //IE
  {
    mouseLocation.x = event.x + document.body.scrollLeft;
    mouseLocation.y = event.y + document.body.scrollTop;
  }
  return true;
}

function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}


function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}


function moveLayerToMouseLoc(theLayer, offsetH, offsetV)
{
  var obj;
  if ((findObj(theLayer))!=null)
  {
    if (document.layers)  //NS
    {
      document.onMouseMove = getMouseLoc;
      obj = document.layers[theLayer];
      obj.left = mLoc.x +offsetH;
      obj.top  = mLoc.y +offsetV;
    }
    else if (document.all)//IE
    {
      getMouseLoc();
      obj = document.all[theLayer].style;
      obj.pixelLeft = mLoc.x +offsetH;
      obj.pixelTop  = mLoc.y +offsetV;
    }
    showHideLayers(theLayer,'','show');
  }
}
// get mouse location
function Point(x,y) {  this.x = x; this.y = y; }
mLoc = new Point(-500,-500);
function getMouseLoc(e)
{
  if(!document.all)  //NS
  {
    mLoc.x = e.pageX;
    mLoc.y = e.pageY;
  }
  else               //IE
  {
    mLoc.x = event.x + document.body.scrollLeft;
    mLoc.y = event.y + document.body.scrollTop;
  }
  return true;
}
//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }

//-->
