﻿<!--

/***************************************************
BEGIN STRING METHODS SECTION
***************************************************/

function trim(trim_value)
{
	if (trim_value == null || trim_value.length < 1)
	{
		return "";
	}
	trim_value = rightTrim(trim_value);
	trim_value = leftTrim(trim_value);
	return trim_value;
}

function rightTrim(trim_value)
{
	if (trim_value == null)
	{
		return "";
	}	
	var v_length = trim_value.length;
	if(v_length < 1)
	{
		return "";
	}
	var w_space = String.fromCharCode(32);
	var strTemp = "";
	var iTemp = v_length - 1;
	while (iTemp > -1)
	{
		if (trim_value.charAt(iTemp) != w_space)
		{
			strTemp = trim_value.substring(0, iTemp + 1);
			break;
		}
		iTemp = iTemp - 1;
	}
	return strTemp;
}

function leftTrim(trim_value)
{
	if (trim_value == null)
	{
		return "";
	}	
	var v_length = trim_value.length;
	if(v_length < 1)
	{
		return "";
	}
	var w_space = String.fromCharCode(32);
	var strTemp = "";
	var iTemp = 0;
	while (iTemp < v_length)
	{
		if (trim_value.charAt(iTemp) != w_space)
		{
			strTemp = trim_value.substring(iTemp, v_length);
			break;
		}
		iTemp = iTemp + 1;
	}
	return strTemp;
}

function startsWith(searchIn, searchFor)
{
	if (searchIn == null || searchFor == null)
	{
		return false;
	}
	if (searchFor.length > searchIn.length)
	{
		return false;
	}
	return (searchIn.indexOf(searchFor) == 0);
}

function endsWith(searchIn, searchFor)
{
	if (searchIn == null || searchFor == null)
	{
		return false;
	}
	if (searchFor.length > searchIn.length)
	{
		return false;
	}
	return (searchIn.lastIndexOf(searchFor) == searchIn.length - searchFor.length);
}

/***************************************************
END STRING METHODS SECTION
***************************************************/

//-->
