// JavaScript Document
/* POPUP */
function Popup(url,name,width,height,resize,scroll) {
 var dialogWin = new Object();
 dialogWin.width = width;
 dialogWin.height = height;
 if (navigator.appName == "Netscape") {
 dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
 dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
 var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
 } else if (document.all) {
 dialogWin.left = (screen.width - dialogWin.width) / 2;
 dialogWin.top = (screen.height - dialogWin.height) / 2;
 var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
 }
 window.open(url,name,attr);
}

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}


var ventana;
function aswf(idNota,cual,width,height,titulo)
{
var titulopordefecto = "Swf"
if(titulo==null){titulo=titulopordefecto}
if(width=='' || width==null){width=800+20}
if(height=='' || height==null){height=600+10}
ventana=window.open('/scripts/popSwf.asp?idNota='+idNota+'&cual='+cual+'&width='+width+'&height='+height+'&titulo='+titulo+'','ventana','resizable=yes,width='+width+',height='+height+'');
}
function aswfbanner(idbanner,nombre,width,height,titulo)
{
var titulopordefecto = "Swf"
if(titulo==null){titulo=titulopordefecto}
if(width=='' || width==null){width=800+20}
if(height=='' || height==null){height=600+10}
ventana=window.open('/scripts/popSwfBanner.asp?nombre='+nombre+'&idbanner='+idbanner+'&width='+width+'&height='+height+'&titulo='+titulo+'','ventana','resizable=yes,width='+width+',height='+height+'');
}
function aswfnota(idnota,nombre,width,height,titulo)
{
var titulopordefecto = "Swf"
if(titulo==null){titulo=titulopordefecto}
if(width=='' || width==null){width=800+20}
if(height=='' || height==null){height=600+10}
ventana=window.open('/scripts/popSwfnota.asp?nombre='+nombre+'&idnota='+idnota+'&width='+width+'&height='+height+'&titulo='+titulo+'','ventana','resizable=yes,width='+width+',height='+height+'');
}
function aflv(cual,width,height,titulo)
{
var titulopordefecto = "Flv"
if(titulo==null){titulo=titulopordefecto}
if(width=='' || width==null){width=340}
if(height=='' || height==null){height=260}
ventana=window.open('/scripts/popFlv.asp?cual='+cual+'&width='+width+'&height='+height+'&titulo='+titulo+'','ventana','resizable=yes,width='+width+',height='+height+'');
}
function amp3(cual,titulo)
{
var titulopordefecto = "Mp3"
if(titulo==null){titulo=titulopordefecto}
var width=340;
var height=40;
ventana=window.open('/scripts/popAudio.asp?cual='+cual+'&width='+width+'&height='+height+'&titulo='+titulo+'','ventana','resizable=yes,width='+width+',height='+height+'');
}
var cont=0;
if(cont==1){ventana.close();ventana=null}
function afoto(cual,width,height,titulo)
{
var titulopordefecto = "Imagen";
if(titulo==null){
	titulo=titulopordefecto;
}else{
	titulo=decodeURI(titulo);
}
//if(width==null){width=800}
//if(height==null){height=600}
ventana=window.open('','ventana','resizable=no,scrollbars=no');//width='+width+',height='+height
ventana.document.write('<html><head><style type="text/css">* {border:0px;padding:0px;margin:0px;}</style><title>' + titulo + '</title></head><body style="border:0px; padding:0px;margins:0px;" onUnload="opener.cont=0"><div style="margin:auto;"><a href="javascript:this.close()" alt="'+titulo+'"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)" style="border:none"></a></div></body></html>');
ventana.document.close();
cont++;
}

function redimensionar(ancho, alto)
{
ventana.resizeTo(ancho,alto);
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2); //centra la ventana. Eliminar si no se quiere centrar el popup
}
