// Obfuscate an email address on a web page

// Leave linkText undefined to insert email address as link text
function showEmailLink(user, domain, tld, linkText, colour)
{
    style = "";
    if (colour != undefined) style += "color:" + colour + "; ";

    address = user + "@" + domain + "." + tld;
    if (linkText == undefined || linkText == "") linkText = address;
    
    if (style != "") style = "style='" + style + "'";
    str = "<a " + style + " hr" + "ef='ma" + "ilt" + "o:" + address + "' style='color:#E85613!important;'>" + linkText + "</" + "a>";

    document.write(str);
}


function checkEmail(str)
{
    return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+$/.test(str);
}
