﻿function verImagem(ifile,desc,ixx,iyy){
	var band=false;
	var ix; var iy; var texto; 
	if(ixx > screen.availWidth){//screen.availWidth
		band = true;
		ix = screen.availWidth - 40;
	}else{
		ix = ixx;
	}
	if(iyy > screen.availHeight){//screen.availHeight
		band = true;
		iy = screen.availHeight - 40;
	}else{
		iy = iyy;
	}
	var scl = (band) ? ",scrollbars=yes" : "";
	var ititle = ".:: Galeria de Imagem ::." ;

	texto = "<html>\n<head>\n<title>"+ititle+"</title>\n";
  	texto += "<style>\nbody{text-align:center;margin:0;pading:0;}\ndiv{overflow:auto;margin:auto;position:absolute;width:"+ixx+"px;height:"+iyy+"px;left:0px;top:0px;}\n#imagem{display:none;}\n#carrega{margin-top:25%;}\n</style>\n";
	texto += '<script type="text/javascript">\n';
	texto += 'function $(a){return document.getElementById(a);}\n';
	texto += 'function carregar(){$("carrega").style.display = "none";$("imagem").style.display = "block";}\n';
	texto += 'onload=carregar;\n';
	texto += '</script>\n';
	texto += "</head>\n<body onBlur=\"self.close()\" onClick=\"self.close()\">\n";
	texto += '<div><h2 id="carrega">A carregar...</h2>';
	texto += '\n<img id = "imagem" src="'+escape(ifile)+'" title="'+desc+'"></div>\n</body>\n</html>';

	var win = window.open("","gi","width="+ix+",height="+iy+",menubar=no,toolbar=no"+scl);
	win.document.open();
	win.document.write(texto);
	win.document.close();
}

