function countryFocus(countrySelected){
	document.all.countryCode.length = 0;
	for (var i=0; i < arrayCountryCode.length; i++){
		var countryOption = document.createElement("OPTION");
		countryOption.text = arrayCountryName[i];
		countryOption.value = arrayCountryCode[i];
		document.all.countryCode.add(countryOption);
		if (countrySelected == arrayCountryCode[i]){
			countryOption.selected = true;}
	}
}

function countrySelection(citySelected){
	var countrySelected = document.all.countryCode.value;
	document.all.cityCode.length = 0;
	if (countrySelected == 0){
		for (var i=0; i < arrayCityCode.length; i++){
			var cityOption = document.createElement("OPTION");
			cityOption.text = arrayCityName[i];
			cityOption.value = arrayCityCode[i];
			document.all.cityCode.add(cityOption);}
	}else{
		var cityOption = document.createElement("OPTION");
		cityOption.text = arrayCityName[0];
		cityOption.value = arrayCityCode[0];
		document.all.cityCode.add(cityOption);
		for (var i=1; i < arrayCityCode.length; i++){
			if (countrySelected == arrayCityCountryCode[i]){
				var cityOption = document.createElement("OPTION");
				cityOption.text = arrayCityName[i];
				cityOption.value = arrayCityCode[i];
				document.all.cityCode.add(cityOption);
				if (citySelected == arrayCityCode[i]){
					cityOption.selected = true;}
			}
		}
	}
}

function citySelection(){
	var citySelected = document.all.cityCode.value;
	if (citySelected != 0){
		window.location.href="dealhotel.asp?cat=cityInfo&city="+ citySelected +"&sort=heb";}
}
function sendInfo(){
	document.hotelSelection.submit();
}

function catSelection(countryCode){
	var catSelected = document.all.catCode.value;
	if (catSelected != 0){
		document.all.countryCodeCat.length = 0;
		var countryOption = document.createElement("OPTION");
		countryOption.text = arrayCountryNameCat[0];
		countryOption.value = arrayCountryCodeCat[0];
		document.all.countryCodeCat.add(countryOption);
		
		for (var i=1; i < arrayCountryCat.length; i++){
			if (catSelected == arrayCountryCat[i]){
				var countryOption = document.createElement("OPTION");
				countryOption.text = arrayCountryNameCat[i];
				countryOption.value = arrayCountryCodeCat[i];
				document.all.countryCodeCat.add(countryOption);
				if (countryCode == arrayCountryCodeCat[i]){
					countryOption.selected = true;}
			}
		}
	}
}
function countrySelectionCat(cityCode){
	var countrySelected = document.all.countryCodeCat.value;
	var catSelected = document.all.catCode.value;
	document.all.cityCodeCat.length = 0;
	if (countrySelected != 0){
		var cityOption = document.createElement("OPTION");
		cityOption.text = arrayCityNameCat[0];
		cityOption.value = arrayCityCodeCat[0];
		document.all.cityCodeCat.add(cityOption);
		for (var i=1; i < arrayCityCat.length; i++){
			if ((catSelected == arrayCityCat[i]) && (countrySelected == arrayCityCountryCodeCat[i])){
				var cityOption = document.createElement("OPTION");
				cityOption.text = arrayCityNameCat[i];
				cityOption.value = arrayCityCodeCat[i];
				document.all.cityCodeCat.add(cityOption);}
				if (cityCode == arrayCityCodeCat[i]){
					cityOption.selected = true;}
		}
	}
}

function citySelectionCat(){
	var catSelected = document.all.catCode.value;
	var citySelected = document.all.cityCodeCat.value;
	if (citySelected != 0){
		window.location.href="dealhotel.asp?cat=hotelList&city="+ citySelected +"&sort=heb&search="+ catSelected;}
}

function insertCountry(){
	window.location.href="dealhotel.asp?cat=countryUpdate&country=newCountry";}

function insertCity(){
	window.location.href="dealhotel.asp?cat=cityUpdate&city=newCity";}

function insertHotel(){
	window.location.href="dealhotel.asp?cat=hotelUpdate&hotel=newHotel";}

function deleteHotel(hotelCode){
	if (window.confirm("האם אתה בטוח שברצונך למחוק מלון זה?")){
		window.location.href="dealhotel.asp?cat=hotelDelete&hotel=" + hotelCode ;}
}


function countryFocusInsert(countrySelected){
	document.all.countryCodeInsert.length = 0;
	for (var i=0; i < arrayCountryCode.length; i++){
		var countryOption = document.createElement("OPTION");
		countryOption.text = arrayCountryName[i];
		countryOption.value = arrayCountryCode[i];
		document.all.countryCodeInsert.add(countryOption);
		if (countrySelected == arrayCountryCode[i]){
			countryOption.selected = true;}
	}
}

function countrySelectionInsert(citySelected){
	var countrySelected = document.all.countryCodeInsert.value;
	document.all.cityCodeInsert.length = 0;
	if (countrySelected == 0){
		for (var i=0; i < arrayCityCode.length; i++){
			var cityOption = document.createElement("OPTION");
			cityOption.text = arrayCityName[i];
			cityOption.value = arrayCityCode[i];
			document.all.cityCodeInsert.add(cityOption);}
	}else{
		var cityOption = document.createElement("OPTION");
		cityOption.text = arrayCityName[0];
		cityOption.value = arrayCityCode[0];
		document.all.cityCodeInsert.add(cityOption);
		for (var i=1; i < arrayCityCode.length; i++){
			if (countrySelected == arrayCityCountryCode[i]){
				var cityOption = document.createElement("OPTION");
				cityOption.text = arrayCityName[i];
				cityOption.value = arrayCityCode[i];
				document.all.cityCodeInsert.add(cityOption);
				if (citySelected == arrayCityCode[i]){
					cityOption.selected = true;}
			}
		}
	}
}
