// -----------------------------------------------------------
// 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_uai/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;
      };
    };
  };

// 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);
  };
};

// Script para ventana popup 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;

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

  // ******************************** POP VIDEO*******************************
    function subWinflash() {
    var options = "width=510,height=525,top=20,left=20,screenX=20,screenY=20,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no";
    var popwin = window.open('http://www.uai.cl/prontus_uai/site/artic/20070626/pags/20070626161536.html', 'popwin', options);
    if (popwin == undefined) {
      alert("Debes habilitar las ventanas emergentes en tu navegador para acceder a esta funcionalidad.");
    };
  };

// ******************************** INSERTAR FLASH *******************************
/**
	CVI - 2007/03
  Parámetros De La Funcion

  s: Ruta completa hacia el flash
  w: Ancho del flash (en este caso, de las imágenes)
  h: Alto del flash (en este caso, de las imágenes)
**/
function insert_flash(s, w, h) {
  var swf = s;
  var width = w;
  var height = h;

  // Esta es la sentencia recomendada por la W3C para pasar la validacion sin
  // tener que recurrir a escribir el objeto con Javascript.
  // Aún ahí se utiliza Javascript para mayor seguridad.
  document.write('<object type="application/x-shockwave-flash"');
  document.write('  data="'+swf+'"');
  document.write('  width="'+width+'"');
  document.write('  height="'+height+'">');
  document.write(' <param name="MOVIE" value="'+swf+'">');
  document.write(' <param name="PLAY" value="true">');
  document.write(' <param name="LOOP" value="true">');
  document.write(' <param name="QUALITY" value="high">');
  document.write(' <param name="WMODE" value="TRANSPARENT">');
  document.write('</object>');
};

/**
  Parámetros De La Funcion

  f: Ruta al archivo del artículo o link asociado
  w: Ancho del flash (en este caso, de las imágenes)
  h: Alto del flash (en este caso, de las imágenes)
  t: Target del link (al hacer click)
  img1-img4: rutas hacia los archivos de imágenes.
**/

// ******************************** INSERTAR PLAYER *******************************
// v 1.2
function playShow(VURL,LINK,IMAGEN) {

  var w = '160';
  var h = '200';
  var movieUrl="/prontus_uai/player/swf/player_video.swf";
  var flashvars = "VURL=" + VURL
                + "&LINK=" + LINK
                + "&IMAGEN=" + IMAGEN;
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
  document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"');
  document.write('  width="'+w+'"');
  document.write('  height="'+h+'"');
  document.write('  id="player_1.5"');
  document.write('  align="middle">');
  document.write('<param name="allowScriptAccess" value="sameDomain" />');
  document.write('<param name="movie" value="' + movieUrl + '" />');
  document.write('<param name="quality" value="high" />');
  document.write('<param name="bgcolor" value="#ffffff" />');
  document.write('<param name="flashvars" value="' + flashvars + '" />');
  document.write('<param name="WMODE" value="TRANSPARENT">');
  document.write('<embed');
  document.write('  src="' + movieUrl + '"');
  document.write('  quality="high"');
  document.write('  bgcolor="#ffffff"');
  document.write('  width="'+w+'"');
  document.write('  height="'+h+'"');
  document.write('  name="player_1.5"');
  document.write('  align="middle"');
  document.write('  allowScriptAccess="sameDomain"');
  document.write('  type="application/x-shockwave-flash"');
  document.write('  pluginspage="http://www.macromedia.com/go/getflashplayer"');
  document.write('  wmode="transparent"');
  document.write('  flashvars="' + flashvars + '"');
  document.write('  />');
  document.write('</object>');
};


// ******************************** INSERTAR PLAYER *******************************
// v 1.2
function playShow320(VURL,LINK,IMAGEN) {

  var w = '348';
  var h = '276';
  var movieUrl="/prontus_uai/player/swf/player_video320.swf";
  var flashvars = "VURL=" + VURL
                + "&LINK=" + LINK
                + "&IMAGEN=" + IMAGEN;
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
  document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"');
  document.write('  width="'+w+'"');
  document.write('  height="'+h+'"');
  document.write('  id="player_1.5"');
  document.write('  align="middle">');
  document.write('<param name="allowScriptAccess" value="sameDomain" />');
  document.write('<param name="movie" value="' + movieUrl + '" />');
  document.write('<param name="quality" value="high" />');
  document.write('<param name="bgcolor" value="#ffffff" />');
  document.write('<param name="flashvars" value="' + flashvars + '" />');
  document.write('<param name="WMODE" value="TRANSPARENT">');
  document.write('<embed');
  document.write('  src="' + movieUrl + '"');
  document.write('  quality="high"');
  document.write('  bgcolor="#ffffff"');
  document.write('  width="'+w+'"');
  document.write('  height="'+h+'"');
  document.write('  name="player_1.5"');
  document.write('  align="middle"');
  document.write('  allowScriptAccess="sameDomain"');
  document.write('  type="application/x-shockwave-flash"');
  document.write('  pluginspage="http://www.macromedia.com/go/getflashplayer"');
  document.write('  wmode="transparent"');
  document.write('  flashvars="' + flashvars + '"');
  document.write('  />');
  document.write('</object>');
};
