<!--
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

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 convdate(vdata)
{
	var strdata=vdata
	var strgiorno="0"+strdata.substring(0,strdata.indexOf("/"))
	strgiorno=strgiorno.slice(-2)
	strdata=strdata.substring(strdata.indexOf("/")+1)
	var strmese="0"+strdata.substring(0,strdata.indexOf("/"))
	strmese=strmese.slice(-2)
	strdata=strdata.substring(strdata.indexOf("/")+1)
	if (strdata.length>1) {
		var stranno="20"+strdata
	} else {
		var stranno="200"+strdata
	}
	stranno=stranno.slice(-4)
	strdata=stranno+strmese+strgiorno
	strdata=parseInt(strdata)
	return strdata
}

function isDate(dtStr){
	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)
	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)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		return false
	}
	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]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		return false
	}
return true
}
function controlla(obbligatorio,nome,campo_data,campo_numero)
{
	var elemento = document.getElementById(nome)
	len =elemento.elements.length;
	var i=0;
	var campo='\t'+' I seguenti campi obbligatori sono stati lasciati vuoti o il loro contenuto non è valido.:\r'
	var passa=true
	campo=campo+'_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\r\t'
	for( i=0 ; i<len ; i++) {
		if (elemento.elements[i].name.length > 0)
		{
			if (elemento.elements[i].name.indexOf(obbligatorio)>0 & elemento.elements[i].value.length<=0 ) 
				{
				campo=campo+'<'+elemento.elements[i].nome_vero+'>  '
				passa=false
				}
			else
				{
					if (elemento.elements[i].name.indexOf(campo_data) > 0 & !isDate(elemento.elements[i].value) &  elemento.elements[i].value.length > 0) 
						{
						campo=campo+'<'+elemento.elements[i].nome_vero+'>'
						passa=false
						}
					else if (elemento.elements[i].name.indexOf(campo_numero)>0 & isNaN(elemento.elements[i].value.replace(',','.')) & elemento.elements[i].value.length > 0) 
						{
						 
						campo=campo+'<'+elemento.elements[i].nome_vero+'> '
						passa=false
						}
				}
		}
	}
	campo=campo+'\r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ '
	if (passa) 
	{
		controlla=true;
		
			//elemento.submit()
	} else 
		{ alert(campo) }
}

function controlla_ins(obbligatorio,nome,campo_data,campo_numero)
{
		var elemento = document.getElementById(nome)
		len =elemento.elements.length;
		var i=0;
		var campo='\t'+' I seguenti campi obbligatori sono stati lasciati vuoti o il loro contenuto non è valido.:\r'
		var passa=true
		campo=campo+'_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\r\t'
		for( i=0 ; i<len ; i++) {
			if (elemento.elements[i].name.length > 0)
			{
				if (elemento.elements[i].name.indexOf(obbligatorio)>0 & elemento.elements[i].value.length<=0 ) 
					{
					campo=campo+'<'+elemento.elements[i].nome_vero+'>  '
					passa=false
					}
				else
					{
						if (elemento.elements[i].name.indexOf(campo_data) > 0 & !isDate(elemento.elements[i].value) &  elemento.elements[i].value.length > 0) 
							{
							campo=campo+'<'+elemento.elements[i].nome_vero+'>'
							passa=false
							}
						else if (elemento.elements[i].name.indexOf(campo_numero)>0 & isNaN(elemento.elements[i].value.replace(',','.')) & elemento.elements[i].value.length > 0) 
							{
							 
							campo=campo+'<'+elemento.elements[i].nome_vero+'> '
							passa=false
							}
					}
			}
		}
		if (!document.formreg.privacy.checked){
				alert('Confermare la legge sui dati personali');
			}
		campo=campo+'\r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ '
		if (passa) 
		{
			controlla=true;
			
				//elemento.submit()
		} else 
			{ alert(campo) }
}

function controllasub(obbligatorio,nome,campo_data,campo_numero)
{
	var elemento = document.getElementById(nome)
	len =elemento.elements.length;
	var i=0;
	var campo='\t'+' I seguenti campi obbligatori sono stati lasciati vuoti o errati :\r'
	var passa=true
	campo=campo+'_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\r\t'
	for( i=0 ; i<len ; i++) {
		if (elemento.elements[i].name.lenght > 0)
		{
			if (elemento.elements[i].name.indexOf(obbligatorio)>0 & elemento.elements[i].value.length<=0) {
				campo=campo+'<'+elemento.elements[i].nome_vero+'> '
				passa=false
			} else if (elemento.elements[i].name.indexOf(campo_data)>0 & !isDate(elemento.elements[i].value)) {
				campo=campo+'#'+elemento.elements[i].nome_vero+'# '
				passa=false
			} else if (elemento.elements[i].name.indexOf(campo_numero)>0 & isNaN(elemento.elements[i].value.replace(',','.'))) {
				campo=campo+' #'+elemento.elements[i].nome_vero+'# '
				passa=false
			}
		}
	}
	campo=campo+'\r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ '
	if (passa) 
	{
		return true;
	} else 
		{ 
			alert(campo) 
			return false;
		}
}

function MAMenu(id,ip) 
{
		if(ip!==0)
		{
			document.getElementById(id).style.top= ip;
		}

		
		if (document.getElementById("contenitore").style.display == "none") 
			{
				document.getElementById("contenitore").style.display = ""
			}
		else	
			{
				document.getElementById("contenitore").style.display = "none"
			}
}

function elimina(id,Viewtesto)
{
	if (confirm(Viewtesto))
	{
		document.location.href='del.asp?id='+id
	}
}

function elimina_tipo(id,tipo,Viewtesto)
{
	if (confirm(Viewtesto))
	{
		document.location.href='del.asp?id='+id+'&tipo='+tipo
	}
}

function elimina_quote(id,Viewtesto)
{
	if (confirm(Viewtesto))
	{
		document.location.href='del_quote.asp?id='+id
	}
}

function elimina_ris(id,tipo,Viewtesto)
{
	if (confirm(Viewtesto))
	{
		document.location.href='del_risposta.asp?id='+id+'&tipo='+tipo
	}
}

function elimina_down(id,Viewtesto)
{
	if (confirm(Viewtesto))
	{
		document.location.href='del_down.asp?id='+id
	}
}

function elimina_alleg(id,Viewtesto)
{
	if (confirm(Viewtesto))
	{
		document.location.href='del_allegati.asp?id='+id
	}
}

function form(nome)
{
	nome.submit()
}


function popup(scelta){
	finestra = window.open(scelta,'FINANZALOCALE','scrollbars=yes,resizable=NO,width=650,height=450,status=no,location=no,toolbar=no,left=50,top=50');
	finestra.focus();
}

									//-->
