var cadenaEnlace = "";
 
// abre una ventan de tipo 3 (nueva ventana con tamaño)
function abrirConTamano(queURL) {
    datos=queURL.split(",");
    if (datos.length==4) ponerscroll=1;
    else ponerscroll=0;
    ventana = window.open(datos[0],"","scrollbars="+ponerscroll+",channelmode=0,resizable=1,fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,statusbar=1,screenX=20,screenY=20,top=20,width="+datos[1]+",height="+datos[2]+",left=20");
    ventana.focus();
}

// abre una ventana de tipo 4 (con todos los parametros)
function abrirPrm(queURL) {     
    datos=queURL.split(","); 
    var dt = "scrollbars="+datos[1]+",channelmode="+datos[2]+",resizable="+datos[3]+",fullscreen="+datos[4]+",location="+datos[5]+",directories="+datos[6]+",menubar="+datos[7]+",toolbar="+datos[8]+",status="+datos[9]+",width="+datos[10]+",height="+datos[11]+",screenX="+datos[12]+",screenY="+datos[13]+",top="+datos[14]+",left="+datos[15];
    //alert("abrirPrm: features de open " + dt);
    var ventana = window.open(datos[0],"", dt);
    ventana.focus();
}

function abrirConTamanoSerNav(queURL, urlNav ) // ,idPortal, idMenu, idGrupo, idNivel, idOrden ) 
{
    datos=queURL.split(","); 
    var dt = "scrollbars="+datos[1]+",channelmode="+datos[2]+",resizable="+datos[3]+",fullscreen="+datos[4]+",location="+datos[5]+",directories="+datos[6]+",menubar="+datos[7]+",toolbar="+datos[8]+",status="+datos[9]+",width="+datos[10]+",height="+datos[11]+",screenX="+datos[12]+",screenY="+datos[13]+",top="+datos[14]+",left="+datos[15];
    //alert("abrirConTamanoSerNav: features de open " + dt);
    var ventana = window.open(urlNav,"", dt);
    ventana.focus();
}


// abre una ventana de tipo 1 (nueva ventana)
function abrir_sin(pant) {
    var ventana;
    ventana = window.open(pant,"vn","width=815,height=460,scrollbars=1,resizable=1,toolbar=1,screenX=20,screenY=20,top=20,left=20");
    ventana.focus();
}

// abre una ventana de tipo 2 (nueva ventana sin botonera)
function abrir_sin_botonera(pant) {
    var ventana;
    var top=0;
    var left=0;
    if (document.layers){
        //netscape
        top=255;
        left=192;
    }else if (document.all){
        top=270;
        left=200;
    }
    ventana = window.open(pant,"","width=550,height=250,scrollbars=1,resizable=1,toolbar=0,screenX=20,screenY=20,top="+top+",left="+left);
    ventana.focus();
}

// funcion que abre una ventana para los elementos del pie de pagina
function abrirVentanaPiePagina (opcion) {
    var laDir = "/jkn_home/Navegacion?idMenu=10011" + "&opcion=" + opcion;
    //alert("voy a saltar a " + laDir);

   var ancho = 591;//570;
   var alto = 500;
   cadScroll="scrollbars=1";
	
	/*
   if( opcion==4 || opcion==2 ){//  seguridad.jsp y avisolegal.jsp 
   	cadScroll="scrollbars=1";	
    ancho = 591;
   }else { // el resto
   	cadScroll="scrollbars=1";
   } 			
  */
    var ventana;
    ventana = window.open(laDir,opcion,"width="+ancho+",height="+alto+","+cadScroll+",resizable=1,toolbar=0,screenX=20,screenY=20,top=20,left=20");
    ventana.focus();
}

// funcion que abre los pdf's
function abrirPdf(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function abrir_clausula(pant) {
var ventana;
var top=0;
var left=0;
if (document.layers){
	//netscape4
	top=260;
	left=190;
}else if (document.all){
	top=270;
	left=200;
}
//pant = replace(pant,'&','%26');
ventana = window.open(pant,"","width=505,height=500,scrollbars=1,resizable=1,toolbar=0,screenX=20,screenY=20,top="+top+",left="+left);
ventana.focus();
}

// funcion para abrir los pdfs con la cabecera
// en pantallas HTML, primero determina si estamos
// en un kiosko o no y luego utiliza la función
// correspondiente para abrirlo.
function abrirDocumentoCabeceraPDF(sLinkPDF,sIdioma,sInforme,atributoVentana1,atributoVentana2,atributoVentana3,atributoVentana4){
	var ua=navigator.userAgent;

	if(ua.indexOf('kiosko')!=-1){
		abrirPDFCabeceraKiosko(sLinkPDF,sIdioma,sInforme,atributoVentana1,atributoVentana2,atributoVentana3,atributoVentana4);
	}else{
		abrirPDFCabecera(sLinkPDF,sIdioma,sInforme,atributoVentana1,atributoVentana2,atributoVentana3,atributoVentana4);
	}
	
	return;
}

// funcion para abrir los pdf's con la cabecera
function abrirPDFCabecera(pant, idioma, nombre, top, left, width, height) {
	
	//pant = replace(pant,'&','%26');
	var pagina = "/jkn_home/tmpl/es/VentanaPDF.jsp?pag="+pant+"&idioma="+idioma+"&t="+escape(nombre);	
	var ventana = window.open(pagina,"ventana","scrollbars=1,channelmode=0,resizable=1,fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,statusbar=0,width="+width+",height="+height+",screenX=50,screenY=50,top="+top+",left="+left);
	ventana.focus();
}

function abrirPDFCabeceraKiosko(pant, idioma, nombre, top, left, width, height) {
	var pagina = pant+"#zoom=100&toolbar=0&idioma="+idioma+"&t="+escape(nombre);
	var ventana = window.open(pagina,"ventana","scrollbars=1,channelmode=0,resizable=1,fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,statusbar=0,width="+width+",height="+height+",screenX=50,screenY=50,top="+top+",left="+left);																			
	ventana.focus();
}

// funcion que cierra la ventana actual y 
// abre el enlace en el padre
function pasarPadre (laURL) {
	if (window.opener && window.opener.closed) {
	  window.open(laURL);
	} else if (window.opener && !window.opener.closed) {
	  window.opener.location = laURL;
	} else {
		location.href = laURL;
		return;
	}
	self.close();
	if (window.opener)
	  opener.focus();
}

function abrirVentana(urlDestino,ancho,alto,ponerscroll){
 var strVentana;
 var strOpciones;
 strOpciones='scrollbars='+ponerscroll+',channelmode=0,resizable=0,fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,statusbar=0,width='+ancho+',height='+alto+',screenX=50,screenY=50';
 var ventana = window.open(urlDestino,"",strOpciones);
 //ventana.moveTo(30,20);
 ventana.focus();
}

