function messages(mess) {
	if (mess == "x"){
		document.getElementById("message").innerHTML = "<b>Choose a destination!</b>";
	} else {
		document.getElementById("message").innerHTML = mess;
	}
}

function changeColor(city, number){
	if(number==1){
		document.getElementById(city).style.color='#0C1C8C';
		document.getElementById(city).style.backgroundImage='none';
	}else{
		document.getElementById(city).style.color='';
		document.getElementById(city).style.backgroundImage='';
	}
}

function showT(q){
	document.getElementById('ima').setAttribute('src',q+'.png')
}

function setCity(tempCity){
 	var city = tempCity;
 	return city;
 }

function populateCountries() {
	var pm_2 = document.getElementById("country").options;
	var pm_3 = document.getElementById("city").options;
   	for (var i=0; i<selection.length ; i+=3) {
		var cale = new Option (selection[i+1],i+2);
		pm_2[pm_2.length] = cale;
 	}
 	if(typeof( window[ 'city' ] ) == "undefined" ){
 	}else{
		var countCountry = 0;
		for(var i=0; i<selection.length; i+=3){
			countCountry+=1;
			var countCity = 0;
			for(var j=0; j<selection[i+2].length; j+=3){
				if(selection[i+2][j+1].toLowerCase()==city.toLowerCase()){
					pm_2.selectedIndex = countCountry;
					populateCities(i+2);
					pm_3.selectedIndex = countCity;
				}
				countCity+=1;
			}
		}
 	}
}

function populateCities(j) {
	var pm_2 = document.getElementById("city").options;
	if (j!="0") {
		pm_2.length = 0;
		for (var k = 0; k<selection[j].length; k+=3) {
			var calh = new Option (selection[j][k+1],selection[j][k+0]);
			pm_2[pm_2.length] = calh;
		}
	}
}

function setDefaultYear(){
	var browser = navigator.appName;
	var aday,amonth,ayear;
	if (browser=="Microsoft Internet Explorer"){
		aday = document.getElementsByName("giorno")[0].options;
		amonth = document.getElementsByName("mese")[0].options;
		ayear = document.getElementsByName("anno")[0].options;
		var now = new Date();
		now.setDate(now.getDate()+2);
		aday.selectedIndex = now.getDate();
		amonth.selectedIndex = now.getMonth();
		ayear.selectedIndex = 0;//now.getYear();

	}else{
		aday = document.getElementById("giorno");
		amonth = document.getElementById("mese");
		ayear = document.getElementById("anno");
		var now = new Date();
		now.setDate(now.getDate()+2);
		aday.selectedIndex = now.getDate();
		amonth.selectedIndex = now.getMonth();
		ayear.selectedIndex = 0;//now.getYear();
	}
}

function setYears(){
	var pm_3 = document.getElementById("anno").options;
	var date = new Date();
	var year = date.getFullYear();
	document.getElementById("year").text = year;
	for (var i=0; i<2 ; i+=1) {
		year = year+1;
		var caly = new Option (year,i);
		pm_3[pm_3.length] = caly;
 	}
}