  function MOverMenu(menuItem)
  {
    var mItem = document.getElementById(menuItem);
    mItem.style.backgroundColor = '#DDFFDD';
  }

  function MOutMenu(menuItem)
  {
    var mItem = document.getElementById(menuItem);
    mItem.style.backgroundColor = 'white';
  }

  function Logout()
  {
    var xmlHttp;
    try
    {
      // Firefox, Opera 8.0+, Safari
      xmlHttp = new XMLHttpRequest();
    }
    catch (e)
    {
      // Internet Explorer
      try
      {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch (e)
      {
        try
        {
          xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e)
        {
          alert("Unfortunately, your browser doesn't support AJAX and you can't be logged out.  Close your browser window and reopen (this will log you out).");
          return false;
        }
      }
    }

    xmlHttp.onreadystatechange=function()
    {
      if(xmlHttp.readyState==4)
      {
        window.location.reload();
      }
    }

    xmlHttp.open("GET", "../logout.php", true);
    xmlHttp.send(null);
  }

  function Login()
  {
    var xmlHttp;
    try
    {
      // Firefox, Opera 8.0+, Safari
      xmlHttp = new XMLHttpRequest();
    }
    catch (e)
    {
      // Internet Explorer
      try
      {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch (e)
      {
        try
        {
          xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e)
        {
          alert("Unfortunately, your browser doesn't support AJAX and account cannot be created.");
          return false;
        }
      }
    }

    xmlHttp.onreadystatechange=function()
    {
      if(xmlHttp.readyState==4)
      {
        var output = document.getElementById('login_information');
        if (xmlHttp.responseText != "valid")
        {
          output.innerHTML = xmlHttp.responseText;
        }
        else
        {
          window.location.reload();
        }
      }
    }

    var email = document.getElementById("email").value;
    var password = document.getElementById("password").value;
    var security = document.getElementById("securitycode").value;

    var variables = "?enteredemail=" + email + "&" + "enteredpassword=" + password + "&" + "enteredsecurity=" + security;
    xmlHttp.open("GET", "../login.php" + variables, true);
    xmlHttp.send(null);
  }

  function ClearFields()
  {
    if (document.getElementById("email")) 
      document.getElementById("email").value = "";

    if (document.getElementById("password")) 
      document.getElementById("password").value = "";

    if (document.getElementById("securitycode")) 
      document.getElementById("securitycode").value = "";
  }

  function OpenNatureWindow(tableName, recordID)
  {
    var windowParameters;
	
    windowParameters = "'toolbar=no, resizable=no, scrollbars=yes, width=405, height=650, left=5, top=5'";
    var details = "http://www.britishnature.co.uk/nature/natureitem.php?t=" + tableName + "&r=" + recordID;
	
    var pictureWindow = window.open(details, "", windowParameters);
  }

  function OpenWallpaperWindow(id, size)
  {
    var windowWidth = 700;
    var windowHeight = 450;
    var left = ((screen.width/2)-(windowWidth/2)); 
    var top = (screen.height/2)-(windowHeight/2); 
	
    var windowParameters = "'toolbar=0, status=0, location=0, resizable=0, scrollbars=0, width=" + windowWidth + ", height=" + windowHeight + ", left=" + left + ", top=" + top + "'";
    var location = "wallpaper.php?id=" + id + "&size=" + size;
    var pictureWindow = window.open(location, "", windowParameters);
  }

