﻿/*
* Email Address obfuscator
* This script is written by Geert Van Aken
* Please read the official documentation for more information
* about the functions of this file.
*
* http://altum.be/products/emailobfuscator
*
* Please do not remove this information from the file and
* report improvements that you make to this sourcecode
*
* Version 1.1.0
* Date    2006/04/11
*/

var monkeyCode = 4 << 4;
var oldStatusText = "";

function UAEa() {
    return String.fromCharCode(monkeyCode);
}

function UAEd(pText) {
    var splitted = pText.split(",");
    var result = "";

    for (i = 0; i < splitted.length; i++) {
        result += String.fromCharCode(splitted[i]);
    }
    return result;
}

function UAEp() {
    var prefix = UAEd('109,97,105');
    prefix += UAEd('108,116');
    return prefix + UAEd('111,58');
}

function UAEad(pName, pdomain) {
    UAEad(pName, pDomain, null);
}

function UAEinitStatus(pName, pDomain) {
    oldStatusText = window.status;
    window.status = Loc(pName, pDomain);
}

function UAErestoreStatus() {
    window.status = oldStatusText;
}

function UAEae(pName, pDomain, pSubj, pHover, pText, pClass) {

    //  alert("pName = " + pName + "\npDomain = " + pDomain + "\npSubj = " + pSubj + "\npHover = " + pHover + "\npText = " + pText + "\npClass = " + pClass);

    var result = "<a href=\"JavaScript:UAEad('" + pName + "','" + pDomain + "'";
    if (pSubj != null && pSubj.length > 2) {
        result += ",'" + pSubj + "'";
    }
    result += ");\"";

    if (pHover != null && pHover.length > 0) {
        result += " title=\"" + UAEd(pHover) + "\"";
    }

    if (pClass != null && pClass.length > 0) {
        result += " class=\"" + pClass + "\"";
    }

    result += " onMouseOver=\"UAEinitStatus('" + pName + "','" + pDomain + "');return true;\" onMouseOut=\"UAErestoreStatus();\"";

    result += ">" + UAEd(pText) + "</a>";

    //  alert(result);

    document.write(result);

}

function UAEad(pName, pDomain, pSubj) {
    var loc = Loc(pName, pDomain);
    if (pSubj != null && pSubj.length > 0) {
        loc += "?" + UAEd('115,117,98,106,101,99,116') + "=" + encodeURIComponent(UAEd(pSubj));
    }

    document.location = loc;
}

function Loc(pName, pDomain) {
    var first = UAEd(pName);
    var second = UAEd(pDomain);
    var loc = UAEp() + first + UAEa() + second;

    return loc;
}

// Clears the newsletter fields on focus.
function clearInput(idControl, defaultText) {
    alert(idControl);
    //var input = $(idControl);
    //if (input.value == defaultText)
    //		input.value = "";
    //else if (input.value == "")
    //input.value = defaultText;
}

// Clears the search fields on focus.
function searchClear(defaultText) {
    var input = $(".searchfield");
    if (input.val() == defaultText) {
        input.val("");
    }
    else if (input.val() == "") {
        input.val(defaultText);
    }
}

$(document).ready(function () {
    // lounge, hide toolbar from guest, this is just a convenience, the links go straight to login
    var toolbarGuest = $(".post:contains('Welcome Guest')")
    if (toolbarGuest.length > 0) {
        $(toolbarGuest).parent().hide();
    }
    // fancy buttons
    $(".fg-button").hover(
    function () {
        $(this).addClass("ui-state-hover");
    },
    function () {
        $(this).removeClass("ui-state-hover");
    }
    )
});


