
function BxJsForms ()
{

}

// get value

BxJsForms.prototype.get = function (s)
{
//	if (document.forms[this.name].elements[s])
	return document.forms[this.name].elements[s];
}

// err rhandling

BxJsForms.prototype.showErr = function (s, err)
{
	var o = document.getElementById ('f_err_' + s);
	o.innerHTML = err;
	o.style.display = 'inline';
}

BxJsForms.prototype.hideErr = function (s)
{
	var o = document.getElementById ('f_err_' + s);
	if (!o) return;
	o.style.display = 'none';
}

// check functions 

BxJsForms.prototype.checkRegExp = function (e, p)
{
	var r = new RegExp (p['regexp']);
	if (e.value.match(r))
		return true;
	return false;
}

BxJsForms.prototype.checkLen = function (e, p)
{
	var s = e.value;
	if (!s || s.length < p['min'] || s.length > p['max']) return false;
	return true;
}

BxJsForms.prototype.checkAvail = function (e, p)
{	
	if (!e) return false;
	var s = e.value; 
	if (!s || !s.length) return false;
	return true;
}

BxJsForms.prototype.isEnabled = function (e, p)
{	
	if (!e) return false;
	var s = e.checked; 
	if (!s) return false;
	return true;
}
BxJsForms.prototype.checkPassword = function (e, p)
{		
	var sPassword = e.value;
	var sConfirm = $(e.id + '_confirm').value;		
	
	//--- Check Length ---//	
	if(!sPassword.length || !sConfirm.length || sPassword.length != sConfirm.length) return false;
	
	//--- Check Content ---//
	if(sPassword != sConfirm) return false;
		
	return true;
}


