﻿function showWeather()
{
	var weatherCityTemps =  $.cookie('cityTemps');	 // οι θερμοκρασίες
		if (weatherCityTemps==null || weatherCityTemps=="")
			{
				$.get("/cityTemps.asp", function(data){
					displayCityData(data)
													  });
			} //φέρνω τις θερμοκρασίες εφόσον δεν υπάρχουν
		else
			{displayCityData(weatherCityTemps)}	
}

function displayCityData(weatherCityTemps)
{
var weatherCity =  $.cookie('weatherCity');	 // η πόλη που έχω επιλέξει
		if (weatherCity==null || weatherCity=="")
		   {weatherCity = 1;} // εφόσον δεν έχω επιλέξει default είναι η Αθήνα
var weatherCityName;
	if (weatherCity==1)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("1","Αθήνα")>Αθήνα</a>';}
	else if(weatherCity==2)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("2","Θεσσαλονίκη")>Θεσσαλονίκη</a>'}
	else if(weatherCity==3)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("3","Πάτρα")>Πάτρα</a>'}
	else if(weatherCity==4)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("4","Ηράκλειο")>Ηράκλειο</a>'}
	else if(weatherCity==5)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("5","Λάρισα")>Λάρισα</a>'}
	else if(weatherCity==6)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("6","Καλαμάτα")>Καλαμάτα</a>'}
	else if(weatherCity==7)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("7","Βόλος")>Βόλος</a>'}
	else if(weatherCity==8)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("8","Ιωάννινα")>Ιωάννινα</a>'}
	else if(weatherCity==9)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("9","Καβάλα")>Καβάλα</a>'}
	else if(weatherCity==10)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("10","Αλεξανδρούπολη")>Αλεξανδρούπολη</a>'}
	else if(weatherCity==11)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("11","Σπάρτη")>Σπάρτη</a>'}
	else if(weatherCity==12)
		{weatherCityName=' <a style="color:white" href=javascript:loadWeatherMenuUi("12","Ρόδος")>Ρόδος</a>'}
	else
		{}
aImage = getQueryVariable('image'+weatherCity,$.cookie('cityImages'));

weatherImage = ' <img src="/images/weather/'+aImage+'"  align="absmiddle" width="25" style="padding-bottom:2px" >';

$('#weatherBarCity').html('<a href="/weather.asp" style="color:#c68700;font-weight:bold">Καιρός</a>'+' '+weatherImage +' '+weatherCityName+' '+getQueryVariable('city'+weatherCity,weatherCityTemps)+'°C');	
}







function displayCities()
{
	$('#weatherCities').fadeIn();
}  

function hideCities()
{
	$('#weatherCities').fadeOut();
} 



function changeWheatherCity(id)
{
	$.cookie('weatherCity', id,{ expires:300});
	showWeather();			
	hideCities();		
}
