// JavaScript Document
function viewPic(img)
{ 	
    picfile = new Image(); 
    picfile.src =(img); 
    fileCheck(img); 
}
function fileCheck(img)
{ 	
    if( (picfile.width!=0) && (picfile.height!=0) )
    { 
        makeWindow(img); 
    }
    else 
    {
        funzione="fileCheck('"+img+"')"; 
        intervallo=setTimeout(funzione,50); 
    }
}
function makeWindow(img)
{ 	
    ht = picfile.height + 70;
    wd = picfile.width + 40; 

    var args= "height=" + ht + ",innerHeight=" + ht;
    args += ",width=" + wd + ",innerWidth=" + wd;
    if (window.screen) 
    { 
        var avht = screen.availHeight; 
        var avwd = screen.availWidth;
        var xcen = (avwd - wd) / 2; 
        var ycen = (avht - ht) / 2;
        args += ",left=" + xcen + ",screenX=" + xcen;
        args += ",top=" + ycen + ",screenY=" + ycen + ",resizable=no, status=0"; 	
    }
    var PhotoWin=window.open("", "PhotoWin", args);
	 
		with (PhotoWin.document) {
		open("text/html", "replace");
		
		write('<html>');
		write('<head><title>Window</title></head>');
		write('<body bgColor="#006699">');
		write('<div align="center"><img src="'+img+'" style="border:2px #FFCC00 solid">');
		write('<br><br><input type="button" name="button" value="Zatvori" onClick="window.close();">');
		write('</div>');
		write('</body>');
		write('</html>');
		close();
		}
	
 

	return PhotoWin
}


function resize(img,photoid)
{ 	
    picfile = new Image(); 
    picfile.src =(img);
	
	picHeight = picfile.height;
	picWidth = picfile.width;
		
	if (picHeight > picWidth){
	document.getElementById(photoid).height = 100;
	document.getElementById(photoid).width = 64;
		
	}
	else {
	document.getElementById(photoid).width = 170;
	document.getElementById(photoid).height = 113;
	}
     
}












 
