function cBlocks (id) {
	this.root = document.getElementById(id);
	this.city = [];	this.net = [];
	this.cities = 0;this.nets = 0;
	this.current_city = -1;this.current_net = -1;

	this.init = function() {
		var i,j,k;
		var ct = /city_(\d+)/;
		var nt = /netw_(\d+)/;
		var rez;
		if (this.root) {
			var elements = this.root.getElementsByTagName('div');
			if (elements) {
				j = 0;k = 0;
				for (i in elements) {
					if (elements[i].className != undefined) {
						if (rez = elements[i].className.match(ct)) {
							this.city[rez[1]] = elements[i];
							//this.city[j] = elements[i];
							//j++;
						} else if (rez = elements[i].className.match(nt)) {
							if (this.net[rez[1]] == undefined) {
								this.net[rez[1]] = [];
							}
							this.net[rez[1]][j] = elements[i];
							j++;
						}
					}
				}
				this.cities = j;
				this.nets = k;
			}
		}
	}
	this.setCity = function (cIndex) {
		var link;
		var link,i,net;
		if (cIndex == 0) {
			this.showAllCity();
			this.current_city = 0;
			link = document.getElementById('clink_0');
			if (link) {
				link.className = 'selected';
			}
		} else {
			if (this.current_city == 0) {
				this.hideAllCity();
			} else {
				if (this.city[this.current_city]) {
					this.city[this.current_city].style.display = 'none';
					link = document.getElementById('clink_' + this.current_city);
					if (link) {
						link.className = '';
					}
				}
			}
			if (this.city[cIndex]) {
				this.city[cIndex].style.display = 'block';
				this.current_city = cIndex;
				link = document.getElementById('clink_' + cIndex);
				if (link) {
					link.className = 'selected';
				}

			}
		}
	}
	this.setNet = function (cIndex) {
		var link,i,net;
		if (cIndex == 0) {
			this.showAllNet();
			this.current_net = 0;
			link = document.getElementById('nlink_0');
			if (link) {
				link.className = 'selected';
			}
		} else {
			if (this.current_net == 0) {
				this.hideAllNet();
			} else {
				if (this.net[this.current_net]) {
					net = this.net[this.current_net];
					for (var i in net) net[i].style.display = 'none';
					link = document.getElementById('nlink_' + this.current_net);
					if (link) {
						link.className = '';
					}
				}
			}
			if (this.net[cIndex]) {
				net = this.net[cIndex];
				for (var i in net) net[i].style.display = 'block';
				this.current_net = cIndex;
				link = document.getElementById('nlink_' + this.current_net);
				if (link) {
					link.className = 'selected';
				}
			}
		}
	}
	this.showAllNet = function () {
		var net;
		for(var i in this.net) {
			net = this.net[i];
			for (var k in net) net[k].style.display = 'block';
		}
	}
	this.hideAllNet = function () {
		var net;
		for(var i in this.net) {
			net = this.net[i];
			for (var k in net) net[k].style.display = 'none';
		}
	}
	this.showAllCity = function () {
		var city;
		for(var i in this.city) {
			this.city[i].style.display = 'block';
		}
	}

	this.hideAllCity = function () {
		var city;
		for(var i in this.city) {
			this.city[i].style.display = 'none';
		}
	}
}