/* Open Picture Window */

/* Vistazo rapido:
	- Se puede eliminar isCenter, para aplicarlo siempre
	- Se puede anyadir una variable de tipo de objeto (imagen, animacion, pagina)
	   para seleccionar el codigo que se va a emplear o, mediante codigo, averiguar la
	   extension del archivo y realizar la seleccion automatica.
	- Comprobar el uso de winName para omitirlo	   
*/

//function ald_OpenPictureWindow(theURL, winName, features, myWidth, myHeight, isCenter, myTitle)
function abrirVentana(theURL, features, myWidth, myHeight, myTitle)
{
	
	var ald_opw = null;
	var settings;
	
	/* Anyadimos el margen de los bordes de ventana y la barra de titulo */ 
	settings = 'width='+myWidth+',height='+myHeight;
	
	if(!myTitle) myTitle = "Brought to you by Open Picture Window Plugin";
	
	//if(isCenter)		// Position in center of window
	//{
		var myLeft = (screen.width) ? (screen.width-myWidth)/2 : 0;
		var myTop = (screen.height) ? (screen.height-myHeight)/2 : 0;
		
		settings +=',left='+myLeft+',top='+myTop;
	//}
	
	if(features!='') settings +=','+features;		// add features passed as argument
	
	/* Recuperamos la extension del archivo a abrir */
	var extension;
	extension = theURL.substring(theURL.lastIndexOf('.')+1);
	
	/* Segun la extension, abrimos el archivo o lo incluimos en un html */
	switch(extension)
	{	
		case "jpg":{}
		case "png":{}
		case "gif":{}
		case "jpeg":{}
		case "bmp":
		{
			//ald_opw = window.open('',winName,settings);	
			ald_opw = window.open('','ventanan', settings);		
	
			/* 
	  	 	Lo siguiente es necesario para eliminar el margen de body adicional
	  	 	en caso de imagenes, videos o animaciones. Objetos insertados dentro
	  	 	del codigo html. Si el destino es una pagina completa, no es necesario
	   		definir el documento 
			*/
	
			with (ald_opw.document)
			{
				open('text/html', 'replace');
				write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n');
				write('<html xmlns="http://www.w3.org/1999/xhtml">\n');
				write('<head><title>');
				write(myTitle);
				write('</title>\n');
				write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n');
				write('<meta http-equiv="imagetoolbar" content="no" />\n');
				write('<meta name="generator" content="Open Picture Window Plugin" />\n');
				write('<script type="text/javascript">\n');
				write('self.focus()\n');
				write('</script>\n');
				write('</head>\n');
				write('<body style="border:0;margin:0">\n');
		
				/* Aqui se inserta el objeto en cuestion */
		
				write('<img src="%27+%20theURL%20+%27.html" ');
				write('title="'+ myTitle +'" alt="'+ myTitle +'" ');
				write('/>\n');
		
				/* Fin de la insercion del objeto */
		
				write('</body>
<!-- Mirrored from www.iculturae.com/3303/peris/web/wp-content/plugins/ald-openpicturewindow/ald-openpicturewindow.js by HTTrack Website Copier/3.x [XR&CO'2005], Mon, 28 Jan 2008 11:04:34 GMT -->
</html>\n');
				close();
			}
			break;
		}//Fin del case imagenes
		case "html":{}
		case "php":
		{
			window.open(theURL,'ventanan', settings);
			break;
		}//Fin del case documentos hipertexto
		case "swf":
		{
			ald_opw = window.open('','ventanan', settings);		
			with (ald_opw.document)
			{
				open('text/html', 'replace');
				write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n');
				write('<html xmlns="http://www.w3.org/1999/xhtml">\n');
				write('
<!-- Mirrored from www.iculturae.com/3303/peris/web/wp-content/plugins/ald-openpicturewindow/ald-openpicturewindow.js by HTTrack Website Copier/3.x [XR&CO'2005], Mon, 28 Jan 2008 11:04:34 GMT -->
<head><title>');
				write(myTitle);
				write('</title>\n');
				write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n');
				write('<meta http-equiv="imagetoolbar" content="no" />\n');
				write('<meta name="generator" content="Open Picture Window Plugin" />\n');
				write('<script type="text/javascript">\n');
				write('self.focus()\n');
				write('</script>\n');
				write('</head>\n');
				write('<body style="border:0;margin:0">\n');
		
				/* Aqui se inserta el objeto en cuestion */
		
				write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+myWidth+'" height="'+myHeight+'">');
				write('<param name="movie" value="'+theURL+'" />');
				write('<param name="quality" value="high" />');
      			write('<embed src="%27+theURL+%27.html" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+myWidth+'" height="'+myHeight+'">');
				write('</embed>');
    			write('</object>');
				
				/* Fin de la insercion del objeto */
		
				write('</body>
<!-- Mirrored from www.iculturae.com/3303/peris/web/wp-content/plugins/ald-openpicturewindow/ald-openpicturewindow.js by HTTrack Website Copier/3.x [XR&CO'2005], Mon, 28 Jan 2008 11:04:34 GMT -->
</html>\n');
				close();
			}
			break;
		}//Fin del case animacion
		default:
		{
			window.open(theURL,'ventanan', settings);
			break;
		}//Fin del case default
	}//Fin del switch
}
