<!--
function validateRequiredField(field)
{
	this.field = field;
	return (this.field.value.replace(/ /gi, "").length > 0);
}

function validateMinimumFieldLength(field, required, minlength)
{
	this.field = field;
	this.minlength = minlength;
	this.required = required;
	var performValidation;

	if (this.required == 0)
	{
		performValidation = (this.field.value.length > 0);
	}
	else
	{
		performValidation = true;
	}
	
	if (performValidation)
	{
		return (this.field.value.length >= this.minlength);
	}
	else
	{
		return true;
	}

}

function validateMaximumFieldLength(field, required, maxlength)
{
	
	this.field = field;
	this.maxlength = maxlength;
	this.required = required;
	var performValidation;

	if (this.required == 0)
	{
		performValidation = (this.field.value.length > 0);
	}
	else
	{
		performValidation = true;
	}
	
	if (performValidation)
	{
		return (this.field.value.length <= this.maxlength);
	}
	else
	{
		return true;
	}
}

function validateNumericRange(field, required, minvalue, maxvalue)
{
	this.field = field;
	this.minvalue = minvalue;
	this.maxvalue = maxvalue;
	this.required = required;
	var performValidation;

	if (this.required == 0)
	{
		performValidation = (this.field.value.length > 0);
	}
	else
	{
		performValidation = true;
	}
	
	if (performValidation)
	{
		if(isNaN(this.field.value)) 
		{
			return false;
		}
		else
		{
			return (this.field.value >= this.minvalue && this.field.value <= this.maxvalue);
		}
	}
	else
	{
		return true;
	}

}

function validateNumericFloor(field, required, minvalue)
{
	this.field = field;
	this.minvalue = minvalue;
	this.required = required;
	var performValidation;

	if (this.required == 0)
	{
		performValidation = (this.field.value.length > 0);
	}
	else
	{
		performValidation = true;
	}
	
	if (performValidation)
	{
		if(isNaN(this.field.value)) 
		{
			return false;
		}
		else
		{
			return (this.field.value >= this.minvalue);
		}
	}
	else
	{
		return true;
	}
}

function validateNumericCeilling(field, required, maxvalue)
{
	this.field = field;
	this.maxvalue = maxvalue;
	this.required = required;
	var performValidation;

	if (this.required == 0)
	{
		performValidation = (this.field.value.length > 0);
	}
	else
	{
		performValidation = true;
	}
	
	if (performValidation)
	{
		if(isNaN(this.field.value)) 
		{
			return false;
		}
		else
		{
			return (this.field.value <= this.maxvalue);
		}
	}
	else
	{
		return true;
	}
}

function validateEmail(theValue, required)
{
	this.theValue = theValue;
	this.required = required;
	//var regExp = /.+@.+\..+/;
	var regExp = /^[a-zA-Z][\w\.-]*@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	return(validateRegExp(this.theValue, this.required, regExp))
}

function validateURL(theValue, required)
{
	this.theValue = theValue;
	this.required = required;
	var regExp = /http:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
	//var regExp = /http\:\/\/.+\..+/;
	return(validateRegExp(this.theValue, this.required, regExp))
}


function validateCUIT(theValue, required)
{
	this.theValue = theValue;
	this.required = required;
	var regExp = /[0-9]{2}-([0-9]{7}|[0-9]{8})-[0-9]{1}$/;
	if (this.theValue.replace(/\-/gi, "").length == 0)
	{
		if (this.required == 1)
		{
			return false;
		}
		else 
		{
			return true;
		}
	}
	else
	{
		return(validateRegExp(this.theValue, this.required, regExp))
	}
}

function validateIPAddress(theValue, required)
{
	this.theValue = theValue;
	this.required = required;
	var regExp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
	if (this.theValue.replace(/\./gi, "").length == 0)
	{
		if (this.required == 1)
		{
			return false;
		}
		else 
		{
			return true;
		}
	}
	else
	{
		return(validateRegExp(this.theValue, this.required, regExp))
	}
}

