function ltrim(myStr)
{
	return myStr.replace(/^\s*/, '');
}

function rtrim(myStr)
{
	return myStr.replace(/\s*$/, '');
}

function trim(myStr)
{
	return rtrim(ltrim(myStr));
}


function getSexName(sex)
{
	switch (sex)
	{
		case 'M':
			return 'Male';
			break;
		case 'F':
			return 'Female';
			break;
		default:
			return '';
			break;
	}
}


function getSexGroup(sex)
{
	switch (sex)
	{
		case 'M':
			return 'Men';
			break;
		case 'F':
			return 'Women';
			break;
		default:
			return '';
			break;
	}
}

function getXMLDate(myDate)
{
	var returnDate = new Date(myDate);
	return returnDate.getFullYear() + "-" + twoDigits(parseInt(returnDate.getMonth()) + 1) + "-" + twoDigits(returnDate.getDate()) + "T" + twoDigits(returnDate.getHours()) + ":" + twoDigits(returnDate.getMinutes()) + ":" + twoDigits(returnDate.getSeconds());
}

function getFormattedDate(myDate)
{
	var returnDate = new Date(myDate.substring(0, 4), parseInt(myDate.substring(5, 7), 10) - 1, parseInt(myDate.substring(8, 10), 10), parseInt(myDate.substring(11, 13), 10), parseInt(myDate.substring(14, 16), 10), parseInt(myDate.substring(17, 19), 10));
	return (parseInt(returnDate.getMonth()) + 1) + "/" + returnDate.getDate() + "/" + returnDate.getFullYear() + " " + returnDate.getHours() + ":" + twoDigits(returnDate.getMinutes()) + ":" + twoDigits(returnDate.getSeconds());
}

function twoDigits(myValue)
{
	if (myValue < 10)
		myValue = "0" + myValue;
	
	return myValue;
}

function replaceQuotes(myVal)
{
	myVal = myVal.replace(eval("/" + String.fromCharCode(145) + "/g"), '\'');
	myVal = myVal.replace(eval("/" + String.fromCharCode(146) + "/g"), '\'');
	myVal = myVal.replace(eval("/" + String.fromCharCode(8216) + "/g"), '\'');
	myVal = myVal.replace(eval("/" + String.fromCharCode(8217) + "/g"), '\'');	
	
	myVal = myVal.replace(eval("/" + String.fromCharCode(147) + "/g"), '\"');
	myVal = myVal.replace(eval("/" + String.fromCharCode(148) + "/g"), '\"');
	myVal = myVal.replace(eval("/" + String.fromCharCode(8220) + "/g"), '\"');
	myVal = myVal.replace(eval("/" + String.fromCharCode(8221) + "/g"), '\"');
	
	return myVal;
}
