/*
 * $Archive:  $
 * $Date:  $
 * $Revision:  $
 * $Author:  $
 * $History:  $
 * $NoKeywords:  $
 * 
 * Copyright Notice "Copyright (c) 2002 GeoWise Limited"
 */
// Create a DHTML layer
function createLayer(name, inleft, intop, width, height, visible, content) {
	var layer;
	document.writeln('<div id="' + name + '" style="position:absolute; overflow:hidden; left:' + inleft + 'px; top:' + intop + 'px; width:' + width + 'px; height:' + height + 'px;' + '; z-index:1; visibility:' + (visible ? 'visible;' : 'hidden;') +  '">');
	document.writeln(content);
	document.writeln('</div>');
}
function getLayer(name) {
	layer = eval('document.all.' + name + '.style');
	return(layer);
}
function isVisible(name) {
	var layer = getLayer(name);
	if (layer.visibility == "visible") return(true);
	return(false);
}
function moveLayer(name, x, y) {		
	var layer = getLayer(name);		
	layer.left = x + "px";layer.top  = y + "px";
}
function setLayerBackgroundColor(name, color) {		
	var layer = getLayer(name);		
	layer.backgroundColor = color;
}
function hideLayer(name) {		
	var layer = getLayer(name);		
	layer.visibility = "hidden";
}
function showLayer(name) {		
	var layer = getLayer(name);		
	layer.visibility = "visible";
}
function clipLayer2(name, clipleft, cliptop, clipright, clipbottom) {		
	var layer = getLayer(name);		
	layer.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';
}
function clipLayer(name, clipleft, cliptop, clipright, clipbottom) {		
	var layer = getLayer(name);		
	var newWidth = clipright - clipleft;
	var newHeight = clipbottom - cliptop;
	layer.height = newHeight;
	layer.width	= newWidth;
	layer.top	= cliptop + "px";
	layer.left	= clipleft + "px";
}
function getImageXY(e) {
	mouseX=event.clientX + document.body.scrollLeft;
	mouseY=event.clientY + document.body.scrollTop;
	// subtract offsets from page left and top
	mouseX = mouseX-hspc;
	mouseY = mouseY-vspc;		
}	
function addMouseDown(theLayer)
{
	theLayer.onmousedown = setInsetZoom;

}
function setInsetZoom() 
{
	mX = event.clientX + document.body.scrollLeft;
	mY = event.clientY + document.body.scrollTop;
 	insetZoom = true;	
}