/*
	This script library contains standard utility functions primary handling GUI effects.
	The functions are compatible with the Internet Explorer browser version 4 - 6.
	Copyright 2003 Bertram Web Design.	
*/


function getXCoord(objId) {
	var coord = 0;
	var theObj = document.getElementById(objId);
	if(theObj != null) {
		while(theObj.tagName != 'BODY') {
			coord += theObj.offsetLeft;
			theObj = theObj.offsetParent;
		}
		return coord;
	}
	return false;
}

function getYCoord(objId) {
	var coord = 0;
	var theObj = document.getElementById(objId);
	if(theObj != null) {
		while(theObj.tagName != 'BODY') {
			coord += theObj.offsetTop;
			theObj = theObj.offsetParent;
		}
		return coord;
	}
	return false;
}

function positionLayer(theAnchorId, theLayerId, adjustX, adjustY) {
	//var adjustX = 2;
	//var adjustY = 15;
	var theAnchor = document.getElementById(theAnchorId);
	var theLayer = document.getElementById(theLayerId);
	if((theAnchor != null) && (theLayer != null)) {
		var posX = getXCoord(theAnchorId) + adjustX;
		var posY = getYCoord(theAnchorId) + adjustY;
		theLayer.style.left = posX;
		theLayer.style.top = posY;
	}
	
}

function rollOut(imgName) {
	if(document.images) {
		eval('document.' + imgName + '.src = ' + imgName + '_out.src');
	}
}

function rollOver(imgName) {
	if(document.images) {
		eval('document.' + imgName + '.src = ' + imgName + '_over.src');	
	}	
}

function swapImage(imgName, source) {
	if(document.images) {
		document.images[imgName].src = source;
	}
}

function swapLayer(theLayer, state) {
  if(state == 'on') {
   	document.getElementById(theLayer).style.visibility='visible';
  } else {
   	document.getElementById(theLayer).style.visibility='hidden';
  }    
}
