document.write('<div id="ZoomEstructura" style="background-color:Black; visibility:hidden; left:-4000; top:-4000; width:640px; height:480px; overflow:hidden; border:solid 1px Blue; background-image:url(images/FondoZoom.jpg); position:fixed; z-index:10; position:absolute;">');
document.write('	<div id="ZoomContenido" style="left:0px; top:0px; width:40px; height:40px; position:fixed; z-index:10; position:absolute;"></div>');
document.write('	<div id="ZoomInst" style="left:0px; top:460px; width:640px; height:20px; color:#FFFFFF; background-color:#000000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9px; position:fixed; z-index:10; position:absolute;">');
document.write('		&nbsp;Click Izquierdo: Mover imagen;  Rueda Ratón: Zoom		');
document.write('	</div>');
document.write('	<div id="ZoomCerrar" style="left:570px; top:4px; width:100px; height:40px; color:#FF0000;  font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9px; position:fixed; z-index:10; position:absolute;"><b><a href="javascript:Hide();" style="text-decoration:none">.: Cerrar :.</a></b></div>');
document.write('</div>');

function wheel(event){
	var delta = 0;
	if (!event) event = window.event;
	if (event.wheelDelta) {
		delta = event.wheelDelta/120; 
		if (window.opera) delta = -delta;
	} else if (event.detail) {
		delta = -event.detail/3;
	}
	if (delta)
		handle(delta);
		
	return false;
}

/* Initialization code. */
if (window.addEventListener)
	window.addEventListener('DOMMouseScroll', wheel, false);


function handle(delta) {
		Imagen = document.getElementById('ZoomImagen');	
		if (delta < 0) {
			if (Imagen.offsetWidth >= 48) {
				Imagen.style.width = (Imagen.offsetWidth - 24);
				Contenido.style.left = Contenido.offsetLeft + 12;
				Contenido.style.top = Contenido.offsetTop + 12;
			}
		}else{
			Imagen.style.width = (Imagen.offsetWidth + 24);
			Contenido.style.left = Contenido.offsetLeft - 12;
			Contenido.style.top = Contenido.offsetTop - 12;
		}
}	






N = (document.all) ? 0 : 1;

var Arrastrando = false;
var PRx = 0;
var PRy = 0;
var Imagen;

var Estructura = document.getElementById('ZoomEstructura');
var Contenido = document.getElementById('ZoomContenido');	

function View(RutaIMG) {
	Estructura.style.left = "50%";
	Estructura.style.top = "50%";
			
	Estructura.style.left = Estructura.offsetLeft - (Estructura.offsetWidth / 2) + document.body.scrollLeft;
	Estructura.style.top = Estructura.offsetTop - (Estructura.offsetHeight / 2) + document.body.scrollTop;
	
	Contenido.innerHTML = '<img src="' + RutaIMG + '" id="ZoomImagen" width="620px">';
	
	Contenido.style.left = (Estructura.offsetWidth / 2) - (Contenido.offsetWidth / 2);
	Contenido.style.top = (Estructura.offsetHeight / 2) - (Contenido.offsetHeight / 2);
			
	Imagen = document.getElementById('ZoomImagen');	

	Estructura.style.visibility = "visible";
}

function Hide() {		
	Estructura.style.visibility = "hidden";
	Estructura.style.left = "-4000px";
	Estructura.style.top = "-4000px";	
}

function MD(e) {
	ActPosRaton();
	Arrastrando = true;
}

function MU() {
	Arrastrando = false;
}

function MM(e) {
	if (Arrastrando) {
		Contenido.style.left = Contenido.offsetLeft - (PRx - event.clientX);
		Contenido.style.top = Contenido.offsetTop - (PRy - event.clientY);	
	}	
	ActPosRaton();
	return false;
}

function MO(e) {
	return false;
}

function ActPosRaton() {
	PRx = event.clientX;
	PRy = event.clientY;
}



Contenido.onmousedown = MD;
Contenido.onmousemove = MM;
Contenido.onmouseup = MU;
Contenido.onmouseout = MO;	
Estructura.onmousewheel = wheel;	
