<!--
function frmValidTxtAreaMaxChars(objTextArea, intMaxChars, strTextMsg)
{
	if (objTextArea.value == strTextMsg)
	{
		return
	}
	
	var intCharDiff
	intCharDiff = parseInt(objTextArea.value.length) - intMaxChars
	if (intCharDiff > 0)
	{
		objTextArea.value = objTextArea.value.substr(0,intMaxChars)
		alert ('Maximum characters exceded!\nText has been truncated.' + objTextArea.value.length)
		objTextArea.focus()
	}
}

function isNumeric(p_strVal)
{
	for (var i=0; i <= p_strVal.length - 1; i ++) {
		if (isNaN(parseInt(p_strVal.charAt(i))))
		{
			return false
		}
	}

	return true
}

function isZip(p_Zip)
{
	if (isNumeric(p_Zip) && p_Zip.length == 5)
	{
		return true
	}
	return false
}

function isMoney(p_Money)
{
	var aMoney
	if (p_Money.indexOf(',') > 0)
	{
		aMoney = p_Money.split(',')
		for (var i=0; i < aMoney.length; i++)
		{
			if (!(isNumeric(aMoney[i])))
			{
				return false
			}
			
			if (i == 0)
			{
				if (aMoney[i].length > 3)
				{
					return false
				}
			}
			else
			{
				if (aMoney[i].length != 3)
				{
					return false
				}
			}
		}
	}
	else
	{
		if (!(isNumeric(p_Money)))
		{
			return false
		}
	}
	return true
}

function isWholeMoney(p_Money)
{
	if (p_Money.indexOf('.') > 0)
	{
		return false
	}
	else
	{
		return isMoney(p_Money)
	}
}

function isEmail(p_Email)
{
    if (p_Email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}

function isPhoneNumber(p_Phone, p_Country)
{
	if (p_Country == 'US')
	{
		return isUSPhoneNumber(p_Phone)
	}
	else
	{
		if (isNumeric(p_Phone) && parseInt(p_Phone) > 0 && p_Phone.length > 9)
		{
			return true
		}
	}
	
	return false
}

function isUSPhoneNumber(p_Phone)
{
	if (!(isNumeric(p_Phone)) || p_Phone.length > 11)
	{
		return false
	}
	if (p_Phone.length == 10)
	{
		if (parseInt(p_Phone.charAt(0)) < 2)
		{
			return false
		}
	}
	if (p_Phone.length == 11)
	{
		if (p_Phone.charAt(0) != '1' || parseInt(p_Phone.charAt(1)) < 2)
		{
			return false
		}
	}
	
	return true
}

function isURL(p_URL)
{
// acc.to rfc1738 url is: scheme://machine.domain/full-path-of-file
    scheme = "(http:\\/\\/)";  // scheme HTTP is: http://(host):(port)/(path)?(searchpart)
    machine = "[A-Za-z0-9]+((\\.|(\\-)+)[A-Za-z0-9]+)*";
    domain = "[A-Za-z]{2,3}"
    file_path = "(\\/[\\w\\.\\-]*)";
    var reURL = new RegExp("^" + scheme + "?" + machine + "\." + domain + file_path + "*$");
    return (reURL.test(p_URL));
}

function getRadioOrChkBoxValue(p_ObjRadChk)
{
	if (typeof p_ObjRadChk.length == 'undefined')
	{
		if (p_ObjRadChk.checked)
		{
			return p_ObjRadChk.value
		}
	}
	else
	{
		for (var i=0; i < p_ObjRadChk.length ; i++)
		{
			if (p_ObjRadChk[i].checked)
			{
				return p_ObjRadChk[i].value
			}
		}
	}
	
	return ''
}

function isFormElementBlank(frmElement, p_frmElementTxtMsg)
{
	var formElement

	if (typeof frmElement.type == 'undefined') {
		formElement = frmElement[0];
	}
	else {
		formElement = frmElement
	}

	switch(formElement.type)
	{
		case 'select-multiple':
		{
			if (frmElement.selectedIndex == -1)
			{
				return true;
			}
			else
			{
				for (var i=0; i<frmElement.options.length; i++)
				{
					if (frmElement.options[i].selected)
					{
						if (frmElement.options[i].value == '')
						{
							return true
						}
					}
				}
			}
			break;
		}
		case 'select-one':
		{
			if (frmElement.selectedIndex == -1)
			{
				return true;
			}
			else
			{
				if (frmElement.options[frmElement.selectedIndex].value == '')
				{
					return true;
				}
			}
			break;
		}
		case 'text':
		{
			if ((frmElement.value.replace(/\s/g,"") == "") || (frmElement.value == p_frmElementTxtMsg))
			{
				return true
			}
			break;
		}
		case 'textarea':
		{
			if ((frmElement.value.replace(/\s/g,"") == "") || (frmElement.value == p_frmElementTxtMsg))
			{
				return true
			}
			break;
		}
		case 'radio':
			if (getRadioOrChkBoxValue(frmElement) == '')
			{
				return true
			}
		case 'checkbox':
			if (getRadioOrChkBoxValue(frmElement) == '')
			{
				return true
			}
		default:
		{
			return false
		}
	}
}

function setSelectOption(p_ObjSel, p_Val)
{
	for (var i=0; i < p_ObjSel.options.length; i++)
	{
		if (p_ObjSel.options[i].value == p_Val)
		{
			p_ObjSel.selectedIndex = i
			break;
		}
	}
}
// -->