bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
        if ((bName == "Netscape" && bVer >= 3) ||
            (bName == "Microsoft Internet Explorer" && bVer >= 4)) br = "n3";
        else br = "n2";

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();
if (bName == "Microsoft Internet Explorer" && bVer >= 4) onresize=XPLO_reloadPage; 
if (bName == "Netscape" && bVer >= 5) onresize=XPLO_reloadPage;
}


function XPLO_reloadPage()
{
// AAA layer IE relocate
    //if (block1)posBlock (0)

  // mio 2005
     for (i=1;i<numenu+1;i++) {
            posBlock(i)
          }
}

reloadchk = true
if (navigator.appVersion.indexOf("Mac")!=-1)
reloadchk = (is.ns)? false : true;

if (reloadchk)MM_reloadPage(true);



// Liquid Effect
// finds the width/height of the browser and reloads the page when resized to create a liquid layout
// 19990328

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/

function findWH() {
    winW = (is.ns)? window.innerWidth : document.body.offsetWidth-20
    winH = (is.ns)? window.innerHeight : document.body.offsetHeight-4
}
function makeLiquid() {
    if ((is.ns && (winW!=window.innerWidth || winH!=window.innerHeight)) || is.ie)
    history.go(0)
}

activo = null
inplace = null
function iniciamenu() {

         DynLayerInit()

          //blockPosy  = (is.ns)? blockPosy : blockPosy + 4

          for (i=1;i<numenu+1;i++) {

            eval('block'+i+' = new DynLayer("block'+i+'Div")')
            eval('block'+i+'.hide()');
            eval('block'+i+'.clipTo('+clipmenu+')')
            posBlock(i)
            inplace = 1
          }


		 // por problema de  iniciacion de xplorer para evitar x no definido y lentitud de scroll de página

         //initMouseEvents()
		 setTimeout("initMouseEvents()",200) 
  		for (i=1;i<numenu+1;i++) {
			setTimeout("menuActivo("+i+")",i*100*i);        
 		}
      
}

function posBlock (n)
{

 findWH()

 if (winW > 720)
 {
  // mitad tabla = 386 offsetleft = -8
  mtab = 386
  mtab  = (is.ns)? 386 : 386
  offleft = (is.ns)? 5 : 5;
  posici = n
  posici = (n-1) * sizemenu  - (offleft * (n-1))
  posici = posici
  blockPosx = (winW/2) - mtab  + posici;
  if (navigator.appVersion.indexOf("Mac")!=-1) { blockPosx = (is.ns)? (winW/2) - mtab  -27 : (winW/2) - mtab  -10;}
  if (eval('block'+i)){ eval('block'+i+'.moveTo(blockPosx, blockPosy)')};
  }
 else
 {
   blockPosx = (is.ns)? -16 : - 14;
   if (eval('block'+i)){ eval('block'+i+'.moveTo(blockPosx, blockPosy)')};
 }

}

function menuActivo(id,nada)
{

   if (inplace){
   //apagamos todas
     for (i=1;i<numenu+1;i++) {
         eval('block'+i+'.hide()');
      }

       // encendemos una

      eval('block'+id+'.show()');
      eval('activo=block'+id);
    }

}



function DynMouseDown(x,y) 
{

  if (checkDentro(activo,x,y))
   {

        activo.show()

   }



return true
}

function DynMouseMove(x,y) 
{


      if (checkFuera(activo,x,y))
      {

          activo.hide()

      }

       if (y > (blockPosy + altblock )) {
       // si esta por debajolinea menus apagamos todas
         for (i=1;i<numenu+1;i++) {
            eval('block'+i+'.hide()');
         }
      }

return true
}

function checkFuera(objeto,x,y)
{
//alert(objeto.x+" " + objeto.h +" "+ objeto.y+" " + objeto.w+" -"+x+" "+y)
if ((x<=objeto.x || x>=objeto.w + objeto.x) && (y<=objeto.y || y>=objeto.y+objeto.h)) {
   return true
	}
    else 
	{
	return false
}

}
function checkDentro(objeto,x,y)
{
if (x>=objeto.x && x<=objeto.w + objeto.x && y>=objeto.y && y<=objeto.y+objeto.h) return true
    else return false


}

