
function setTool(toolName, elements) {
 
  var i = 0;
 
  if (toolName=='SelectSquare' && document.getElementsByName('SearchFor')[0].value=='') 
  {
    //if the user has clicked SelectSquare (Drag-a-box) then have they specified Sites or Surveys?
    var warning = 'Are you searching for Sites or Surveys?\n\n Please choose \'Search for ...\' from the \'What do you want to do...?\' list on the left.'
    alert(warning);
    return false;
  }
  
  document.getElementsByName('MapTool')[0].value=toolName;

  //make the selected tool red border style
  for (i = 0; i < elements.length; i++)
  {
    if (elements[i].id.indexOf(toolName) == -1)
    {
        elements[i].style.border = "solid white 1px";
    }
    else
    {
        elements[i].style.border = "solid red 1px";      
    }
    
  }
  
  
  

}
