var current_industry = 'manufacturing';

var history_changed = function(newLocation, historyData)
{
  alert('history changed');
}

window.onload = function() {
        dhtmlHistory.initialize();
        dhtmlHistory.addListener(history_changed);
};
Event.observe(window, 'load', function() {
        dhtmlHistory.initialize();
        dhtmlHistory.addListener(history_changed);
});

function show_element(industry)
{
  var link_id = 'link_' + industry;
  if (current_industry != industry)
  {
    var info_id = 'info_' + industry;
    var prev_info = 'info_' + current_industry;
    var prev_link = 'link_' + current_industry;

    $(prev_info).style.display = 'none';
    $(info_id).style.display = 'block';
    if (prev_link != 'link_industries_overview')
    {
      $(prev_link).className = '';
    }
    $(link_id).className = 'selected';
    current_industry = industry;
  }
  $(link_id).blur();
}

function select_anchor()
{
  var location_url = window.location.href;
  var hash_index = location_url.lastIndexOf('#');
  if (hash_index != -1)
  {
    hash_index += 1;
    var section = location_url.substring(hash_index);
    section = section.replace(/-/,'_');
    var element_name = 'info_' + section;
    var element = $(element_name);
    if (element != null)
    {
      show_element(section);
    }
  }
}