function validateGUID(theValue, required)
{
	this.theValue = theValue;
	this.required = required;
	var regExp = /[a-zA-Z0-9]{8}\-[a-zA-Z0-9]{4}\-[a-zA-Z0-9]{4}\-[a-zA-Z0-9]{4}\-[a-zA-Z0-9]{12}$/;
	if (this.theValue.replace(/\-/gi, "").length == 0)
	{
		if (this.required == 1)
		{
			return false;
		}
		else 
		{
			return true;
		}
	}
	else
	{
		return(validateRegExp(this.theValue, this.required, regExp))
	}
}

function validateCPA(theValue, required)
{
	this.theValue = theValue;
	this.required = required;
	var regExp = /[a-zA-Z]{1}[0-9]{4}[a-zA-Z]{3}$/;
	return(validateRegExp(this.theValue, this.required, regExp))
}


function validateNumber(theValue, required)
{
	this.theValue = theValue;
	this.required = required;
	var regExp = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/; ///[0-9]+/;
	return(validateRegExp(this.theValue, this.required, regExp))
}


function validateDate(theValue, minYear, maxYear, required)
{
	this.theValue = theValue;
	this.minYear = minYear;
	this.maxYear = maxYear;
	this.required = required;
	var dtCh = '/';
	var dtStr = this.theValue;
	//var regExp = /([0-9]{1}|[0-9]{2})\/([0-9]{1}|[0-9]{2})\/[0-9]{4}$/;
	var regExp = /[0-9]{6}/;

	if(validateRegExp(dtStr.replace(/\//gi, ""), this.required, regExp) == true)
	{
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh);
		var pos2=dtStr.indexOf(dtCh,pos1+1);
		var strDay=dtStr.substring(0,pos1);
		var strMonth=dtStr.substring(pos1+1,pos2);
		var strYear=dtStr.substring(pos2+1);
		
		var strYr = strYear;
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
		}

		var month=parseInt(strMonth);
		var day=parseInt(strDay);
		var year=parseInt(strYr);

		if (month < 1 || month > 12){
			return false;
		}
		if (day < 1 || day > 31 || (month == 2 && day > daysInFebruary(year)) || day > daysInMonth[month]){
			return false;
		}
		if (year==0 || year < this.minYear || year > this.maxYear){
			return false;
		}
	}
	else
	{
		return false;
	}
}


function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}


function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function validateRequiredList(field)
{
	this.field = field;
	var validList = false;

	for (var i = 0; i < this.field.options.length; i++)
	{
		if (this.field.options[i].selected == true)
		{
			if (this.field.options[i].value.length > 0)
			{
				validList = true;
				break;
			}
		}
	}	
	return validList;
}


function validateRequiredCheckbox(field)
{
	this.field = field;
	
	if (this.field.length > 0)
	{
		var validCheckbox = false;

		for (var i = 0; i < this.field.length; i++)
		{
			if (this.field[i].checked == true)
			{
				validCheckbox = true;
				break;
			}
		}
		return validCheckbox;
	}
	else
	{
		return this.field.checked;
	}	
}


function validateRequiredRadiobutton(field)
{
	this.field = field;
	
	var validRadiobutton = false;

	for (var i = 0; i < this.field.length; i++)
	{
		if (this.field[i].checked == true)
		{
			validRadiobutton = true;
			break;
		}
	}
	return validRadiobutton;
}


function validateRegExp(theValue, required, RegExpString)
{
	this.theValue = theValue;
	this.required = required;
	this.RegExpString = RegExpString;
	var validate;

	if (this.required == 0)
	{
		if (this.theValue.replace(/ /gi, "").length > 0)
		{
			validate = true;
		}
		else
		{
			validate = false;
		}
	}
	else
	{
		validate = true;
	}

	if (validate)
	{
		return(this.RegExpString.test(this.theValue));
	}
	else
	{
		return true;
	}
}
//-->
