
var vettoreCountry=new Array();
function Country(sId,sNome,sParent){
	this.id=sId;
	this.nome=sNome;
	this.parent=sParent;
	return this;
}




function changeCountry()
{
	var count = document.getElementById("country");
	var i=0;
	count.selectedIndex = 0;
	count.options.length = 1;
	var reg=document.getElementById("regione").options[document.getElementById("regione").selectedIndex].value;
	if (reg > 0)
	{	for (var j=0;j<vettoreCountry.length;j++){
			if(vettoreCountry[j].parent == reg){
				i++;
				count.options.length = i+1;
				count.options[i].value = vettoreCountry[j].id;
				count.options[i].text = vettoreCountry[j].nome;
			}
		}	
	}
	else if (reg==0){
		for (var j=0;j<vettoreCountry.length;j++){
			i++;
			count.options.length = i+1;
			count.options[i].value = vettoreCountry[j].id;
			count.options[i].text = vettoreCountry[j].nome;
		}	
	}
}