// (c) Sígfrid Ollé <sigfrid.olle@ajau.upf.es>
/*
s'han de passar a la funcio totes les features (altresFeatures) excepte width, height, top i left
width i height es passen com a parŕmetre, ja sigui un numero o "auto"
en cas que no hi hagi features per passar, possar '' com a features 
*/
function PopUpCentrat(pagina, nom, ample, alt, altresFeatures) {
				if (parseInt(navigator.appVersion)>=4)  {
						if (ample=="auto") ample=screen.width-250;
						
						with (altresFeatures) {
								if (indexOf("menu")!=-1 || indexOf("tool")!=-1 || indexOf("loca")!=-1) {
										resta_alto1 = 320;
										resta_alto2 = 70;
								}
								else {
										resta_alto1 = 250;
										resta_alto2 = 40;
								}
						}
						
						if (alt=="auto") alt=screen.height-resta_alto1;
						offset_x = (screen.width - ample) / 2;  
						offset_y = (screen.height - alt) / 2 - resta_alto2;
				}
				else {
					    offset_x = 50;
						offset_y = 50;
						if (ample=="auto") ample=600;
						if (alt=="auto") alt=400;
				}
				altresFeatures += ",height="+alt+",width="+ample+",top="+offset_y+",left="+offset_x;
				return window.open(pagina, nom, altresFeatures);
}

function veure_foto(pic_url, finestra, width, height, title) {

		handle = PopUpCentrat('', finestra, width, height, 'resizable=no');
		msg_left = parseInt(width/2)-30; msg_top = parseInt(height/2)-18;
		handle.document.write("<html><head><div style='position:absolute;left:" + msg_left + "px;top:" + msg_top + "px;'><b><font face=Verdana,Arial size=2>Loading...</font></b></div><title>" + title + "</title></head><body scroll=no leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='self.focus()'><div style='position:absolute;top:0px;left:0px;'><img src=" + pic_url + " border=0 width=" + width + " height=" + height + "></div><br></body></html>");
		handle.document.close();

}
