function AbrirVentana(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4  

	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Clic para pechar">'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}
function Ver(imagen, ancho, alto) {

	var agt=navigator.userAgent.toLowerCase();
	var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
	var is_ie   = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_opera = (agt.indexOf("opera") != -1);
	
	anchov = (ancho);
	altov = (alto)+15;
	if (anchov<210) {
		anchov=210;
	}
	barras="no";
	var x=0, y=0;
	if ((screen.availHeight -50 ) <= altov) {
		altov = screen.availHeight - 50;
		anchov = anchov + 20;
		barras = "yes";
		y=5;
	}
	
	if ((screen.availWidth -50 ) <= anchov) {
		anchov = screen.availWidth - 50;
		barras = "yes";
		
	}
	if (x<=0) {
		x= (screen.availWidth-anchov)/2;
	}
	if (y<=0) {
		y = (screen.availHeight-altov)/2;
	}
	
	vimagen=window.open("","", "toolbar=no, location=no, directories=no, status=no, scrollbars=" + barras +", menubar=no, resizable=no, width=" + anchov + ", height=" + altov + ", left="+ x+ ", top="+ y);	
	vimagen.document.write ("<html><head><title>Imagen</title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>");
	vimagen.document.write ("<link href='../estilos/estilos.css' rel='stylesheet' type='text/css'>");
	vimagen.document.write ("</head>");
	vimagen.document.write ("<body bgcolor='#2F2F2F' text='#000000' leftmargin='0' topmargin='0'>");
	vimagen.document.write ("<table border='0' cellspacing='0' cellpadding='0' width='100%' align='center'>");
	vimagen.document.write ("<tr><td><table border='0' cellspacing='0' cellpadding='0' width='100%'>");
	vimagen.document.write ("<tr><td></td></tr>");
	vimagen.document.write ("<td></td></tr></table></td></tr>");
	vimagen.document.write ("<tr><td valign='top' align='center'><img border='0' src='"+imagen+"' width='"+ancho+"' height='"+alto+"'></td></tr></table>");
	vimagen.document.write ("</body></html>");
	vimagen.document.close ();
}
function imprimirPagina() {
  if (window.print)
    window.print();
  else
    alert("Lo siento, pero a tu navegador no se le puede ordenar imprimir" +
      " desde la web. Actualizate o hazlo desde los menús");
}
<!--Esta é a forma en que os de Rianxo abren as imaxes-->
function showImg (num) {
			w = window.open(( prefix +(current+num)+".jpg"),"Imaxe",
"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600")
			w.moveTo(((screen.width-800)/2),((screen.height-600)/2));
			w.document.write('<head><title>' + titles[current+num-1] + '</title></head>');
			w.document.write('<body style="margin:0px;background:#333366"><center><img id="img" src="' + prefix +(current+num)+ '.jpg">');
      setTimeout("resizeOnLoad()",1000);
						}
function centrada(url) {
				w = window.open(url,"Guadalupe_2004","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=auto, resizable=no, copyhistory=no, width=480, height=" + screen.height);
				w.moveTo((screen.width-480)/2,0);
			}
function completa(url) {
				w = window.open(url,"Guadalupe_2004","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=790, height=" + (screen.height-60));
				w.moveTo((screen.width-800)/2,0);
			}
function centrada2(url, width, height) {
				w = window.open(url,"Guadalupe_2004","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=" + width + ", height=" + height);
				w.moveTo((screen.width-width)/2,(screen.height-height)/2);
			}
function completa_anuncios(url) {
				w = window.open(url,"Guadalupe_2004","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=750, height=400, top=" + (screen.height/2-200) + ", left=" + (screen.width/2-375));
			}
function panoramicas(url) {
				w = window.open(url,"Guadalupe_2004","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=480, height=360, top=" + (screen.height/2-180) + ", left=" + (screen.width/2-240));
				//w.moveTo((screen.width-800)/2,0);
			}
function meteoroloxia(url) {
				w = window.open(url,"Meteoroloxía","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=720, height=520, top=" + (screen.height/2-280) + ", left=" + (screen.width/2-375));
			}
function escudo(url) {
				w = window.open(url,"Guadalupe_2004","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=650, height=500, top=" + (screen.height/2-250) + ", left=" + (screen.width/2-375));
			}
function ventanaPatrimonio(URL){ 
 if (screen.width >= 1024)
  window.open(URL,"ventana1",'width=700,height=420,top=70, left=162')
  	if (screen.width < 1024)
  window.open(URL, "ventana1",'width=600, height=420,top=70, left=85')
} 