function MHSismosSourceMapControl() {
}

MHSismosSourceMapControl.prototype = new GControl();

MHSismosSourceMapControl.prototype.initialize = function(map) {
	var container  = document.createElement("div");
	
	var auto_ico   = this.createIMG_('/images/radial_sign_16x16_blue.png', 'ImgAutomatico');
	var manu_ico   = this.createIMG_('/images/radial_sign_16x16.png', 'ImgCorregido');
	var auto_check = this.createCheckBox_('Automatico', 'AutomaticoCheckbox', true);
	var manu_check = this.createCheckBox_('Corregido', 'CorregidoCheckbox', true);

	container.appendChild(document.createTextNode("Categoria"));
	this.setContainerStyle_(container);

	var sourceListDiv = document.createElement("div");
	this.setButtonStyle_(sourceListDiv);
	container.appendChild(sourceListDiv);

        sourceListDiv.appendChild(document.createTextNode("Sismo"));
	sourceListDiv.appendChild(manu_ico);
	sourceListDiv.appendChild(manu_check);

	sourceListDiv.appendChild(document.createTextNode("5.0 y Mas"));
	sourceListDiv.appendChild(auto_ico);
	sourceListDiv.appendChild(auto_check);
      
	GEvent.addDomListener(auto_check, "click", function() {
		toggleGroup('Automatico');
	});
        
	GEvent.addDomListener(manu_check, "click", function() {
		toggleGroup('Corregido');
	});

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

MHSismosSourceMapControl.prototype.getDefaultPosition = function() {
	return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7,27));
}

MHSismosSourceMapControl.prototype.setButtonStyle_ = function(button) {
	button.style.textDecoration  = "none";
	button.style.color           = "#000000";
	button.style.backgroundColor = "white";
	button.style.font            = "x-small bold Arial";
	button.style.borderTop       = "1px solid black";
	button.style.padding         = "0px";
	button.style.marginBottom    = "0px";
	button.style.textAlign       = "left";
	button.style.verticalAlign   = "middle";
	button.style.width           = "100%";
}

MHSismosSourceMapControl.prototype.setContainerStyle_ = function(button) {
        button.style.textDecoration  = "none";
        button.style.color           = "#000000";
        button.style.backgroundColor = "white";
        button.style.font            = "x-small bold Arial";
        button.style.border          = "1px solid black";
        button.style.padding         = "2px";
        button.style.marginBottom    = "0";
        button.style.textAlign       = "left";
        button.style.width           = "194px";
}

MHSismosSourceMapControl.prototype.createCheckBox_ = function(name, id, isChecked) {
	var elem = document.createElement("input");
	elem.type           = "checkbox";
	elem.name           = name;
	elem.id             = id;
	elem.defaultChecked = isChecked;
	elem.verticalAlign  = "middle";

	return elem;
}

MHSismosSourceMapControl.prototype.createIMG_ = function(src, id) {
	var elem = document.createElement("img");
	elem.src = src;
	elem.id  = id;
	return elem;
}
