function toggle_menu(menu_id) {

  if (Prototype.Browser.IE)
    $(menu_id).visible() ? Effect.Fade(menu_id, {duration: .4, queue: 'end'}) : new Effect.Appear(menu_id, {duration: .4, queue: 'end'})
  else
    $(menu_id).visible() ? Effect.BlindUp(menu_id, {duration: .2, queue: 'end'}) : new Effect.BlindDown(menu_id, {duration: .2, queue: 'end'})
  
}

function show_image(image_link) {
  
  $$('#Thumbnails .active').each(function(active_link) {
    $(active_link).removeClassName('active');
  })
  $(image_link).addClassName('active');
  
  var image_el = $$('#MainImage img')[0];
  var caption = $('ImageCaption');
  
  new Effect.Fade(caption, {queue: 'end', duration: .3})
  new Effect.Opacity(image_el, {from: 1, to: 0, queue: 'end', duration: .3, afterFinish: function() {
    
    var new_image = new Image();
    new_image.src = image_link.href.replace('_thumbnail', '');
    new_image.onload = function() {
      image_el.src = new_image.src;
      new Effect.Opacity(image_el, {from: 0, to: 1, queue: 'end', duration: .3});
      new Effect.ScrollTo(image_el);
      caption.innerHTML = image_link.getAttribute('title');
      new Effect.Appear(caption, {queue: 'end', duration: .2})
    }    
    
    location.hash = image_link.href.slice(image_link.href.lastIndexOf('/') + 1).replace('_thumbnail.jpg', '');
    
  }});
    
  return false
  
}

window.onload = function() {
  if (!location.hash) return
  $$('#Thumbnails a').each(function(thumbnail) {
    if (thumbnail.href.indexOf(location.hash.replace('#', '')) != -1) thumbnail.onclick();
  });
}

// if(Prototype.Browser.Gecko) $$('html')[0].style.width = '773px'