function ValidateForm(nam)
{
	if (CheckNumbers(nam) == true)
		return true;
	else
		return false;
}

function CheckText(obj, result)
{
	var objR = document.getElementById(result);
	var txt;
	
	txt = obj.value;
	
	if (txt.indexOf("\;") != "-1")
		txt = txt.replace("\;", "&#59;");
	if (txt.indexOf("\"") != "-1")
		txt = txt.replace("\"", "&quot;" );
	if (txt.indexOf("'") != "-1")
		txt = txt.replace("'", "&#39;" );
	if (txt.indexOf(")") != "-1")
		txt = txt.replace(")", "&#41;");
	if (txt.indexOf("(") != "-1")
		txt = txt.replace("(", "&#40;");
	//if (txt.indexOf("-") != "-1")
	//	txt = txt.replace("-", "&#45;");
	if (txt.indexOf("|") != "-1")
		txt = txt.replace("|", "&#124;");
	//alert(txt);
	objR.value = txt;
}

function CheckTextNEW(obj, result)
{
	//var objR = document.getElementById(result);
	var txt;
	
	txt = obj.value;
	
	if (txt.indexOf("\;") != "-1")
		txt = txt.replace("\;", "&#59;");
	if (txt.indexOf("\"") != "-1")
		txt = txt.replace("\"", "&quot;" );
	if (txt.indexOf("'") != "-1")
		txt = txt.replace("'", "&#39;" );
	if (txt.indexOf(")") != "-1")
		txt = txt.replace(")", "&#41;");
	if (txt.indexOf("(") != "-1")
		txt = txt.replace("(", "&#40;");
	//if (txt.indexOf("-") != "-1")
	//	txt = txt.replace("-", "&#45;");
	if (txt.indexOf("|") != "-1")
		txt = txt.replace("|", "&#124;");
	/*alert(txt);*/
	//objR.value = txt;
	result.value = txt;
}

function CheckNumbers(nam)
{
	var txt = document.getElementById(nam);
	
	if(IsEmpty(txt)) 
	{ 
		alert('You have not entered an account number') 
		txt.focus(); 
		return false; 
	} 
	
	if (!IsNumeric(txt.value)) 
	{ 
		alert('Please enter only numbers.') 
		txt.focus(); 
		return false; 
	} 
	else if (txt.value == 0)
	{
		alert('Cart quantity must be greater than 0.');	
		txt.focus();
		return false;
	}
	
	return true;
}

function IsNumeric(sText)
{
	var ValidChars = "0123456789";
	var IsNumber=true;
	var Char;
	
	for (i = 0; i < sText.length && IsNumber == true; i++) 
	{ 
		Char = sText.charAt(i); 

		if (ValidChars.indexOf(Char) == -1) 
		{
			IsNumber = false;
		}
	}

	return IsNumber;
}

function IsEmpty(aTextField)
{
	if ((aTextField.value.length==0) || (aTextField.value==null))
		return true;
	else
		return false;
}
