code:
var counter, photourl, mod, flag; var photo = new Image(); function defineVars(a,b) { counter=10; flag=true; photourl=a; mod=b; photo.src=(photourl); } function createNewWindow() { while(flag) { if (photo.complete) { newWindow = window.open("","","width="+photo.width+",height="+photo.height); if (newWindow != null) { newWindow.document.write("<HTML>...</HTML>"); flag=false; } } else { if (counter>0) { counter--; /*QUA DOVREBBE ESSERCI UNA PAUSA*/ } else { alert("Image load error"); flag=false; } } } }