<!--

//really not important (the first two should be small for Opera's sake)
PositionX = 10;
PositionY = 10;
defaultWidth  = 600;
defaultHeight = 400;

//kinda important
var AutoClose = false;

//don't touch
function popImage(imageURL,imageTitle){
var imgWin = window.open('','_blank','scrollbars=1,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
if( !imgWin ) { /*return true;*/ } //popup blockers should not cause errors
imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><meta http-equiv=\"imagetoolbar\" content=\"no\" \/>\n'+
'<script type="text\/javascript">\n'+
'var imgH_original = 0;'+
'var imgW_original = 0;'+
'var zoom_in = false;'+
'function maximizar(){'+
'	window.moveTo(0,0);'+
'	if (document.all) {'+
'		window.resizeTo(screen.availWidth,screen.availHeight);'+
'	}'+
'	else if (document.layers||document.getElementById) {'+
'		if (window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){'+
'			window.outerHeight = screen.availHeight;'+
'			window.outerWidth = screen.availWidth;'+
'		}'+
'	}'+
'}'+
'function resizeImgTo(){'+
'	var x = window;'+
'	var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;'+
'	if( x.innerWidth ) { '+
'		myW = x.innerWidth; myH = x.innerHeight;'+
'	}'+
'	else if( d && d.clientWidth ) { '+
'		myW = d.clientWidth; myH = d.clientHeight; '+
'	}'+
'	else if( b && b.clientWidth ) { '+
'		myW = b.clientWidth; myH = b.clientHeight; '+
'	}'+
'	if( window.opera && !document.childNodes ) { '+
'		myW += 16; '+
'	}'+
'	if( !document.images.length ) { '+
'		document.images[0] = document.layers[0].images[0]; '+
'	}'+
'	var img = document.images[0];'+
'	if (imgH_original>=imgW_original){'+
'		img.width = myH * imgW_original/imgH_original;'+
'		img.height = myH; '+
'		if (img.width > myW){ '+
'			img.width = myW; '+
'			img.height = myW * imgH_original/imgW_original;'+
'		} '+
'	}else{ '+
'		img.width = myW; '+
'		img.height = myW * imgH_original/imgW_original;'+
'		if (img.height> myH){ '+
'			img.width = myH * imgW_original/imgH_original;'+
'			img.height = myH; '+
'		} '+
'	}'+
'	zoom_in = false; '+
'}'+
'function resize(){'+
'	imgH_original = document.images[0].height;'+
'	imgW_original = document.images[0].width;'+
'	var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
'	var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
'	if (imgH_original >= scH && imgW_original>=scW){'+
'		window.resizeTo( scW, scH );\n'+
'		resizeImgTo();'+
'		maximizar();'+
'	}else if (imgH_original < scH && imgW_original>=scW){'+
'		window.resizeTo( scW, imgH_original );\n'+
'		resizeImgTo();'+
'		maximizar();'+
'	}else if (imgH_original >= scH && imgW_original<scW){'+
'		window.resizeTo( imgW_original, scH );\n'+
'		resizeImgTo();'+
'		maximizar();'+
'	}else if (imgH_original < scH && imgW_original<scH){'+
'		window.resizeTo( imgW_original, imgH_original );\n'+
'		window.moveTo(Math.round((scW-document.images[0].width)/2), Math.round((scH-document.images[0].height)/2)); '+
'		zoom(); '+		
'	}'+
'}'+
"var message=\"Función deshabilitada\"; "+
'function click(e) { '+
	'if (document.all) { '+
		'if (event.button == 2) { '+
			'alert(message); '+
			'return false; '+
		'} '+
	'} '+
	'if (document.layers) { '+
		'if (e.which == 3) { '+
			'alert(message); '+
			'return false; '+
		'} '+
	'} '+
'} '+
'function zoom(){'+
'	(!zoom_in?zoom_in=true:zoom_in=false); '+
'	if (zoom_in){'+
'		document.images[0].width = imgW_original;'+
'		document.images[0].height = imgH_original;'+
'	}else{'+
'		resizeImgTo();'+
'	}'+
'}'+
'if (document.layers) { '+
	'document.captureEvents(Event.MOUSEDOWN); '+
'} '+
'document.onmousedown=click; '+
'window.onresize= resizeImgTo;'+
'<\/script>'+
'<\/head><body style="margin: 0px"'+(AutoClose?' onblur="self.close();"':'')+'>'+
(document.layers?('<layer align="center" style="vertical-align:middle">'):('<div align="center" style="vertical-align:middle">'))+
'<a href=\"javascript:zoom();\"><img src='+imageURL+' alt="Control+P para imprimir.\nClick para Zoom." title="Control+P para imprimir.\nClick para Zoom." border="0" onload="resize()"></a>'+
(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>'+
'<script type="text\/javascript">\n'+
'</script>');
imgWin.document.close();
if( imgWin.focus ) { imgWin.focus(); }
//return false;
}

//-->
