function navOver(control, theStyle)
{
  control.className=theStyle;
}

function navOut(control, theStyle)
{
  control.className=theStyle;
}

function openWindow(theHref, name, width, height)
{
  window.open(theHref, name, "width=" + width + ", height=" + height + ", menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes").focus();
}

function openColorWindow(color, controlName)
{
  var theColor = color;
  document.getElementById("colorPopup").style.top  = getElementPosition(controlName).top;
  document.getElementById("colorPopup").style.left = getElementPosition(controlName).left + 20;
  document.getElementById("colorPopup").style.backgroundColor = theColor;
  document.getElementById("colorPopup").style.visibility = 'visible';
}

function closeColorWindow()
{
  document.getElementById("colorPopup").style.visibility = 'hidden';
}

function getElementPosition(elemID)
{
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}

function selectIt(selObj)
{
  document.getElementById("addressFrame").src = "../Addresses/" + selObj.options[selObj.selectedIndex].value;
  document.getElementById("instructions").style.visibility = "hidden";
}

function clearOut(control, initValue)
{
  if (control.value == initValue)
  {
    control.value='';
    control.style.color='#000000';
  }
}

function linkNav(page)
{
	window.frames["navLocation"].location = page;
}

