// Magic Mail!
// 22 June 2006
//Input:
//	ehh = HTML Anchor Object
//	destination = mail destination index as a number.
//
var MM = new Array(
String.fromCharCode(149,139,208,153,140,145,208,153,140,159,211,155,140,151,150,141,154,140,145,152,134,145,190,145,152,144,151,196,145,138,146,151,159,147),
String.fromCharCode(149,139,208,153,140,145,208,153,140,159,211,155,140,151,150,141,154,140,145,152,134,145,190,134,159,147,196,145,138,146,151,159,147)
);
//
function magicmail( ehh, destination ) {
	if ( arguments.length == 2
		&& typeof(destination) == "number"
		&& destination >=0 && destination < MM.length ) {
		if ( typeof(ehh) == "object" ) {
			// ("nodeType" in ehh) causes problems in old browsers so best not to use it yet.
			if ( (ehh.nodeType) && (ehh.nodeType == 1) ) { //Element node.
				if ( ehh.tagName && ehh.tagName.toLowerCase() == "a" ) {
					try {
						var mm = MM[destination];
						var m = "";
						for( var i=mm.length-1; i>=0 ; i-- ) {
							m += String.fromCharCode( 254 ^ mm.charCodeAt(i) );
						}
						ehh.setAttribute( "href", m );
					} catch(e) { alert("Error: "+e); }
				}
			}
		}
	}
}

