function strltrim() 
{
    //Match spaces at beginning of text and replace with a null string
    return this.replace(/^\s+/,'');
}
function strrtrim() 
{
    //Match spaces at end of text and replace with a null string
    return this.replace(/\s+$/,'');
}
function strtrim() 
{
	//Match spaces at beginning and end of text and replace
	//with null strings
	return this.replace(/^\s+/,'').replace(/\s+$/,'');
}
function boolIsEmail() {
if (this.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
    return true;
else
    return false;
}
function boolIsPhone() {
if( this.match(/[^0-9\s().-]+/g) )
	return false;
else
	return true;
}

String.prototype.ltrim = strltrim;
String.prototype.rtrim = strrtrim;
String.prototype.trim = strtrim;
String.prototype.isEmail = boolIsEmail;
String.prototype.isPhone = boolIsPhone;

function cleanTextField( value )
{
	value = value.trim();
	value = value.replace(/[<>]+/g,'');
	return value;
}

function cleanInput( obj )
{
	obj.value = cleanTextField(obj.value);
}

function cleanTextarea512( value )
{
	value = cleanTextField(value);
	if( value.length > 512 )
		value = value.substring(0,512);
	return value;
}

function checkGroup(inputName, length)
{
	for( var i=1; i<=length; i++ )
	{
		if( document.getElementById(inputName+"_"+i).checked )
			return true;
	}
	return false;
}

function isCleanedBlank( value )
{
	return (value == "");
}

function isBlank( obj )
{
	obj.value = cleanTextField( obj.value );
	return (obj.value == "");
}



