// -----------------------------------------------------------
// Script para botones head
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

// funcion para ventana pop-up con scroll.

  function subWin(loc, nom, ancho, alto, posx, posy) {
    var options="toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0,location=0,directories=0,width=" + ancho + ",height=" + alto + ",left=" + posx + ",top=" + posy + ",screenX=" + posx + ",screenY=" + posy;

    window.name = 'top';
    var win = window.open(loc,nom,options);
    win.focus();
    // win.moveTo(posx, posy);
  };

// -----------------------------------------------------------
// Script para ventana popup sin scroll.
function subWin2(loc, nom, ancho, alto, posx, posy) {
  var options="toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,location=0,directories=0,width=" + ancho + ",height=" + alto + ",left=" + posx + ",top=" + posy + ",screenX=" + posx + ",screenY=" + posy;

  var win = window.open(loc, nom, options);
  win.focus();
  if ( (posx > 0) && (posy > 0) ) {
    // win.moveTo(posx, posy);
  };
};

// Sirve para cambiar imágenes entre botones
// TODO: Validación del Area Javascript


// -----------------------------------------------------------
// Para que los subtitulos no queden debajo de la barra.
function escrol(estop) {
  setTimeout("window.scrollBy(0,-30)",500);
  window.location = estop;
};

// Script para efecto onMouseOver.
var BROWSER_VALIDO = false;
// alert(navigator.appName + ' ' + parseInt(navigator.appVersion) + ' ' + navigator.userAgent + ' ' + navigator.userAgent.indexOf('MSIE 5'));
if ( (navigator.appName == "Netscape") || (navigator.appName == "Microsoft Internet Explorer") ) {
	if ( (parseInt(navigator.appVersion) >= 5) || (navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0) ) {
	  BROWSER_VALIDO = true;
	};
};


  var verok = 1; //version adecuada del navigator.
  browserName = navigator.appName;
  browserVer = parseInt(navigator.appVersion);
  if ((browserName == "Netscape" && browserVer >= 3)
     || (browserName == "Microsoft Internet Explorer" && browserVer >= 4) ) {
    verok = 1;
  } else {
    verok = 0;
  };

  var path    = '/prontus_consejo/imag/';
  var imagidx = 'none'; // Imagen inicialmente seleccionada.
  var img_portada = 'none'; // Imagen de la portada.

  function findIMG(nom) {
    var i;
    if (document[nom]) {
      return document[nom];
    };
    if (document.layers) {
      for(i=0; i < document.layers.length; i++) {
        // alert('entro find ' + eval('document.bodyNode.document.' + nom.substring(1, nom.length) + '.document.' + nom + '.src') + ' ' + nom);
        if (document.layers[i].document[nom]) {
          return document.layers[i].document[nom];
        }else if (eval('document.bodyNode.document.' + nom.substring(1, nom.length) + '.document.' + nom)) {
          return eval('document.bodyNode.document.' + nom.substring(1, nom.length) + '.document.' + nom);
        };
      };
    }else{
      if (document.all) {if (document.all[nom]) { return document.all[nom]; }; };
      if (document.getElementById(nom)) { return document.getElementById(nom); };
    };
  }; // findIMG

  function ima_ck(nom, dir) {
    var aux = imagidx;
    imagidx = nom;
    ima_of(aux, dir);
    ima_on(imagidx, dir);
    return true;
  };

  function ima_on(nom, dir, tipo) {
    var x;
    if ((verok == 1) && (nom != 'none') && (nom != imagidx)) {
      x = findIMG(nom);
      if (x) {
        x.src = '';
        if (tipo) {
          x.src = path + dir + '/'+ tipo + '_on.gif';
        }else{
          x.src = path + dir + '/'+ nom + '_on.gif';
        };
        return true;
      };
    };
  };

  function ima_ac(nom, dir) {
    var x;
    if ((verok == 1) && (nom != 'none')) {
      x = findIMG(nom);
      if (x) {
        nom = nom.substring(0, 2) + 1;
        x.src = path + dir + '/'+ nom + '_on.gif';
        return true;
      };
    };
  };

  function ima_of(nom, dir, tipo) {
    var x;
    if ((verok == 1) && (imagidx != nom) && (nom != 'none')) {
      x = findIMG(nom);
      if (x) {
        if (img_portada.substring(0, 2) == nom.substring(0, 2)) {
          x.src = path + dir + '/'+ img_portada + '_on.gif';
        }else{
          if (tipo) {
            x.src = path + dir + '/'+ tipo + '_of.gif';
          }else{
            x.src = path + dir + '/'+ nom + '_of.gif';
          };
        };
        return true;
      };
    };
  };
  
 