	function fld(val, lab, vdator, req)
	{
		this.val=val
		this.lab=lab
		this.req=req || true
		this.vdator=vdator || haschars
	}	
	function DOB(s)
	{
		return CheckDate((s+""))
	}
	function haschars(s)
	{
		return ((s+"").match(/^[^\s](.|\s|\S)*[^\s]$/)!=null)
	}
	function IsEmail(s)
	{
		var validEmailPattern = /^(.+)@(.+)$/			
	// Check that the format of the enter is userName@domainname
		return (s+"").match(validEmailPattern)	
	}
	function AusState(s)
	{
		return ((s+"").match(/^(ACT|NSW|NT|QLD|SA|WA|TAS|VIC)$/ig)!=null)
	}
	function AusPCode(s)
	{
		return ((s+"").match(/^(\d{3,4})$/)!=null)
	}
	function cardnum(s)
	{
		return ((s+"").match(/^(\d{13,16})$/)!=null)
	}
	function IsNumeric(s)
	{
		return ((s+"").match(/^(\d+)$/)!=null)
	}
	function expiry(s)
	{
		return ((s+"").match(/^(\d{2})\/(\d{2})$/)!=null)
	}
	
	function ValidO(o)
	{
		for (var i in o)
		{
				if (!o[i].Validate())
					return false
				if (!o[i].ValidateExtra())
					return false
		}
		return true
	}
	
	function Validate()
	{
		for (var i in this)
			if (this.req)
				if (isObject(this[i]))
					if (this[i].req)
						if (!this[i].vdator(this[i].val))
						{
							alert("This is not a valid " + this[i].lab + ".")
							return FocusBadFld(this, i)
						}
		return true
	}
	
	function FocusBadFld(o, i)
	{
			var o1=eval("main.app." + i + "_" + o.type)
			if ((o1.length!=null) && (o1.tagName!="SELECT"))
				o1=o1[o.ind]

			o1.focus()
			if (o1.tagName!="SELECT")
				o1.select()
			return false
	}
	
	function ValidateExtra()
	{
		return true
	}