


	function CForm()
	{
		this.NS = (document.layers) ? 1 : 0;
		this.IE = (document.all)    ? 1 : 0;
	}



	CForm.prototype.isMail = function(vs_mail)
	{
		var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
		return (re.test(vs_mail));
	}



	CForm.prototype.isDate = function(vs_date)
	{
		var re = /^(3[01]|0[1-9]|[12]\d)\/(0[1-9]|1[012])\/\d{4}/;
		return (re.test(vs_date))
	}



	CForm.prototype.isNumber = function(vs_value)
	{
		var re = /^[0-9]+$/;
		return (re.test(vs_value));
	}



	CForm.prototype.trimField = function(vu_field)
	{
		vu_field.value = vu_field.value.trim();
	}



	CForm.prototype.onKeyDownNumber = function(e)
	{
		if (this.IE) var li_code = window.event.keyCode;
		else		 var li_code = e.which;
		return (li_code == 9 || li_code == 8 || li_code == 46 || (li_code >= 37 && li_code <= 40) || (li_code >= 96 && li_code <= 105) || (li_code >= 48 && li_code <= 57));
	}



	CForm.prototype.onlyNumbers = function(vu_field)
	{
		var ls_value = '';
		var lb_change = false;
		for (var i=0; i < vu_field.value.length; i++)
		{
			var ls_char = vu_field.value.substr(i, 1);
			if (this.isNumber(ls_char)) ls_value += ls_char;
			else lb_change = true;
		}
		if (lb_change) vu_field.value = ls_value;
	}



	CForm.prototype.msgError = function(vu_form, vs_field, vs_message)
	{
		alert(vs_message);
		vu_form.elements[vs_field].focus();
		return false;
	}



	var Form = new CForm();

