// String Function : Trim()
function Trim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
	return "";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
	{
	return "";
	}
	else
	{
	return TRIM_VALUE;
	}
} //End Function

// String Function : RTrim()
function RTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
	return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
		strTemp = VALUE.substring(0,iTemp +1);
		break;
		}
		iTemp = iTemp-1;
	} //End While
	return strTemp;

} //End Function

// String Function : LTrim()
function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
	return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
		strTemp = VALUE.substring(iTemp,v_length);
		break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function


function getkey(e)
{
	if (window.event)
	return window.event.keyCode;
	else if (e)
	return e.which;
	else
	return null;
}

function goodchars(e, goods)
{
	var key, keychar;
	key = getkey(e);
	if (key == null) return true;
	// get character
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();
	// check goodkeys
	if (goods.indexOf(keychar) != -1)
	return true;
	// control keys
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
	return true;
	// else return false
	return false;
}

function isEmpty(value)
{
	if (value.length < 1)
		return true;
	return false;
}