function Form()
	{
	
	var f=document.forms[0];
	strValuedata1=document.FM1.da_data.value
	strValuedata2=document.FM1.a_data.value
	
	if((strValuedata2!="" && strValuedata1=="") || (strValuedata1!="" && strValuedata2=="")){
		alert("Inserire entrambi i campi data");
		return false;
	}
	
	if (strValuedata1!=""){
	
		if (ValidaData(strValuedata1)){return true}else {alert("Inserire una data valina nel capo \' DA DATA\' "); return false;}
	}
	
	if (strValuedata2!=""){
		if (ValidaData(strValuedata2)){return true}else {alert("Inserire una data valina nel capo \' A DATA\' ");return false;}
	}
	
	
	
		
}

function ValidaData(strValue){
var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
 
  //check to see if in correct format
  if(!objRegExp.test(strValue))
   {//alert("");
  
   return false;} //doesn't match pattern, bad date
   
  else{
    var strSeparator = strValue.substring(2,3) 
    var arrayDate = strValue.split(strSeparator); 
    //create a lookup for months not equal to Feb.
    var arrayLookup = { '01' : 31,'03' : 31, 
                        '04' : 30,'05' : 31,
                        '06' : 30,'07' : 31,
                        '08' : 31,'09' : 30,
                        '10' : 31,'11' : 30,'12' : 31}
    var intDay = parseInt(arrayDate[1],10); 

    //check if month value and day value agree
  	  if(arrayLookup[arrayDate[0]] != null) {
    	  if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0)
        	return true; //found in lookup table, good date
	    }
    
    //check for February (bugfix 20050322)
    //bugfix  for parseInt kevin
    //bugfix  biss year  O.Jp Voutat
    var intMonth = parseInt(arrayDate[0],10);
    if (intMonth == 2) { 
       var intYear = parseInt(arrayDate[2]);
       if (intDay > 0 && intDay < 29) {
           return true;
       }
       else if (intDay == 29) {
         if ((intYear % 4 == 0) && (intYear % 100 != 0) || 
             (intYear % 400 == 0)) {
              // year div by 4 and ((not div by 100) or div by 400) ->ok
             return true;
         }   
       }
    }
  }  
  //alert("Data non valida")
  return false; //any other values, bad date
  
}
