jQuery.fn.deobfuscate = function()
{
    return this.each(function()
    {
    var content = $(this).text();
    
    /* grab the part inside the braces, swap out placeholders, and trim */
    var obfuscated = content.match(/\[(.*)\]/);
    /*
    for(var i=0;i<obfuscated.length();i++){
        alert(obfuscated[i]);
    }
    */
    var address = obfuscated[1]
    .replace(' AT ', '@')
    .replace(new RegExp(' DOT ', 'g'), '.')
    .replace(/^\s+|\s+$/g, '');
    
    /* get everything before the braces and trim */
    var text = content.match(/.?[^[]+/);
    
    text = (text[0] != content)
    ? text[0].replace(/^\s+|\s+$/g, '')
    : address;      // if there's no text part, use the address
    
    var title = $(this).attr('title') || '';
    
    $(this).replaceWith($('<a href="mailto:' + address + '" title="' +
    title + '">' + text + '</a>'));
    });
};

$(document).ready(function(){
    $(".deob").deobfuscate();
    $("#button-submit").val("").css("background", "url(img/button-send.png) no-repeat");
    if (!$.browser.msie) {
        $("body.posted .box").css("opacity", "0.5");
        $("body.posted #contact-form-container").css("opacity", "1");
    }
});
