// Script to hide emails in the source HTML to protect from web crawlers.

var domain = new Array("cambridgediving", "org", "uk");

function writeEmail()
{
  var realArgs = arguments;
  while (typeof(realArgs[0]) == 'object')
  {
    realArgs = realArgs[0];
  }
  for (i = 0; i < realArgs.length; i++)
  {
    if (i > 0)
    {
      document.write('.');
    }
    document.write(realArgs[i]);
  }
  for (i = 0; i < domain.length; i++)
  {
    document.write(i == 0 ? '@' : '.');
    document.write(domain[i]);
  }
}

function writeMailTo()
{
  document.write("<a href=\"mailto:");
  writeEmail(arguments);
  document.write("\">");
}

function writeMailToFull()
{
  document.write("<a class=\"mono\" href=\"mailto:");
  writeEmail(arguments);
  document.write("\">");
  writeEmail(arguments);
  document.write("</a>");
}

