//controlla se è un numero intero - solo positivo
function checkintnum(num){
	var anum=/(^\d+$)/
	return (anum.test(num))
}

//controlla se è un numero - solo positivo (anche decimale)
function checknum(num){
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	return (anum.test(num))
}

//controlla se sono lettere
function checkletters(let){
	var alet=/(^[a-zA-Z]+$)/
	return (alet.test(let))
}

//controlla se la data è valida
function checkdate(strDay,strMonth,strYear){
        daysInMonth=new Array(31,29,31,30,31,30,31,31,30,31,30,31)
	month=parseInt(strMonth,10)
	day=parseInt(strDay,10)
	year=parseInt(strYear,10)
	if (isNaN(day)||isNaN(month)||isNaN(year)) return false
	if (strYear.length==2) {
	   if (year<50) {strYear='20'+strYear;year=year+2000}
	   else {strYear='19'+strYear;year=year+1900}
	}
	if (strMonth.length<1 || month<1 || month>12) return false
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month-1]) return false
	if (strYear.length != 4 || year==0 || year<1900 || year>2100) return false
	return true
}

function daysInFebruary (year){
	return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function checkMail(val) {
  var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
  if (filter.test(val)) return true
  return false
}




