var imgok = true;
function teste() { return false;};

function checkimg(imgfile) { 
if (imgok) {return 1;} else {return 0;};
}

function showimg(imgname,w,h) {

DetectImage = window.open("","_blank","width=1,height=1,statusbar=no,toolbar=no,top=0,left=0");

principal = this.window;
this.window.focus();

Z = 0;

DetectImage.document.write(""
+"<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>"
+"<img name='foto' src="+imgname+" onerror=(opener.imgok=false)>");



if (checkimg(imgname)==1) {

	this.window.focus();

	imagemfile = imgname;

	WindowResize(imagemfile,DetectImage,Z);

}else{

	alert("aNão foi possível carregar a imagem :\n\"" + imgname+"\"\n Verifique sua conexão e tente novamente.");
	DetectImage.window.close(); 

};


};


function WindowResize(imgfile,DetectImage,Z) {
imagem = imgfile
if  (DetectImage.foto.complete) {

	var altura;
	var largura;
	altura = DetectImage.foto.height;
	largura = DetectImage.foto.width;

	ShowImage = DetectImage.window.open("","_blank","width="+largura+",height="+altura+",statusbar=no,toolbar=no,top=0,left=0");

	ShowImage.document.write(""
	+"<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>"
	+"<img name='foto' src="+imgfile+">");

	DetectImage.window.close(); 

} else {

	if (Z < 50) {
	var contador=null;
	Z = Z+1;
	contador = setTimeout("WindowResize(imagem,DetectImage,Z)",500);
	}else{
	alert("aNão foi possível carregar a imagem :\n\"" + imgname+"\"\n Verifique sua conexão e tente novamente.");
           DetectImage.window.close(); 
	};
};

	


};


