// JavaScript Document
function abreventana(URL_Ventana, OpcionesVentana, Ancho, Alto, Centrada, PosX, PosY)
{
   if (Centrada)
   {
      PosX = (screen.availWidth - Ancho)/2;
      PosY = (screen.availHeight - Alto)/2;
   }

   if (OpcionesVentana == '')
   {
      OpcionesVentana = 'width=' + Ancho;
   } else {
      OpcionesVentana += ',width=' + Ancho;
   }

  OpcionesVentana += ',height=' + Alto + ',left=' + PosX + ',top=' + PosY;
  window.open(URL_Ventana, "", OpcionesVentana);
}

function abreventana_foto(URL_Ventana, ancho, alto)
{
	abreventana(URL_Ventana, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0, ', ancho, alto, true)
}   

function ampliarimagen( imagen, ancho, alto ) {
	ventana_crea( imagen, ancho, alto, 'Portal Fogueres');
}


	function ventana_crea ( foto, ancho, alto, titulo ) {
		// Declaro variables
			var ventana;
			var titulodefecto = ' Les Fogueres de Sant Joan :: Portal Fogueres :.'; 
			var titulo;
		// Compruebo titulo
			if ( titulo == null ){ titulo = titulodefecto; }
		// Cordenadas para centrar ventana			
            posX = (screen.availWidth - ancho) / 2;
            posY = (screen.availHeight - alto) / 2;
		// Opciones de la ventana
			opventana = 'width=' + ancho + ', height=' + alto + ', left=' + posX + ', top=' + posY + ', resizable=no, scrollbars=no';
		// Creo la ventana 
			ventana = window.open('', 'ventana' , opventana );
			ventana.document.write( '<html> <head> <title> ' + titulo + ' </title> <style> body {margin:0px;} </style> </head> <body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no"><img src="'+foto+'" width=' + ancho + ' height=' + alto + ' alt="Haz click para cerrar / click to close" title="Haz click para cerrar / click to close" onclick="window.close();" >');
//			ventana.document.write( '<html> <head> <title> ' + titulo + ' </title> <style> body {margin:0px;} </style> </head> <body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no"><div style="background-image:url(\''+foto+'\')";><img src="/img/imagen_ampliada.gif" width=' + ancho + ' height=' + alto + ' alt="Haz click para cerrar / click to close" title="Haz click para cerrar / click to close" onclick="window.close();" ></div>');
			ventana.document.close();
	}
