/* generic string functions */
function trim(str){
    str = this != window ? this : str;
    return str.replace(/^\s+/,'').replace(/\s+$/,'');
}

function isEmail(str){
    str = this != window ? this : str;
    var regx = /[A-Za-z0-9_\-.]+\@[A-Za-z0-9_\-.]+\.([A-Za-z_]{2,4})/;
    return regx.test(str);
}
String.prototype.trim    = trim;
String.prototype.isEmail = isEmail;

function $()
{
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++)
    {
        var element = arguments[i];
        if (typeof element == 'string')
        element = document.getElementById(element);
        if (arguments.length == 1)
        return element;
        elements.push(element);
    }
    return elements;
}


