	function AbreVentanaImprimirEtiquetasCentros( urlSerlvetPDF ){
		url = "/intranet/admin-intranet/fichas/centros/impresion/imprimir_etiquetas.jsp?url=" + urlSerlvetPDF;
		AbreNuevaVentana('EtiquetasCentros', url, 650, 250 );
		return void(0);
	}
	function AbreVentanaImprimirEtiquetasPersonas( urlSerlvetPDF ){
		url = "/intranet/admin-intranet/fichas/personas/impresion/imprimir_etiquetas.jsp?url=" + urlSerlvetPDF;
		AbreNuevaVentana('EtiquetasPersonas', url, 650, 250 );
		return void(0);
	}

	//abre nueva ventana para seleccionar los campos que saldran en el informe de los centros
	function AbreVentanaImprimirListadoCentros( urlSerlvetPDF, total, ordenar_por ){
		url = "/intranet/admin-intranet/fichas/centros/impresion/seleccionar_campos_listado.jsp?url=" + urlSerlvetPDF+"&total="+total+"&ordenar_por="+ordenar_por;
		AbreNuevaVentana('CamposInforme', url, 700, 700 );
		return void(0);
	}
	
	function AbreVentanaImprimirListadoPersonas( urlSerlvetPDF, total ){
		url = "/intranet/admin-intranet/fichas/personas/impresion/seleccionar_campos_listado.jsp?url=" + urlSerlvetPDF+"&total="+total;
		//popWindow=open(url,'CamposInformePersona', "width=700,height=750");
		AbreNuevaVentana('CamposInformePersona', url, 700, 700 );
		return void(0);
	}

	function AbreVentanaExportarDatosPersonas( ordenar_por ){
		url = "/intranet/admin-intranet/fichas/personas/exportar/seleccionar_campos.jsp?&ordenar_por="+ordenar_por;
		AbreNuevaVentana('CamposExportarPersona', url, 700, 700 );
		return void(0);
	}

	function AbreVentanaExportarDatosCentros( ordenar_por ){
		url = "/intranet/admin-intranet/fichas/centros/exportar/seleccionar_campos.jsp?&ordenar_por="+ordenar_por;
		AbreNuevaVentana('CamposExportarCentros', url, 700, 550 );
		return void(0);
	}

	function AbreVentanaVistaPrevia ( param ) {
		url = "/intranet/admin-intranet/mailing/mensajes/vista_previa/index.jsp"+param;
		AbreNuevaVentana('VistaPrevia', url, 700, screen.height * 8 / 10 );
		return void(0);
	}

	function AbreVentanaPreformateado (nombre_frm) {
		url = "/intranet/admin-intranet/mailing/mensajes/editar_preformato.jsp?formulario=" + nombre_frm;
		AbreNuevaVentana('Preformateado', url, 700, 350 );
		return void(0);
	}
	
	function AbreVentana(url,width,height) {
		windowName = "Mailing"
        agent=navigator.appVersion;
        version=parseInt(agent);
        
        //figure out the top/left of the screen
        //taking the menu bar into consideration
        if (version>=4) {
                leftCorner=screen.width/2 - width/2;
                topCorner=screen.height/2 - height/2;
        }else{
                leftCorner=20;
                topCorner=20;
        }
        features=",screenX="+leftCorner+",screenY="+topCorner+",left="+leftCorner+",top="+topCorner;
        features=features+",titlebar=0,location=0,status=1,toolbar=0,resizable=0,scrollbars=0";

		if (popWindow==null) {
                popWindow=open(url,windowName, "width="+width+",height="+height+ features);
                // for IE3, focus, closed, and opener doesn't work, so we have to tell
                // the window opened who's the opener
                if (version<3) 
                        setTimeout("popWindow.mama=window",250);
        }else{
                if (version<3) {
                        popWindow.close();
                        popWindow=null;
                        setTimeout("open_window('"+url+"',"+width+","+height+")", 250);
                        setTimeout("popWindow.mama=window",500);
                }else if (!popWindow.closed){
                        popWindow.close();
                        popWindow=null;
                        setTimeout("open_window('"+url+"',"+width+","+height+")", 250);
                        
                }else{
                        popWindow=null;
                        popWindow=open(url,windowName, "width="+width+",height="+height+features);
                }
        }
		return void(0);
	}

	function AbreNuevaVentana(name,url,width,height) {
	//alert("Esto por lo menos lo ha vistoooxxx");
		windowName = name;
        agent=navigator.appVersion;
        version=parseInt(agent);
        
        //figure out the top/left of the screen
        //taking the menu bar into consideration
        if (version>=4) {
                leftCorner=screen.width/2 - width/2;
                topCorner=screen.height/2 - height/2;
        }else{
                leftCorner=20;
                topCorner=20;
        }
        features=",screenX="+leftCorner+",screenY="+topCorner+",left="+leftCorner+",top="+topCorner;
        features=features+",titlebar=1,location=0,status=1,toolbar=no,resizable=yes,scrollbars=yes";

		if (popWindow==null) {
		
                popWindow=open(url,windowName, "width="+width+",height="+height+ features);
                // for IE3, focus, closed, and opener doesn't work, so we have to tell
                // the window opened who's the opener
				
                if (version<3) 
                        setTimeout("popWindow.mama=window",250);
        }else{
                if (version<3) {
                        popWindow.close();
                        popWindow=null;
                        setTimeout("open_window('"+url+"',"+width+","+height+")", 250);
                        setTimeout("popWindow.mama=window",500);
                }else if (!popWindow.closed){
                        popWindow.close();
                        popWindow=null;
                        setTimeout("open_window('"+url+"',"+width+","+height+")", 250);
                        
                }else{
                        popWindow=null;
                        popWindow=open(url,windowName, "width="+width+",height="+height+features);
                }
        }
		return void(0);
	}

	function resizeOuterTo(w,h) {
		if (parseInt(navigator.appVersion)>3) {
			if (navigator.appName=="Netscape") {
		    	top.outerWidth=w;
			    top.outerHeight=h;
	   		} else {
				top.resizeTo(w,h);
				top.moveTo(self.screen.width/2 - w/2, self.screen.height/2 - h/2);
			}
		}
	}

	function resizePorciento(porciento) {
		//find the current frame width and height
		if (self.innerWidth)
		{
			frameWidth = self.innerWidth;
			frameHeight = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientWidth)
		{
			frameWidth = document.documentElement.clientWidth;
			frameHeight = document.documentElement.clientHeight;
		}
		else if (document.body)
		{
			frameWidth = document.body.clientWidth;
			frameHeight = document.body.clientHeight;
		}
		else return;

		if (self.screen.width < frameWidth*2 || self.screen.height < frameHeight*2)
		{
			//Nuevo tamaņo de la ventana
			oldWidth = self.screen.width;
			oldHeight = self.screen.height;
			newWidth = self.screen.width - self.screen.width*porciento/100;
			newHeight = self.screen.height - self.screen.height*porciento/100;

			//Para el bug de Netscape 4
			if (document.layers)
			{
				tmp1 = parent.outerWidth - parent.innerWidth;
				tmp2 = parent.outerHeight - parent.innerHeight;
				newWidth -= tmp1;
				newHeight -= tmp2;
			}
			parent.window.resizeTo(newWidth,newHeight);
			parent.window.moveTo(oldWidth/2-newWidth/2, oldHeight/2-newHeight/2);
		}
		else
		{
			//If either of them is more than half the window size, calculate the initial new width and height: half the screen width and height.
			//alert('No resize necessary');
			return;
		}

	}
	
	function resizeMitad()	{
		//find the current frame width and height
		if (self.innerWidth)
		{
			frameWidth = self.innerWidth;
			frameHeight = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientWidth)
		{
			frameWidth = document.documentElement.clientWidth;
			frameHeight = document.documentElement.clientHeight;
		}
		else if (document.body)
		{
			frameWidth = document.body.clientWidth;
			frameHeight = document.body.clientHeight;
		}
		else return;
	
		if (self.screen.width < frameWidth *2 || self.screen.height < frameHeight *2)
		{
			//Nuevo tamaņo de la ventana
			newWidth = self.screen.width/2;
			newHeight = self.screen.height/2;
			
			//Para el bug de Netscape 4
			if (document.layers)
			{
				tmp1 = parent.outerWidth - parent.innerWidth;
				tmp2 = parent.outerHeight - parent.innerHeight;
				newWidth -= tmp1;
				newHeight -= tmp2;
			}
			parent.window.resizeTo(newWidth,newHeight);
			parent.window.moveTo(self.screen.width/4,self.screen.height/4);
		}
		else
		{
			//If either of them is more than half the window size, calculate the initial new width and height: half the screen width and height.
			alert('No resize necessary');
		}
	}
	


