var hn = {
	"duration": 3000,
	"cities": {
		"vienna" : {
			"name" : "Vienna", 
			"image" : 0,
			"map" : 40,
			"next" : "salzburg",
			"prev" : "bratislava"
		},
		"salzburg" : {
			"name" : "Salzburg",
			"image" : -901,
			"map" : 199,
			"next" : "tyrol",
			"prev" : "vienna"
		},
		"tyrol" : {
			"name" : "Tyrol",
			"image" : -1802,
			"map" : 357,
			"next" : "budapest",
			"prev" : "salzburg"
		},
		"budapest" : {
			"name" : "Budapest",
			"image" : -2703,
			"map" : 518,
			"next" : "prague",
			"prev" : "tyrol"
		},
		"prague" : {
			"name" : "Prague",
			"image" : -3604,
			"map" : 677,
			"next" : "bratislava",
			"prev" : "budapest"
		},
		"bratislava" : {
			"name" : "Bratislava",
			"image" : -4505,
			"map" : 833,
			"next" : "vienna",
			"prev" : "prague"
		}
	}
};

$(document).ready(function() {
	if($("div.destination-map").length) {
		$(".header-switch-left").click(function() {
			var id = this.id;
			$(".image-wrapper").animate({
				left: hn.cities[id].image + "px"
			}, hn.duration, "swing", function(){
				$(".header-switch-right").attr("id", hn.cities[id].next);
				$(".header-switch-right").attr("title", "Next Destination: " + hn.cities[$(".header-switch-right").attr("id")].name);
				$(".header-switch-left").attr("id", hn.cities[id].prev);
				$(".header-switch-left").attr("title", "Previous Destination: " + hn.cities[$(".header-switch-left").attr("id")].name);
			});
			$("#dm-dot").animate({
				left: hn.cities[id].map + "px"
			}, hn.duration, "swing", function() {});
		});
		$(".header-switch-right").click(function() {
			var id = this.id;
			$(".image-wrapper").animate({
				left: hn.cities[id].image + "px"
			}, hn.duration, "swing", function(){
				$(".header-switch-right").attr("id", hn.cities[id].next);
				$(".header-switch-right").attr("title", "Next Destination: " + hn.cities[$(".header-switch-right").attr("id")].name);
				$(".header-switch-left").attr("id", hn.cities[id].prev);
				$(".header-switch-left").attr("title", "Previous Destination: " + hn.cities[$(".header-switch-left").attr("id")].name);
			});
			$("#dm-dot").animate({
				left: hn.cities[id].map + "px"
			}, hn.duration, "swing", function() {});
		});
	}
});
