//************************************
//
//MMImageViewer by MMStudio
//
//http://www.mm-studio.com
//
//MMStudio - tutti i diritti riservati
//
//************************************

//Apre una nuova finestra con ridimensionamento automatico
//in base alle reali dimensioni dell'immagine passata come parametro

//PARAMETRI:
//imagePath: il percorso dell'immagine
//imageDescri: titolo che dovrà apparire nella barra del titolo della finestra
//posLeft: coordinata X della posizione della finestra nello schermo
//posTop: coordinata Y della posizione della finestra nello schermo

<!--
function MMImageWindow(imagePath,imageDescri,posLeft,posTop) {
	newWindow = window.open('','MMImageWindow','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=300,height=200,left='+posLeft+',top='+posTop+',screenX='+posLeft+',screenY='+posTop);
	newWindow.document.open();
	newWindow.document.writeln('<html><title>'+imageDescri+'</title>');
	newWindow.document.writeln('<head>');
		newWindow.document.writeln('<script language="javascript"> ');
		newWindow.document.writeln('function centra() {');
			newWindow.document.writeln('var Xpos;');
			newWindow.document.writeln('var Ypos;');
			newWindow.document.writeln("window.resizeTo(document.images['foto'].width + 8,document.images['foto'].height + 40);"); 
			newWindow.document.writeln('Xpos=(screen.width-document.images["foto"].width)/2;');
			newWindow.document.writeln('Ypos=(screen.height-document.images["foto"].height)/2;');
			newWindow.document.writeln('isNS4 = (document.layers) ? true : false;');
			newWindow.document.writeln('isIE4 = (document.all && !document.getElementById) ? true : false;');
			newWindow.document.writeln('isIE5 = (document.all && document.getElementById) ? true : false;');
			newWindow.document.writeln('isNS6 = (!document.all && document.getElementById) ? true : false;');
			newWindow.document.writeln('if (isNS4) {');
				newWindow.document.writeln('obj = document.layers["IMG"];');
			newWindow.document.writeln('}');
			newWindow.document.writeln('else if (isIE4) {');
				newWindow.document.writeln('obj = document.all["IMG"];');
			newWindow.document.writeln('}');
			newWindow.document.writeln('else if (isIE5 || isNS6) {');
				newWindow.document.writeln('obj = document.getElementById("IMG");');
			newWindow.document.writeln('}');
			newWindow.document.writeln('obj.style.visibility = "visible";');
		newWindow.document.writeln('}');
		newWindow.document.writeln('</script>');
		newWindow.document.writeln('<link rel="stylesheet" href="css/default.css" type="text/css">');
	newWindow.document.writeln('</head>');
	newWindow.document.writeln('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">'); 
		newWindow.document.writeln('<div id="TEXT" style="visibility:visible; position:absolute; left:0px; top:0px; z-index:1; background-color: transparent; layer-background-color: transparent; border: none; align: center; vertical-align: middle; width: 290px; height: 170px;">'); 
			newWindow.document.writeln('<table width="100%" height="100%"><tr><td width="100%" height="100%" align="center"><font class="eng">loading image...</font></td></tr></table>'); 
		newWindow.document.writeln('</div>'); 
		newWindow.document.writeln('<div id="IMG" style="visibility:hidden; position:absolute; left:0px; top:0px; z-index:1; background-color: transparent; layer-background-color: transparent; border: none">'); 
			newWindow.document.writeln('<img src=' + imagePath + ' name=foto alt=' + imageDescri +' onLoad="javascript:centra();">'); 
		newWindow.document.writeln('</div>'); 
	newWindow.document.writeln('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
//-->
