function decode(mail_adrr) {
  return XOR_decode(mail_adrr);
}

function mail(encoded_email) {
  msg =   "NO SPAM!\n" + 
          "Everyone hates spammers, so do we. If you would\n" +
          "like to send a mail to this anti-spam protected address,\n" +
          "you MUST agree not to send any spam to it, and\n" +
          "also you will not sell it or lend it or give it to anyone.\n\n" +
          "If you agree, you may click OK\n" +
          "If you disagree, you MUST click Cancel.";
  
  if (confirm(msg)) {
    location = "mailto:" + decode(encoded_email);
  }
  else {
    // sorry, no bonus
    return;
  }
}

function ASC1_decode(etxt) {//change ASCII by 1
  dtxt = "";
  for (i = 0; i < etxt.length; i++) {
    dtxt += String.fromCharCode(etxt.charCodeAt(i) - 1);
  }
  return dtxt;
}

function XOR_decode(etxt) {// XOR code
  key = 03;
  dtxt = "";
  for (i = 0; i < etxt.length; i++) {
    dtxt += String.fromCharCode(etxt.charCodeAt(i) ^ key);
  }
  return dtxt;
}


function HEX_decode(etxt) {// Hexadecimal coding, no decoding required 
  return etxt;
}

function swapNybbles(etxt){
  var dtxt = ""; 
  for (var i=0; i<etxt.length; i++){
    var ch = etxt.charCodeAt(i) ;
    dtxt += String.fromCharCode(((ch & 0xF0)>>4) + ((ch & 0x0F)<<4));
  }
  return dtxt
}

function swapPairs(etxt){
  var dtxt = ""; 
  for (var i=0; i<etxt.length; i++){
    var ch = etxt.charCodeAt(i) ;
    dtxt += String.fromCharCode((ch & 0xF0 ) + ((ch & 0x0C)>>2) + ((ch & 0x03)<<2));
  }
  return dtxt
}

