function trim(s)
{
     return s.replace(/^\s+|\s+$/g, '');
}

function SetCount(TextControl, SpanID, MaxLength) 
{
	TextLength = TextControl.value.length; 

	if (TextLength > MaxLength) 
	    HtmlCode = '<font color="#FF0000">' + TextLength + '</font> (' + MaxLength + ' max)'
	else 
	    HtmlCode = '<font color="#000000">' + TextLength + '</font> (' + MaxLength + ' max)'; 

	SpanID.innerHTML = HtmlCode; 
} 

function ShowHelp(PageName, FieldName) 
{
	window.open('showhelp.asp?p=' + escape(PageName) + '&f=' + escape(FieldName), 'acHelp', 'height=250,width=400,location=0,menubar=0,status=0,toolbar=0,resizable=1,scrollbars=1')
} 

function SetRepContact(IsLoading)
{
	if (document.form1.txtRepRelation.options[document.form1.txtRepRelation.selectedIndex].value == 'Myself')
	{
		document.form1.txtRepContact.disabled = true;
		If (!IsLoading)
		{
			document.form1.txtRepContact.value = document.form1.txtName.value;
		}
	}
	else
	{
		document.form1.txtRepContact.disabled = false;
	}
}