//<![CDATA[

function openimage(image, title, width, height, button) {
  var params = 'scrollbars=yes,resizable=yes,dependent=yes';
  if (!width) width = 100;
  if (!height) height = 100;
  params = 'width='+width+',height='+height+','+params;
  var win = window.open('image.html?image_='+image+'&amp;title_='+title+'&amp;button_='+button, 'image', params);
  win.focus();
  return false;
}

var menu_delay = 500;
var menu_timer = 0;
var menu_item  = 0;
var menu_list  = 0;
var menu_name  = '';

function menu_open() {
  menu_cancel();
  menu_close();
  menu_item = $(this).find('a.menu').addClass('open');
  menu_list = $(this).find('div.submenu').css('visibility', 'visible');
  menu_id = $(this).attr('id');
  menu_name = menu_id.replace(/_/, '/');
}

function menu_close() {
  if (menu_list) {
    menu_item.removeClass('open');
  }
  if (menu_list) {
    menu_list.css('visibility', 'hidden');
  }
}

function menu_wait() {
  menu_timer = window.setTimeout(menu_close, menu_delay);
}

function menu_cancel() {
  if (menu_timer) {
    window.clearTimeout(menu_timer);
    menu_timer = null;
  }
}

$(document).ready(function() {
  $('#navigation div.menu').bind('mouseover', menu_open)
  $('#navigation div.menu').bind('mouseout',  menu_wait)
});

document.onclick = menu_close;

var home_delay = 500;
var home_timer = 0;
var home_item  = 0;
var home_list  = 0;
var home_name  = '';

function home_open() {
  home_cancel();
  home_close();
  home_item = $(this).find('a.menu').addClass('open');
  home_list = $(this).find('div.submenu').css('visibility', 'visible');
  home_id = $(this).attr('id');
  home_name = home_id.replace(/_/, '/');
}

function home_close() {
  if (home_list) {
    home_item.removeClass('open');
  }
  if (home_list) {
    home_list.css('visibility', 'hidden');
  }
}

function home_wait() {
  home_timer = window.setTimeout(home_close, home_delay);
}

function home_cancel() {
  if (home_timer) {
    window.clearTimeout(home_timer);
    home_timer = null;
  }
}

$(document).ready(function() {
  $('#portal div.menu').bind('mouseover', home_open)
  $('#portal div.menu').bind('mouseout',  home_wait)
});

document.onclick = home_close;

$(function() {
	$('div.gallery a.lightbox').lightBox({
		imageLoading  : 'javascript/misc/lightbox-loading.gif',
		imageBtnPrev  : 'javascript/misc/lightbox-prev.gif',
		imageBtnNext  : 'javascript/misc/lightbox-next.gif',
		imageBtnClose : 'javascript/misc/lightbox-close.gif',
		imageBlank    : 'javascript/misc/lightbox-blank.gif',
		txtImage      : 'Bild',
		txtOf         : 'von',
		overlayBgColor: '#000000',
		overlayOpacity: '0.8' 
	});
});

//]]>

