If you want to perform an action when the control is activated or deactivated, override the onActivate() and/or onDeactivate() methods from the base class:
mobileViewer. MyNewControl = OpenLayers.Class(mobileViewer.Control,
{
initializeControl: function(options)
{
},
onActivate: function()
{
alert(‘Hello World’);
},
onDeactivate: function()
{
alert(‘Gone Fishing’);
}
});