
// open the client email with the specified address
function sendEmail(encodedEmail)
{
  // do the mailto: link
  location.href = "mai" + "lto:" + decodeBcfcEmail(encodedEmail);
}

// return the decoded email address
function decodeBcfcEmail(encodedEmail)
{
  // holds the decoded email address
  var email = "";

  // go through and decode the email address
  for (i=0; i < encodedEmail.length;)
  {
    // holds each letter (2 digits)
    var letter = "";
    letter = encodedEmail.charAt(i) + encodedEmail.charAt(i+1)

    // build the real email address
    email += String.fromCharCode(parseInt(letter,16));
    i += 2;
  }
  
  email += "@bcfch";
  email += "urch.or";
  email += "g.uk";
  
  return email;
}

// display the email address in the statusbar
function displayStatus(encodedEmail)
{
  window.status = "mailto:" + decodeBcfcEmail(encodedEmail);
}

// clear the statusbar message
function clearStatus()
{
  window.status = "";
}

function leadingZero(x){
   return (x>9)?x:'0'+x;
}

function fnReplaceDoc(scriptname, year) {
	var script = "/" + scriptname + ".asp?year=" + year
	window.location.replace(script);
	return true;
}
