/***
  The file add string with some more useful function as prototype
  Created By: WeiFeng Lu
  Date: Feb. 13, 2003
  $Id: string.js,v 1.1.1.1 2005/09/13 08:05:17 app Exp $
**/
var _regTrim		=	/(^\s+)|(\s+$)/g;
var _regLeading0	=	/(^0+)/g;
var _regNumeric		=	/^-?\d+$/g;
var _regNaturalNum	=	/^\d+$/g;

function w_trimLeading0()
{
    return this.replace(_regLeading0, "");
}

function w_trim()
{
    return this.replace(_regTrim, "");
}

function w_isBlank()
{
    if (this.length == 0) {
        return true;
    } else {
        return false;
    }
}

function w_toInt()
{
    return parseInt(this);
}

function w_isNumeric()
{
    if (_regNumeric.test(this)) {
        return true;
    } else {
        return false;
    }
}

function w_isNaturalNum()
{
    if (_regNaturalNum.test(this)) {
        if ( 0 == parseInt(this)) {
            return false;
        } else {
            return true;
        }
    } else {
        return false;
    }
}

function w_isValidEmail()
{
    var _regMail = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi;
    if (_regMail.test(this)) {
        return true;
    } else {
        return false;
    }
}

String.prototype.trim		=	w_trim;
String.prototype.trimLeading0	=	w_trimLeading0;
String.prototype.isBlank	=	w_isBlank;
String.prototype.toInt		=	w_toInt;
String.prototype.isNumeric	=	w_isNumeric;
String.prototype.isNaturalNum	=	w_isNaturalNum;
String.prototype.isValidEmail   =       w_isValidEmail;