function strTrim(tmpStr)
{
	tmpStr = tmpStr.replace(/^\s+/,"");//remove leading
	tmpStr = tmpStr.replace(/\s+$/,"");//remove trailing
	return tmpStr;
}
//------------------------------------------------------------------------------------
function trimFields()
{
	for(var i=0; i < obj.elements.length; i++)
	{
		if(obj.elements[i].type == "text" || obj.elements[i].type == "textarea" || obj.elements[i].type == "password")
		{
			obj.elements[i].value = strTrim(obj.elements[i].value);
		}
	}
}
//------------------------------------------------------------------------------------
function chkEmail(tmpStr)
{
	var email_pat = /^[a-z][a-z0-9_\.\-]*[a-z0-9]@[a-z0-9]+[a-z0-9\.\-_]*\.[a-z]+$/i;
	return(email_pat.test(tmpStr));
}

//------------------------------------------------------------------------------------
function validateTALength(strField, cntlName, maxChar)
{
	if(obj.elements[cntlName].value.length > maxChar)
	{
		alert(strField+" should be within "+maxChar+" characters.");
		//obj.elements[cntlName].focus();
		//obj.elements[cntlName].select();
		return false;
	}
	return true;
}
//------------------------------------------------------------------------------------
function NewWindow(pageName)
{
	window.open(pageName, '', 'width=500,height=450,toolbar=0,menubar=0,location=0,left=50,top=100');
}

//------------------------------------------------------------------------------------
function viewImage(imgURL)
{
	newWindow = window.open("","newWindow","titlebar=no,width=50,height=50,left=25,top=25,scrollbars=1");
	var doc = newWindow.document;
	doc.open();
	doc.write('<html>\n');
	doc.write('<head>\n');
	doc.write('<title>View Image</title>\n');
	doc.write('<meta http-equiv="imagetoolbar" content="no">\n');
	doc.write('</head>\n');
	doc.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" ondblclick="self.close();"  onblur="self.close();" onload="javascript:window.resizeTo(document.getElementById(\'theImage\').width + 10, document.getElementById(\'theImage\').height + 50)">\n');
	doc.write('<img src=\"'+imgURL+'\" alt=\"File: '+imgURL+'\n(Double Click to Close)\" border="0" name="theImage" id="theImage" />\n');
	doc.write('</body>\n');
	doc.write('</html>\n');
	newWindow.focus();
	doc.close();
}

