
/////////////////////////////////////////////////////////////////////////////


function DALoadingControl(MOptions) {
	MOptions = MOptions ? MOptions : {};
	this.parent = MOptions.container ? MOptions.container : null;
	this.background = MOptions.background ? MOptions.background : '#EEEEEE';
	this.foreground = MOptions.foreground ? MOptions.foreground : '#000000';
	this.position = MOptions.position ? MOptions.position : new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(8, 30));
	this.visible = MOptions.visible ? MOptions.visible : false;
}

DALoadingControl.prototype = new GControl();

DALoadingControl.prototype.initialize = function(map) {
	this.map = map;
	this.loading = 0;

	this.container = document.createElement('div');
	var oTable = document.createElement('table');
	oTable.setAttribute('cellSpacing','0');
	oTable.style.border = '1px solid black';
	oTable.style.width = '200px';


	this.container.appendChild(oTable);
	var oRow = document.createElement('tr');
	oTable.appendChild(oRow);

//-------------------------	

	var oCell = document.createElement('td');
	oCell.innerHTML = '<img src="/resources/bigrotation2.gif">';
	this.setStyle2(oCell);
	oRow.appendChild(oCell);

	var oCell = document.createElement('td');
	oCell.innerHTML = 'Please wait while the properties are found.';
	this.setStyle2(oCell);
	oRow.appendChild(oCell);

//-------------------------	

	if (this.parent) {
		this.parent.appendChild(container);
	}
	else {
		this.map.getContainer().appendChild(this.container);
	}
	if (!this.visible) {
		this.container.style.display = 'none';
	}
	this.container.innerHTML+="&nbsp;";  // This line for IE. Without it, it will not render the control

	return this.container;
}

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

DALoadingControl.prototype.show = function() {
	this.loading++;
	this.container.style.display = '';
}

DALoadingControl.prototype.hide = function() {
	this.loading--;
	if (this.loading <= 0) {
		this.container.style.display = 'none';
		this.loading = 0;
	}
}

DALoadingControl.prototype.isVisible = function() {
	return this.mapClick;
}



////////////////////////////

DALoadingControl.prototype.setStyle2 = function(obj) {
	obj.style.padding = '2px';
	obj.style.textAlign = 'center';
	obj.style.color = this.foreground;
	obj.style.backgroundColor = this.background;
	obj.style.font = 'bold 12px Arial';
}

//////////// END DALoadingControl /////////////////

