

function Text()
{
}

var reg = /<(.*?)>/;

Text.decryptDocument = function()
{
    tags = document.getElementsByTagName("A");
    for (var email, i = 0, ix = tags.length; i < ix; ++i) {
        tag = tags[i];
        if (tag.className.match(/\bencryptMe\b/)) {
            kompletterPfad = tag.firstChild.src;
			emailEncrypted = kompletterPfad.substring(kompletterPfad.lastIndexOf('/')+1, kompletterPfad.lastIndexOf('.'));
			emailDecrypted = Text.decrypt(emailEncrypted);
			emailDecryptedWithoutTags = emailDecrypted.replace(reg,"");
			tag.href = 'mailto:' + emailDecryptedWithoutTags;
			tag.removeChild(tag.firstChild);
            tag.innerHTML = emailDecrypted;
        }
    }
}




Text.encrypt = function(plainText)
{
    var encryptedText = [];
    for (var i = plainText.length - 1; i >= 0; --i) {
		dezimalZahl = plainText.charCodeAt(i);
		hexadezimalZahl = dec2hex(dezimalZahl);
        encryptedText.push(hexadezimalZahl);
    }
    return encryptedText.join("");
}

Text.decrypt = function(cryptText)
{
	laenge = cryptText.length;
	cryptTextZerhackt = new Array();
	
	for (i=0; i<laenge; i+=2) {
		cryptTextZerhackt.push(cryptText.substring(i, i+2));	
	}
  
    plainText = "";
    for (var i = (cryptText.length)/2 - 1; i >= 0; --i) {
        plainText += String.fromCharCode(hex2dec(cryptTextZerhackt[i]));
    }
    return plainText;
}

function dec2hex( s ) { return ( s<15.5 ? '0' : '' ) + Math.round( s ).toString( 16 ); }
function hex2dec( s ) { return parseInt( s, 16 ); }








if(window.captureEvents) {
  window.captureEvents(Event.LOAD);
}
window.onload = Text.decryptDocument;