function MProgressControl(MOptions) {
	MOptions = MOptions ? MOptions : {};
	this.width = MOptions.width ? MOptions.width : 400;
	this.position = MOptions.position ? MOptions.position : null;

	this.cellsHigh = 1;
	this.cellsWide = 9;
	this.visible = false;

}

MProgressControl.prototype = new GControl(true,false);

MProgressControl.prototype.initialize = function(map) {
	var that = this;
	this.map = map;
	this.cells = Array();

	this.container = document.createElement('div');

	this.container.style.display = 'none';
	this.container.style.width = this.width + 'px';

	this.innerDiv = document.createElement('div');
	this.container.appendChild(this.innerDiv);

	this.labelDiv = document.createElement('div');
	this.innerDiv.appendChild(this.labelDiv);
	this.labelDiv.innerHTML = 'Loading ...';
	this.labelDiv.style.marginBottom = '5px';
	this.labelDiv.style.font = 'bold 16px verdana';

	// Set container style
	this.container.style.width = this.width + 'px';
	this.container.style.textAlign = 'center';
	this.container.style.padding = '10px';
	this.container.style.border = '5px solid #290B8B';
	this.container.style.background = 'silver';
	this.container.style.color = '#290B8B';
	this.container.style.zIndex = '1';
	this.container.style.filter = "alpha(opacity=70)";
	this.container.style.opacity = '0.7';


	
	// Calculate position	
	if (!this.position) {
		var mapContainer = this.map.getContainer();
		var x = (mapContainer.clientWidth / 2) - (this.width / 2);
		var y = 100;
		this.position = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x,y));
	}
	
// -------------------------------------

	var oTable = document.createElement('table');
	oTable.setAttribute('cellSpacing','1');
	oTable.setAttribute('cellPadding','0');
	oTable.setAttribute('width','100%');
	var oTbody = document.createElement('tbody');
	oTable.appendChild(oTbody);

	for (var r = 0 ; r < this.cellsHigh ; r++ ) {
		var oRow = document.createElement('tr');
		oTbody.appendChild(oRow);

		for (var c = 0 ; c < this.cellsWide ; c++ ) {
			var oCell = document.createElement('td');
			this.setStyle(oCell);
			oRow.appendChild(oCell);
			this.cells.push(oCell);
			oCell.innerHTML = '&nbsp;'
		}
	}

	this.innerDiv.appendChild(oTable);



this.animate = function() {

	var maxRGB = 255;
	var minRGB = 0;
	
	var cellIx = this.getRandomInt(0, this.cells.length-1);
	var oLCell = this.cells[cellIx];
	oLCell.style.background = 'RGB('+
			this.getRandomInt(minRGB, maxRGB) + ',' +
			this.getRandomInt(minRGB, maxRGB) + ',' + 
			this.getRandomInt(minRGB, maxRGB) + ')';

	if (this.visible){
		window.setTimeout(function(){that.animate()},50);
	}
	else {
		this.hide();
	}
}


	this.map.getContainer().appendChild(this.container);
	return this.container;
}



MProgressControl.prototype.getRandomInt = function(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}



MProgressControl.prototype.setStyle = function(obj) {
	obj.style.width = '50px';
	obj.style.border = '2px solid black';
	obj.style.padding = '2px';

}

MProgressControl.prototype.getDefaultPosition = function() {
	return this.position;
}

MProgressControl.prototype.setText1 = function(text) {
	this.innerDiv.innerHTML = text;
	this.show();
}

MProgressControl.prototype.show = function() {
	this.container.style.display = '';
	this.visible = true;
	this.animate();
}

MProgressControl.prototype.hide = function() {
	this.container.style.display = 'none';
	this.visible = false;
}

