function getLayer(sLayerName) {
	var oLayer = null;
	
	if (sLayerName.length == 0) return oLayer;
	
	// NS4
	if (ns4)
		oLayer =  document.layers[sLayerName];

	// IE4
	if (ie4)
		oLayer = document.all[sLayerName];

	// Future
	if (future)
		oLayer = document.getElementById(sLayerName);
		
	return oLayer;
}


function getLayerPointer(sLayerName) {
	var oLayerPointer = null;
	
	if (sLayerName.length == 0) return oLayerPointer;
	
	// NS4
	if (ns4)
		oLayerPointer =  document.layers[sLayerName];

	// IE4
	if (ie4)
		oLayerPointer = document.all[sLayerName];

	// Future
	if (future)
		oLayerPointer = document.getElementById(sLayerName);	
	
	// get style of layer if ie or future
	if ((ie4 || future) && oLayerPointer)
		oLayerPointer = oLayerPointer.style;
	
	return oLayerPointer;
}


function showLayer(sLayerName) {
	var oLayerPointer; 
	var sShowValue;

	if (ns4)
		sShowValue = 'show';		// ns4
	else
		sShowValue = 'visible';		// all other browsers at the moment
		
	oLayerPointer = getLayerPointer(sLayerName);
	
	if (oLayerPointer) {
		oLayerPointer.visibility = sShowValue
	}
}


function hideLayer(sLayerName) {
	var oLayerPointer; 
	var sShowValue;

	if (ns4)
		sShowValue = 'hide';		// ns4
	else
		sShowValue = 'hidden';		// all other browsers at the moment
		
	oLayerPointer = getLayerPointer(sLayerName);
	
	if (oLayerPointer) {
		oLayerPointer.visibility = sShowValue
	}
}


function layerMoveTo(sLayerName, x, y) {
	var oLayerPointer; 
	var newX;		
	var newY;		

	oLayerPointer = getLayerPointer(sLayerName);
	
	if (oLayerPointer) {
		oLayerPointer.left = x;
		oLayerPointer.top = y;
	}
}


function layerMoveBy(sLayerName, dx, dy) {
	var oLayerPointer; 
	var oldX;		
	var olxY;		

	oLayerPointer = getLayerPointer(sLayerName);
	
	if (oLayerPointer) {
		oldX = parseInt(oLayerPointer.left);
		oldY = parseInt(oLayerPointer.top);

		if (isNaN(oldX)) oldX = 0;
		if (isNaN(oldY)) oldY = 0;
	
		oLayerPointer.left = oldX + dx;
		oLayerPointer.top = oldY + dy;
	}
}


