// Funciones JAVASCRIPT
// Variables
var navigatorName;
var navigatorVersion;
var version;
var name;
// Objetos
// Funciones
function flashCommand(args) {
  var date = new Date("June 10, 2200 00:00:01");
  deleteCookie('AudioMute');
  setCookie('AudioMute', args, date);
}
function sendEmail(to, subject, body)
{
  var first = false;
  var url = "mailto:"+to;

  if( subject != undefined && subject != "" ) { url += "?subject="+subject; first = true; }
  if( body != undefined && body != "" ) {
    if( !first ) url += "?";
    else url += "&";
    url += "body="+escape(body);
  }
  window.location = url;
}
function obtenerNavegador()
{
  navigatorName = navigator.appName;
  navigatorVersion = parseInt(navigator.appVersion);
  
  if( navigatorName == "Netscape" && navigatorVersion >= 3 )
    version = "n3";
  else if( navigatorName == "Microsoft Internet Explorer" && navigatorVersion >= 3 )
    version = "n3";
  else
    version = "n2";

  if( navigatorName == "Netscape" )
    name = "netscape";
  else if( navigatorName == "Microsoft Internet Explorer" )
    name = "explorer";
  else
    name = "undefined";
}
function switchImage(imgId, imgSrc)
{
  if( version == "n3" )
    document.images[imgId].src = imgSrc;
}
function addBookmark(URL, title) {
  if( name == "netscape" ) {
    var dateStr = Math.floor (new Date().getTime() / 1000);
    var bookmarkPrefix = "<DL><P>";
    var bookmarkSuffix = "</DL><P>";
    var bookmarkStr = '<DT><A HREF="' +
                      URL + '" ' +
                      'ADD_DATE="' +
                      dateStr + '" LAST_VISIT="'+
                      dateStr + '" LAST_MODIFIED="' +
                      dateStr + '">' + title + '</A>';
  
    try {
      netscape.security.PrivilegeManager.enablePrivilege("UniversalPropertyRead");
      var userDir = java.lang.System.getProperty("user.home");
      var filename = userDir + "\\bookmark.htm";
      netscape.security.PrivilegeManager.enablePrivilege("UniversalFileAccess");
      var inetShortcutFile = new java.io.FileWriter (filename, true);
      var line = bookmarkPrefix + "\r\n";
      inetShortcutFile.write(line, 0, line.length);
      line = bookmarkStr + "\r\n";;
      inetShortcutFile.write(line, 0, line.length);
      line = bookmarkSuffix + "\r\n";
      inetShortcutFile.write(line, 0, line.length);
      inetShortcutFile.flush();
      inetShortcutFile.close();
    }
    catch(exception) {
      if (exception.description == null) {
        alert("Excepción: " + exception.message + '. No puedo añadir a favoritos.');
      }
      else {
        alert("Excepción: " + exception.description + '. No puedo añadir a favoritos.');
      }
    }
  }
  else {
    window.external.AddFavorite(URL, title)
  }
}
function hideLinks()
{
  window.status = "";
  return true;
}
// Menu
function overTD(td, color){ td.bgColor = color; }
function outTD(td, color){ td.style.cursor = 'default'; td.bgColor = color; }
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_openBrWindow(theURL,sw,sh) {
  window.open(theURL,'NewWindow','scrollbars=yes,menubar=yes,location=yes,resizable=yes,top=0,left=0,width='+sw+',height='+sh);
}
function titular(texto, ancho, alto, align)
{
  document.writeln('  <table width="' + ancho + '" height="' + alto + '" cellspacing="0" cellpadding="0" border="0">');
  document.writeln('    <tr>');
  document.writeln('      <td width="4" class="RoundHeader"><img src="./img/1x1_pix.gif" width="2" height="6"></td>');
  document.writeln('      <td width="7" class="RoundHeader" align="center" valign="middle"><img src="img/flechana2.gif" width="7" height="7"></td>');
  document.writeln('      <td width="4" class="RoundHeader"><img src="./img/1x1_pix.gif" width="2" height="6"></td>');
  document.writeln('      <td width="'+ (ancho - (21 + alto)) +'" align="' + align + '" valign="middle" class="RoundHeader">' + texto + '</td>');
  document.writeln('      <td width="6" class="RoundHeader"><img src="./img/1x1_pix.gif" width="6" height="6"></td>');
//  document.writeln('      <td width="' + alto + '" height="' + alto + '"><img src="./img/Barra-right' + alto + 'x' + alto + '.gif" width="' + alto + '" height="' + alto + '"></td>');
  document.writeln('    </tr>');
  document.writeln('  </table>');
}

