function getNewCaptcha( imageID )
{
    document.getElementById( imageID ).src = 'captcha/captcha.php?' + Math.random();;
}

function emailToID( name, domain, tld, displayObjectID )
{
    var theEmail = name;
    theEmail += '@';
    theEmail += domain;
    theEmail += '.';
    theEmail += tld;
    var myhref = '<a href="mailto:' + theEmail + '">' + theEmail + '</a>';
    document.getElementById( displayObjectID ).innerHTML = myhref;
}

function email( name, domain, tld )
{
    var theEmail = name;
    theEmail += '@';
    theEmail += domain + '.';
    theEmail += tld;
    var myhref = '<a href="mailto:' + theEmail + '">';
    document.write( myhref );
    document.write( theEmail );
    document.write( '</a>' );
}

var emailRegExp = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/;
function validateEmail( theEmail )
{
    return emailRegExp.test( theEmail );
}

/* ---------------------------- BEGIN TRIM FUNCTIONS ---------------------------- */
// Removes leading whitespaces
function LTrim( value )
{
    var re = /\s*((\S+\s*)*)/;
    return value.replace( re, "$1" );
}

// Removes ending whitespaces
function RTrim( value )
{
    var re = /((\s*\S+)*)\s*/;
    return value.replace( re, "$1" );
}

// Removes leading and ending whitespaces
function trim( value )
{
    return LTrim( RTrim( value ) );
}
/* ---------------------------- END TRIM FUNCTIONS ---------------------------- */
