var objPan;

function Pan(image,osX,osY)
{
	if (arguments.length == 3) 
	{
		this.isDrag = false;
		this.mapImage = document.getElementById(image);
		this.moveX = 0;
		this.moveY = 0;
		this.offsetX = osX;
		this.offsetY = osY;
	}	

	this.mouseMove = function(mmX,mmY)
	{
		if (this.isDrag) 
		{		
			if(mmX > this.offsetX && mmY > this.offsetY && mmX < this.mapImage.width + this.offsetX && mmY < this.mapImage.height + this.offsetY)
			{	
				this.mapImage.style.left = mmX - this.clickX + "px";
				this.mapImage.style.top  = mmY - this.clickY + "px";
			}
			else { this.mouseUp(); return true;}
		}
		
		return false;
	}

	this.mouseDown = function(mdX,mdY) 
	{
		this.isDrag = true;
		this.isComplete = true;		
		this.clickX = mdX;
		this.clickY = mdY;
		return false;
	}

	this.mouseUp = function()
	{
		if (this.isDrag)
		{	
			this.isDrag = false;
					
			this.moveX = 0 + parseInt(this.mapImage.style.left);
			this.moveY = 0 + parseInt(this.mapImage.style.top);
		}
		
		return false;
	}

	this.mouseOver = function() 
	{ 
		this.mapImage.style.cursor = "move"; 
	}

	this.getMoveX = function() { return this.moveX; }

	this.getMoveY = function() { return this.moveY; }

	this.getIsComplete = function() { return this.isComplete; }
	
	this.setIsComplete = function() { this.isComplete = false; }
}
