//==================================================================
function StringTitleCase(pString)
{
var theValue;
var	len;
var result;

	theValue = new String(pString);
	len = theValue.length;
	result = "";
	
	for (i = 0; i < len; i++)
	{
		if (i == 0 || theValue.charAt(i - 1) == ' ')
		{
			if (i + 2 < len && theValue.substr(i, 2).toLowerCase() == "mc")
			{
				result += "Mc" + theValue.substr(i + 2, 1).toUpperCase();
				i = i + 2;
			}
			else if (i + 2 < len && theValue.substr(i, 2).toLowerCase() == "o'")
			{
				result += "O'" + theValue.substr(i + 2, 1).toUpperCase();
				i = i + 2;
			}
			else
			{
				result += theValue.charAt(i).toUpperCase();
			}
		}
		else
		{
			result += theValue.charAt(i).toLowerCase();
		}
	}

	return result;
}