//dynamic pan mode

// Position an object at a specific pixel coordinate
function moveObject(obj, x, y) {
	obj.left = x + "px";
	obj.top = y + "px";
}

// Retrieve horizontal (x) coordinate of mouse eevent within "mapEvent" element's rectangle.
function getEventX(evt) {
	var x = new Number (0);
	if (evt.x) {				// IE					
		x = evt.x;
	} else if (evt.layerX) {	// NS
		x = evt.layerX;
	}
	return x;
}

// Retrieve vertical (y) coordinate of mouse event within "mapEvent" element's rectangle.
function getEventY(evt) {
	var y = new Number (0);
	if (evt.y) {				// IE				
		y = evt.y;
	} else if (evt.layerY){		// NS
		y = evt.layerY;
	}
	return y;
}

// Retrieve horizontal (x) coordinate of the mouse event in map units.
function getMapCoordX(imgCoordX, imgW, minX, maxX, units) {
	var v = new Number(0);	
	var x = new Number(minX);
	v = (maxX - minX) * (imgCoordX / imgW);
	//window.status=v;
	if ((units == "feet") || (units == "meters")) {						// convert value to integer 
		v =  parseInt(minX + v);								
	} else {
	
		v =  parseFloat(x + v);
		//window.status=v + "|" + minX;
		v = v.toString();
		v = v.substr(0,v.indexOf(".")) + v.substr(v.indexOf("."),6);	// add 5 decimal places
	}
	//window.status=v + " | " + imgCoordX + " | " + imgW + " | " + minX + " | " + maxX + " | " + units;
	return v;
}

// Retrieve vertical (y) coordinate of the mouse event in map units.
function getMapCoordY(imgCoordY, imgH, minY, maxY, units) {
	var v = new Number(0);	
	v = (maxY - minY) * (imgCoordY / imgH);
	if ((units == "feet") || (units == "meters")) {						// convert value to integer 
		v =  parseInt(maxY - v);										
	} else {
		v =  parseFloat(maxY - v);
		//window.status=v + "|" + maxY;
		v = v.toString();
		v = v.substr(0,v.indexOf(".")) + v.substr(v.indexOf("."),6);	// add 5 decimal places
	}
	return v;
}
