<!--


function cancelForm(strFormName) {
	document.forms[strFormName].elements["action"].value = "cancel";
	document.forms[strFormName].submit()
}

function addOpt(strFormName, strSelectName){

	booItemFound = false
	lngTmpI = document.forms[strFormName].elements[strSelectName + "Source"].selectedIndex;
	if (lngTmpI > -1){
		lngTmpOptionI = document.forms[strFormName].elements[strSelectName + "Source"].options[lngTmpI].value
		lngTmpOptionText = document.forms[strFormName].elements[strSelectName + "Source"].options[lngTmpI].text
		if (lngTmpOptionI > 0){
			lngTmpOptionLength = document.forms[strFormName].elements[strSelectName + "Destination"].options.length - 1
		
			for (i=0; i<lngTmpOptionLength+1; i++){
				if (lngTmpOptionI == document.forms[strFormName].elements[strSelectName + "Destination"].options[i].value){
					booItemFound = true
				}
			}			
			if (booItemFound == false){
				strLastOption = document.forms[strFormName].elements[strSelectName + "Destination"].options[lngTmpOptionLength]
				document.forms[strFormName].elements[strSelectName + "Destination"].options[lngTmpOptionLength] = new Option(lngTmpOptionText, lngTmpOptionI)
				document.forms[strFormName].elements[strSelectName + "Destination"].options[lngTmpOptionLength + 1] = strLastOption
			}
		}
	}
	setValuesInForm(strFormName, strSelectName)
}

function removeOpt(strFormName, strSelectName){
	lngTmpI = document.forms[strFormName].elements[strSelectName + "Destination"].selectedIndex;
	if (lngTmpI > -1){
		lngTmpOptionI = document.forms[strFormName].elements[strSelectName + "Destination"].options[lngTmpI].value
		if (lngTmpOptionI > 0){
			document.forms[strFormName].elements[strSelectName + "Destination"].options[lngTmpI] = null
		}
	}
	setValuesInForm(strFormName, strSelectName)
}

function setValuesInForm(strFormName, strSelectName){
	strTmpOptions = ""
	lngTmpOptionLength = document.forms[strFormName].elements[strSelectName + "Destination"].options.length
		
	for (i=0; i<lngTmpOptionLength; i++){
		lngTmpOptionI = document.forms[strFormName].elements[strSelectName + "Destination"].options[i].value
		if (lngTmpOptionI > 0){
			strTmpOptions = strTmpOptions + lngTmpOptionI + "|"
		}
	}
	if (strTmpOptions.length > 1){
		strTmpOptions = strTmpOptions.substring(0, strTmpOptions.length - 1)
	}
	document.forms[strFormName].elements["_" + strSelectName].value = strTmpOptions
}


function setDateFromCalendar(strFormName, strField, dateSupplied){
	document.forms[strFormName].elements[strField].value = dateSupplied;
}

//*****************************************************************************
//** INPUT FUNCTIONS
//*****************************************************************************

function testWordCount(strTextBoxID, lngMaxWordCount) {

	//** get the text from the text box
	var strWords = document.forms[0].elements[strTextBoxID].value;

	if (strWords.length == 0)
	{
		document.forms[0].elements[strTextBoxID + "WordCount"].value = lngMaxWordCount;
	}

	//** get the character length
	var lngWordCount = strWords.length;

	//** remove all double spaces
	for (var num=1; num < lngWordCount; num++){
		strWords = strWords.replace("  "," ");
	}

	//** trim trailing spaces
	if (strWords.substring(lngWordCount - 1, lngWordCount) == " "){
		strWords = strWords.substring(0, lngWordCount-1);
	}

	//** split the text input by spaces
	var aStrWords = strWords.split(' ');

	//** put the word count into a display
	document.forms[0].elements[strTextBoxID + "WordCount"].value = (lngMaxWordCount - aStrWords.length);
	
	//** if the number of words is too great
	if (aStrWords.length > lngMaxWordCount){
		var strReturnText = ""

		//** get the max number of words from the form
		for (i=0; i < lngMaxWordCount; i++){
			strReturnText = strReturnText + aStrWords[i] + " ";
		}
		
		//** reset the text in the input
		document.forms[0].elements[strTextBoxID].value = strReturnText;

		//** set the word count box
		document.forms[0].elements[strTextBoxID + "WordCount"].value = 0;
		return;
	}

	if (strWords == ""){
		//** clear the count box
		document.forms[0].elements[strTextBoxID + "WordCount"].value = "";
	}
}

//*****************************************************************************


-->
