
function IsNumeric(val) {

	var re = /[A-Za-z]+/
	var stringFound = val.match(re);
		
	if (stringFound) 
	{
		return false;
	}
	return true;
}
	 
function IsDate(val) {
 
	var re = /[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,4}/
	var stringFound = val.match(re);
		
	if (!stringFound) 
	{
		return false;
	}
	return true;
}
	
function IsZipCodeValid(sZipcode)
{
	if(sZipcode.length == 5)
	{
		var re = new RegExp("^[0-9]{5}$","i");
	}
	else
	{
		var re = new RegExp("^[0-9]{5}-[0-9]{4}$","i");
	}
		
	var stringFound = sZipcode.match(re);

	//Display error message if the pattern was not found
	if (!stringFound) 
	{
		return false;
	}
	return true;
}

function IsPhoneValid(sPhone)
{
//	var re = new RegExp("^[0-9 ()-]*[0-9]+[0-9 ()-]*$","i");
//	var re = new RegExp("^[()]?[0-9]{3}[()- ]*[0-9]{3}[()- ]*[0-9]{4}$","i");
	var re = new RegExp("^[(]?[0-9]{3}[) -.]*[0-9]{3}[-.]?[0-9]{4}$","i");
	var stringFound = sPhone.match(re);

	//Display error message if the pattern was not found
	if (!stringFound) 
	{
		return false;
	}
	return true;
}


function IsEmailValid(sEmail)
{
	var EmailOk  = true;
	var re = new RegExp("^[a-zA-Z0-9]+[a-zA-Z_0-9.-]*[@]{1}[a-zA-Z_0-9-]+[.]{1}[a-zA-Z_0-9]+[a-zA-Z_0-9.]*$");
	var stringFound = sEmail.match(re);

	//Display error message if the pattern was not found
	if (!stringFound) {
		EmailOk = false;
	}
	return EmailOk
}

function IsPasswordValid(sPassword)
{
	var bRepeated = true;
	var i;
	var sPrevChar="";
	
	for(i=0;i<sPassword.length;i++)
	{
		if((sPrevChar != "") && (sPrevChar != sPassword.substr(i,1)))
		{
			bRepeated = false;
			break;
		}
		sPrevChar = sPassword.substr(i,1);
	}
	
	if(sPassword.length < 6 || sPassword.length > 20 || bRepeated)
	{
		return false;
	}
	
	var re = new RegExp("^[0-9a-zA-Z]*$","i");
	var stringFound = sPassword.match(re);

	//Display error message if the pattern was not found
	if (!stringFound) 
	{
		return false;
	}

	return true;
}

	function cat(ID, Desc) 
	{
		this.ID = ID
		this.Desc = Desc
		this.children = new Array()
	}
