var foto1
function CaricaFoto(img) {
	foto1 = new Image();
	foto1.src = (img);
//	foto1.style.border='1px solid #000';
	Controlla(img);
}

function Controlla(img) {
	if ( (foto1.width != 0) && (foto1.height != 0) ) {
		viewFoto(img);
//		alert(foto1.width +"::"+ foto1.height)
	}
	else{
		funzione = "Controlla('" + img + "')";
		intervallo = setTimeout(funzione, 500);
	}
}

function viewFoto(img) {
	largh = foto1.width+20;
	altez = foto1.height+30;
	stringa = "width=" + largh + ",height=" + altez + ",status=0 , scrollbars=yes, resizable=yes";
//	alert (stringa);
	finestra=window.open(img, "", stringa);
	finestra.focus();
	return false;
}
