var yellow_tours = new Object;
var blue_cities = new Object;
var blue_countries = new Object;
var pink_city = null;
var brown_cities = new Object;

function show_green_city (id, city, country, x, y)
{
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";
	//icon.image = "/Images/gmarker_small/green-small.png";
	var marker = new GMarker (new GLatLng (x, y), {icon: icon, title: city[0] + ', ' + country[0], zIndexProcess: function() { return 5; }});
	map.addOverlay (marker);
}

function show_green_tour (id, tour, operator, cities)
{
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";
	//icon.image = "/Images/gmarker_small/green-small.png";
	var line = new Array;
	for (var i = 0; i < cities.length; i ++) {
		var point = new GLatLng (cities[i][0], cities[i][1]);
		line[line.length] = point;
		var marker = new GMarker (point, {icon: icon, title: tour[0] + ', ' + operator[0], zIndexProcess: function() { return 5; }});
		map.addOverlay (marker);
	}
	map.addOverlay (new GPolyline (line, "#ff0000"));
}

function show_red_city (id, city, country, continent, username, seo, x, y)
{
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
	//icon.image = "/Images/gmarker_small/red-small.png";
	var marker = new GMarker (new GLatLng (x, y), {icon: icon, title: city[0] + ', ' + country[0], zIndexProcess: function() { return 4; }});
	map.addOverlay (marker);
}

function show_red_country (id, country, continent, username, seo, x, y)
{
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
	//icon.image = "/Images/gmarker_small/red-small.png";
	var marker = new GMarker (new GLatLng (x, y), {icon: icon, title: country[0], zIndexProcess: function() { return 4; }});
	map.addOverlay (marker);
}

function show_yellow_tour (id, tour, operator, url, markers)
{
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_yellow.png";
	//icon.image = "/Images/gmarker_small/yellow-small.png";
	var line = new Array;
	yellow_tours[id] = {'markers': new Array, 'line': null};
	for (var i = 0; i < markers.length; i ++) {
		var point = new GLatLng (markers[i][0], markers[i][1]);
		line[line.length] = point;
		var marker = new GMarker (point, {icon: icon, title: tour + ', ' + operator, zIndexProcess: function() { return 3; }});
		yellow_tours[id]['markers'][yellow_tours[id]['markers'].length] = marker;
		map.addOverlay (marker);
	}
	yellow_tours[id]['line'] = new GPolyline (line, "#ff0000");
	map.addOverlay (yellow_tours[id]['line']);
}

function show_blue_city (id, city, country, x, y)
{
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
	//icon.image = "/Images/gmarker_small/blue-small.png";
    var marker = new GMarker (new GLatLng (x, y), {icon: icon, title: city[0] + ', ' + country[0], zIndexProcess: function() { return 1; }});
	blue_cities[id] = marker;
	map.addOverlay (marker);
}

function show_blue_country (id, country, x, y)
{
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
	//icon.image = "/Images/gmarker_small/blue-small.png";
    var marker = new GMarker (new GLatLng (x, y), {icon: icon, title: country[0], zIndexProcess: function() { return 1; }});
	blue_countries[id] = marker;
	map.addOverlay (marker);
}

function show_pink_city (id, city, country, x, y)
{
	icon.image = "http://www.travelsearch.bugbitten.com/Images/google_pink.png";
	//icon.image = "/Images/gmarker_small/pink-small.png";
	if (pink_city) {
		map.removeOverlay (pink_city);
	}
    var marker = new GMarker (new GLatLng (x, y), {icon: icon, title: city[0] + ', ' + country[0], zIndexProcess: function() { return 6; }});
	pink_city = marker;
	map.addOverlay (marker);
}

function show_brown_city (id, city, country, x, y)
{
	icon.image = "http://www.travelsearch.bugbitten.com/Images/google_brown.png";
	//icon.image = "/Images/gmarker_small/brown-small.png";
	if (x != '-' && y != '-') {
		var marker = new GMarker (new GLatLng (x, y), {icon: icon, title: (city[0].length > 0 ? city[0] + ', ' : '') + country[0]});
		brown_cities[id] = {'marker': marker, 'text': (city[0].length > 0 ? city[0] + ', ' : '') + country[0], 'id': (city[0].length > 0 ? 'ci_' : 'co_') + id, zIndexProcess: function() { return 2; }};
		map.addOverlay (marker);
	} else {
		brown_cities[id] = {'marker': null, 'text': (city[0].length > 0 ? city[0] + ', ' : '') + country[0], 'id': (city[0].length > 0 ? 'ci_' : 'co_') + id};
	}
    return false;
}