<!--

// capitalize logic
function capitalize(formObject) {
	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;

    trimSpace(formObject);
    
	tmpStr = formObject.value;
	strLen = tmpStr.length;
	if (strLen > 0)  {
		for (index = 0; index < strLen; index++)  {
			if (index == 0)  {
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
				}
			else {
				tmpChar = tmpStr.substring(index, index+1);
				if ( (tmpChar == " " || tmpChar =="'" || tmpChar =="-") && index < (strLen-1) )  {
					tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
					preString = tmpStr.substring(0, index+1);
					postString = tmpStr.substring(index+2,strLen);
					tmpStr = preString + tmpChar + postString;
					}
				}
			}
		}
	formObject.value = tmpStr;
	}

// trims the whitespace at the start and end of input text values
function trimSpace(item) {
	var tmp = "";
	var item_length = item.value.length;
	var item_length_minus_1 = item.value.length - 1;
	for (index = 0; index < item_length; index++) {
		if (item.value.charAt(index) != ' ') {
			tmp += item.value.charAt(index);
			}
		else {
			if (tmp.length > 0) {
				if (item.value.charAt(index+1) != ' ' && index != item_length_minus_1) {
					tmp += item.value.charAt(index);
					}
				}
			}
		}
	item.value = tmp;
	}

// -->

