	var imagewidth;
	var imageheight;
	var zooming = false;
	var imageLoaded = false;
	
	function loadImage(obj, image)
	{
		obj.getElementsByTagName('img')[0].src = image;
	}
	
	function imageload(imagebox, obj)
	{
		if (imageLoaded == false)
		{
			imagewidth = obj.width;
			imageheight = obj.height;
			imagebox.style.cursor = "url('/img/enlarge.cur'), crosshair";
			imageLoaded = true;
		}
	}
	
	function doPan(obj, event)
	{
		if (imageLoaded)
		{
			var mouseX = event.clientX-obj.viewportOffset()[0];
			var mouseY = event.clientY-obj.viewportOffset()[1];
			obj.getElementsByClassName('imagezoom')[0].style.left = ((mouseX/obj.getWidth()*imagewidth)-mouseX)*-1 + "px";
			obj.getElementsByClassName('imagezoom')[0].style.top = ((mouseY/obj.getHeight()*imageheight)-mouseY)*-1 + "px";
		}
	}
	
	function zoom(obj)
	{
		if (imageLoaded)
		{
			if (zooming)
			{
				obj.getElementsByClassName('imagezoom')[0].style.visibility = 'hidden';
				obj.style.cursor = "url('/img/enlarge.cur'), crosshair";
				zooming = false;
			}
			else
			{
				obj.getElementsByClassName('imagezoom')[0].style.visibility = 'visible';
				obj.style.cursor = "url('/img/reduce.cur'), crosshair";
				zooming = true;
			}
		}
	}
