function isEmpty() {				// Validates textboxes, textareas and passwords.
	var CheckTable=document.getElementById("me");
	var CheckRows = CheckTable.getElementsByTagName("tr");
	var result = true;
	var error = "Please enter ";
	var another = false;
	var passwd = new Array();
	for(j = 0; j < CheckRows.length; j++) 
	{
		var text = new Array();
		var box = new Array();	
		var CheckCells = CheckRows[j].getElementsByTagName("td");
		var text = new Array();
		var labelcount = 0;
		for(h = 0; h < CheckCells.length; h++) 
		{
			var nodes = CheckCells[h].childNodes;
			for (i=0;i<nodes.length;i++)
			{
				if (nodes[i].nodeName == '#text') continue;
				if (nodes[i].getAttribute('type') == 'password')
				{
					text[text.length] = nodes[i];
					passwd.push(nodes[i].getAttribute('value'));
				}
				if ((nodes[i].getAttribute('type') == 'text') || nodes[i].getAttribute('type') == 'textarea')
				{
					text[text.length] = nodes[i];
				} 
				else if (nodes[i].getAttribute('type') == 'checkbox') box[box.length] = nodes[i];
			}
		} 
		for(h = 0; h < text.length; h++) 
		{
			var CheckLabel = CheckRows[j].getElementsByTagName('td')[0].getElementsByTagName('em')[labelcount];
			if ((box[0] == null & text[h].value == "") || (box[0] != null && box[0].checked & text[h].value == "")) 
			{
				if (another == true) error = error + ", ";
				error = error + CheckLabel.innerHTML.substring(0, CheckLabel.innerHTML.length - 2);
				another = true;
				result = false;
			}
			labelcount++;
		}   
	}
	error = error + ".";
	for (k = 0; k < passwd.length; k++)
	{
		var temp = passwd[0];
		if (temp != passwd[k])
		{
			result = false;
			error = error + " The passwords entered do not match.";
			break;
		}
	}
	if (result == false) alert(error);
	return result;
}

//The following functions are used for the create message menu.

function init()
{
	cssjsmenu('navbar');
	if (document.getElementById)
	{
		var menu = document.getElementById('hoverJS'); 
		menu.disabled = true;
	}
}

function cssjsmenu(menuid)
{
  var i;
  var j;
  var node;
  var child;
  var parent;

  // if the browser doesn't even support
  // document.getElementById, give up now.
  if (!document.getElementById)
  {
    return true;
  }

  // check for downlevel browsers
  // Opera 6, IE 5/Mac are not supported

  var version;
  var offset;

  offset = navigator.userAgent.indexOf('Opera');
  if (offset != -1)
  {
    version = parseInt('0' + navigator.userAgent.substr(offset + 6), 10);
    if (version < 7)
    {
      return true;
    }
  }

  offset = navigator.userAgent.indexOf('MSIE');
  if (offset != -1)
  {
    if (navigator.userAgent.indexOf('Mac') != -1)
    {
      return true;
    }
  }

  var menudiv = document.getElementById(menuid);

  // ul
  var ul = new Array();

  for (i = 0; i < menudiv.childNodes.length; i++)
  {
    node = menudiv.childNodes[i];
    if (node.nodeName == 'UL')
    {
      ul[ul.length] = node;
    }
  }

  // ul > li
  var ul_gt_li = new Array();

  for (i = 0; i < ul.length; i++)
  {
    node = ul[i];
    for (j = 0; j < node.childNodes.length; j++)
    {
      child = node.childNodes[j];
      if (child.nodeName == 'LI')
      {
        ul_gt_li[ul_gt_li.length] = child;
        child.style.display = 'inline';
        child.style.listStyle = 'none';
        child.style.position = 'static';
      }
    }
  }

  // ul > li > ul
  var ul_gt_li_gt_ul = new Array();

  for (i = 0; i < ul_gt_li.length; i++)
  {
    node = ul_gt_li[i];
    for (j = 0; j < node.childNodes.length; j++)
    {
      child = node.childNodes[j];
      if (child.nodeName == 'UL')
      {
        ul_gt_li_gt_ul[ul_gt_li_gt_ul.length] = child;
        child.style.position = 'absolute';
        child.style.left = '-13em';
        child.style.visibility = 'hidden';

        // attach hover to parent li
        parent = child.parentNode;
        parent.onmouseover = function (e)
        {
          var i;
          var child;
          var point;

          // stop the pure css hover effect
          this.style.paddingBottom = '0';

          for (i = 0; i < this.childNodes.length; i++)
          {
            child = this.childNodes[i];
            if (child.nodeName == 'UL')
            {
              point = getPageXY(this);
              setPageXY(child, point.x, point.y + this.offsetHeight);
              child.style.visibility = 'visible';
            }
          }
          return false;
        };
        parent.onmouseout = function (e)
        {
          var relatedTarget = null;
          if (e)
          {
            relatedTarget = e.relatedTarget;
            // work around Gecko Linux only bug where related target is null
            // when clicking on menu links or when right clicking and moving
            // into a context menu.
	    if (navigator.product == 'Gecko' && navigator.platform.indexOf('Linux') != -1 && !relatedTarget)
	    {
	      relatedTarget = e.originalTarget;
	    }
          }
          else if (window.event)
          {
            relatedTarget = window.event.toElement;
          }

          if (elementContains(this, relatedTarget))
          {
            return false;
          }

          var i;
          var child;
          for (i = 0; i < this.childNodes.length; i++)
          {
            child = this.childNodes[i];
            if (child.nodeName == 'UL')
            {
                child.style.visibility = 'hidden';
            }
          }
          return false;
        };
      }
    }
  }
  return true;
}

