function GAUtility_IDCompatible(divid)
{
	if (document.layers)
		return document.layers[divid];
	else if (document.all)
		return document.all[divid];
	else
		return document.getElementById(divid);
}

function GAUtility_isData(dateStr)
{
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
	
	var matchArray = dateStr.match(datePat);
	if (matchArray == null)
	{
		alert("La data non è in un formato valido. Verifica i valori immessi.")
		return false;
	}
	
	day = matchArray[1];
	month = matchArray[3];
	year = matchArray[4];
	
	if (month < 1 || month > 12)
	{
		alert("I mesi devono essere compresi tra 1 e 12!");
		return false;
	}
	
	if (day < 1 || day > 31)
	{
		alert("I giorni devono essere compresi tra 1 e 31!");
		return false;
	}
	
	if ((month==4 || month==6 || month==9 || month==11) && day==31)
	{
		alert("Il mese selezionato ('"+month+"') non è formato da 31 giorni!")
		return false
	}
	
	if (month == 2)
	{
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		
		if (day>29 || (day==29 && !isleap))
		{
			alert("Febbraio, nell'anno " + year + " non sembra essere formato da " + day + " giorni!");
			return false;
		}
	}
	
	return true;
}

function GAUtility_tab(a, index, csso, cssc)
{
	ul = a.parentNode.parentNode; // li ul
	div = ul.parentNode; // ul div
	mdiv = div.parentNode; // main div
	cdiv = mdiv.getElementsByTagName("div")[3]; // recupero il div del contenuto
	culdiv = cdiv.getElementsByTagName("div")[0]; // Recupero il primo div del contenuto
	culdivul = culdiv = culdiv.getElementsByTagName("ul"); // Recupero tutti gli "UL"
	
	for (i=0; i<ul.getElementsByTagName("li").length; i++)
	{
		li = ul.getElementsByTagName("li")[i];
		a = li.getElementsByTagName("a")[0];
		
		if (index!=i)
		{
			a.setAttribute("class", cssc); 
			a.setAttribute("className", cssc);
			culdivul[i].style.display = 'none';
		}
		else
		{
			a.setAttribute("class", csso); 
			a.setAttribute("className", csso);
			culdivul[i].style.display = 'block';
		}
	}
}