// JavaScript Document
function showEmail(email, display)
{
	var emailLink = "<a href='mailto:" + email + "'>" + display + "</a>";
	document.write(emailLink);	
}

/*******************************************************************
*Function:  xCoord
*Purporse:  This function returns the object's left edge.
*Param:      objId - id value of the object
*Return:    nXCoord - the current x-coordinate
*********************************************************************/ 
function xCoord(objId)
{
  var objSelected = document.getElementById(objId);

  /*
  If you need to add or subtract from a coordinate you need to first extract
  its numeric value. parseInt extracts the numeric value from a string.
  ie: return 100 from 100px
  */
  var nXCoord = parseInt(objSelected.style.left);

  return nXCoord;
}

/*******************************************************************
*Function:  yCoord
*Purporse:  This function returns the object's top edge.
*Param:      objId - id value of the object
*Return:    nYCoord - the current x-coordinate
*********************************************************************/ 
function yCoord(objId)
{
  var objSelected = document.getElementById(objId);
  var nYCoord = parseInt(objSelected.style.top);

  return nYCoord;
}

/*******************************************************************
*Function:  placeIt
*Purporse:  This function places an object at a specified coordiante.
*Param:      objId - id value of the object
*           x, y - are the coordinates where the object is to be placed
*********************************************************************/
function placeIt(objId, x, y)
{
  var objSelected = document.getElementById(objId);
  objSelected.style.left = x+"px";
  objSelected.style.top = y+"px";
}

/*******************************************************************
*Function:  shiftIt
*Purporse:  This function moves the object from its current location
*           a specified distance.
*Param:     objId - id value of the object
*           xDistance, yDistance - contain the distance, in pixels,
*           to move the object.
*********************************************************************/
function shiftIt(objId, xDistance, yDistance)
{
  var objSelected = document.getElementById(objId);
  objSelected.style.left = xCoord(objId) + xDistance + "px";
  objSelected.style.top = yCoord(objId) + yDistance + "px";
}

/*******************************************************************
*Function:  showIt
*Purporse:  This function will show the object referenced by the id
*           passed in.
*Param:     objId - id value of the object
*********************************************************************/
function showIt(objId)
{
  var objSelected = document.getElementById(objId);
  objSelected.style.visibility = "visible";
}

/*******************************************************************
*Function:  hideIt
*Purporse:  This function will hide the object referenced by the id
*           passed in.
*Param:     objId - id value of the object
*********************************************************************/
function hideIt(objId)
{
  var objSelected = document.getElementById(objId);
  objSelected.style.visibility = "hidden";
}
