
function Error_Class() {
	this.init();
	
	this.defaultColor = "#FFFFFF";
	this.errorColor = "#FFFFCC";
	this.errorStyle = "backgroundColor";
};

Error_Class.prototype.MESSAGES = {
	
};

Error_Class.prototype.init = function() {

};

Error_Class.prototype.isProperLength = function(el, len) {
	if (!this.isEmptyNull(el) && String(el.value).length == len) {
		return true;
	}
	return false;
};

Error_Class.prototype.isEmpty = function(el) {
	return this.isEmptyNull(el);	
};

Error_Class.prototype.isEmptyNull = function(el) {
	
	el = this.isElement(el);
	
	if (!el.value || el.value == "") {
		return true;
	}
	return false;
};

Error_Class.prototype.isZipCode = function(elZip) {

	elZip = this.isElement(elZip) ? elZip : false;
	
	if (elZip && this.isProperLength(elZip, 5) && !isNaN(elZip.value)) {
		return true;	
	} else {
		return false;	
	}
	
};

Error_Class.prototype.isPhoneNumber = function(el, bRequired) {
	
	var elValue = !this.isEmptyNull(el) ? el.value : false;
	
	if (/\d{3}\-\d{3}\-\d{4}/.test(String(elValue))) {
		return true;
	}  
	
	return false;
};

Error_Class.prototype.isValidDate = function(elMonth, elDate, elYear) {
	var elValue = elMonth.value + "/" + elDate.value + "/" + elYear.value;
	
	if (elValue == "\/\/") {
		return false;
	} else if (!/\d{1,2}\/\d{1,2}\/\d{2,4}/g.test(elValue)) {
		return false;
	} 
	
	return true;
};

Error_Class.prototype.isEmail = function(elEmail) {
	
	var pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
		
	if(pattern.test(String(elEmail.value))) {
		return true;
	}
	
	return false;
};

Error_Class.prototype.isElement = function(elem) {
	
	if (typeof(elem) == "string") {
		
		return el.get(elem);
		
	} else {
		
		return elem;
			
	}
};


Error_Class.prototype.checkDropDown = function(elem) {
	
	var oEl = this.isElement(elem);
	
	if (oEl.selectedIndex == 0) {
		
		return false;	
	
	} else {
	
		return true;	
	
	}
	
};

var error = new Error_Class();