var $j = jQuery.noConflict();

function clear_leftmenu() {
  $('leftmenulist').immediateDescendants().invoke('removeClassName', 'active');
}
function mo_leftmenu(element) {
  clear_leftmenu();
  $(element).addClassName('active');
}
function hide_dropdowns() {
  $('dd1').hide();//('ddhide');
  $('dd2').hide();//('ddhide');
  $('dd3').hide();//('ddhide');
  $('dd4').hide();//('ddhide');
  $('dd5').hide();//('ddhide');
  $('dd6').hide();//('ddhide');
  $('dd7').hide();//('ddhide');
  $('dd8').hide();//('ddhide');
  //$R(1,7).each(function(n){addClassName('dd'+n, 'ddhide')});
}
function show_dropdown(name) {
  hide_dropdowns();
  $(name).show();//('ddhide');
}

function gallery(thing) {
    $$('.buttons a').each(function(f) {
    $(f).removeClassName('active');
    });
  $(thing).addClassName('active');
  $('gallery').update('<img src="'+thing.imgurl+'" />');
  $('info_title').update(thing.descrip_title);
  //$('info_link').update(thing.descrip_link);
  $('info_text').update(thing.descrip_text);
    $$('.buttonbox .title').each(function(f) {
      $(f).removeClassName('active');
    });
  $(thing).up('.buttons').previous('span.title').addClassName('active');
  window.current = thing;
  $('leftmenu').setStyle({
        height: $('body').getHeight()+'px'
      });
}

function gallery_back() {
  back = $(window.current).previous('a');
  if (back == undefined) {
    back = $(window.current).up('.buttonbox').previous('.buttonbox').down('a');
    siblings = $(back).siblings();
    back = $(siblings.pop());
  }
  if (back == undefined) {
    back = window.current;
  }
  gallery(back);
  $('leftmenu').setStyle({
        height: $('body').getHeight()+'px'
      });
}
function gallery_next() {
  next = $(window.current).next('a');
  if (next == undefined) {
    next = $(window.current).up('.buttonbox').next('.buttonbox').down('a');
  }
  if (next == undefined) {
    next = window.current;
  }
  gallery(next);
  $('leftmenu').setStyle({
        height: $('body').getHeight()+'px'
      });
}

$j(document).ready(function() {
    if ($('body')) {
    $('shadowmiddle').setStyle({
      height: ($('body').getHeight() + 70)+'px',
      width: '993px'
    });
    }
    $j("#shadow").mouseover(function() {
      hide_dropdowns();
    });
});


