var controller_c = function()
{
	this.map_o = new Object();
	this.network_o = new Object();
	this.list_o = new Object();
	this.request_o = new Object();
	this.country_o = new Object();

	this.getIsCompatible = function()
	{
		return GBrowserIsCompatible();
	};

	this.setDefault = function()
	{
		var info_o = this.map_o.getMap().getInfoWindow();
			info_o.hide();

		this.setZoomByPosition(49.439557, 10.019531, 4);
	};

	this.setMapById = function(id_s)
	{
		this.map_o = new map_c();
		this.map_o.setById(id_s);

		this.setDefault();

		this.network_o = new network_c();
		this.network_o.setMap(this.map_o);
	};

	this.setListById = function(id_s)
	{
		this.list_o = new list_c();
		this.list_o.setById(id_s);
		this.list_o.setMap(this.map_o);
		this.list_o.setNetwork(this.network_o);
	};

	this.setRequest = function(request_o)
	{
		this.request_o = request_o;
	};

	this.setLocationByArray = function(location_a)
	{
		var info_o = this.map_o.getMap().getInfoWindow();
			info_o.hide();

		this.network_o.setLocationClear();

		for (var i_i = 0; i_i < location_a.length; i_i++)
		{
			var location_o = new location_c();
				location_o.setType(location_a[i_i].type);
				location_o.setLatitude(location_a[i_i].latitude);
				location_o.setLongitude(location_a[i_i].longitude);
				location_o.setInformation(location_a[i_i].information);

			var index_i = this.network_o.setLocation(location_o);
		}

		this.list_o.setList();
	};

	this.setZoomByAddress = function(address_s, zoom_i)
	{
		this.map_o.setCenterByAddress(address_s, zoom_i);
	};

	this.setZoomByPosition = function(latitude_i, longitude_i, zoom_i)
	{
		this.map_o.setCenterByPosition(latitude_i, longitude_i, zoom_i);
	};

	this.setLocationInfo = function(index_i)
	{
		this.network_o.setLocationInfo(index_i);
	};

	this.setLocationByRequestType = function(type_s)
	{
		var host_o = this;

		this.request_o.setOnRequestStateChange = function(state_i, status_i, content_s)
		{
			if (state_i == 4)
			{
				var json_a = this.getObjectByJson(content_s);

				if (json_a)
					host_o.setLocationByArray(json_a);
			}
		};

		this.request_o.setRequestByType(type_s);

		this.setZoomByAddress(this.country_o.address_s, this.country_o.zoom_i);
	};

	this.setCountryRestriction = function(json_s)
	{
		this.country_o = eval('(' + json_s + ')');

		if (typeof this.country_o.position_o != 'undefined')
			this.setZoomByPosition(this.country_o.position_o.latitude_i, this.country_o.position_o.longitude_i, this.country_o.zoom_i);

		else
			this.setZoomByAddress(this.country_o.address_s, this.country_o.zoom_i);

		this.request_o.setCountryById(this.country_o.id_i);
		this.network_o.setLocationClear();

		var container_o = document.getElementById('selection_container_td');

		if (this.country_o.id_i)
		{
			container_o.style.display = '';

			var input_o = document.selection_form.point_type;

			for (var i_i = 0; i_i < input_o.length; i_i++)
				input_o[i_i].checked = false;

			var input_o = document.getElementById('post_code');
				input_o.value = 'City, ' + this.country_o.address_s;
		}

		else container_o.style.display = 'none';
	};
};