var menu_punkt = null;
var menu = null;
var hideExecute = null;
var submenu_hide_timeout = 0.5;

function drucken() {
	/*$('left').hide();
	$('copyright').hide();
	$('navigation').hide();
	$('gebraucht').hide();
	$('bild').hide();
	$('breadcrumbs').hide();
	$('normalansicht').show();
	$('logo').setStyle({left : '-500px'});
	$('datum').setStyle({'margin-left' : '20px'});
	$('content').setStyle({'padding-left' : '0'});
	$('inhalt').setStyle({'padding-top' : '0', width : '940px', background : 'white'});
	Element.extend(document.body).setStyle({background: 'white'});*/
	window.print();
	return false;
}

function drucken_weg() {
	Element.extend(document.body).setStyle({background: 'url(bilder/background.gif)'});
	$('inhalt').setStyle({'padding-top' : '278px', width : '705px', background : '#EEF2F5'});
	$('content').setStyle({'padding-left' : '190px'});
	$('datum').setStyle({'margin-left' : '190px'});
	$('logo').setStyle({left : '-148px'});
	$('normalansicht').hide();
	$('left').show();
	$('copyright').show();
	$('navigation').show();
	$('gebraucht').show();
	$('bild').show();
	$('breadcrumbs').show();
	return false;
}

function checkSuche() {
	if (document.suchform.suchText.value == "Suchbegriff") {
		document.suchform.suchText.value = "";
		document.suchform.suchText.style.color = "black";
	}
}

function menu_start(){
	buildAll();
	$('menu').descendants().each(function(top) {
	 if((top.hasClassName("popup_menu")) & ("A" == top.tagName)){
	    if(Element.visible(top)) {
	    	top.onmouseover = link_in;
	    }
	 }
	});
}

function link_in(){
	hideAll();
	menu_punkt = Element.extend(this);
	aparent = menu_punkt.up();
	aparent.descendants().each(function(top) {
	 if((top.hasClassName("popup_hover_js")) & ("UL" == top.tagName)){
		menu = top;
		menu.show();
    	menu.onmouseover = menu_in;
		menu.onmouseout = null;
		menu_punkt.onmouseout = link_out;
	 }
	});	
	return false;
}

function link_out() {
	menu_punkt.onmouseout = null;
	if (menu.onmouseout == null) submenu_tryhide();
}

function menu_out() {
	menu.onmouseout = null;
	if (menu_punkt.onmouseout == null) submenu_tryhide();
}

function menu_in() {
	menu.onmouseout = menu_out;
}

function submenu_tryhide() {
	if (hideExecute) hideExecute.stop();
	hideExecute = new PeriodicalExecuter(submenu_hide, submenu_hide_timeout);
}

function submenu_hide() {
	if (hideExecute) hideExecute.stop();
	if (!menu.onmouseout && !menu_punkt.onmouseout) {
		menu.onmouseover = null;
		hideAll();
	}
}

function hideAll() {
	$('menu').descendants().each(function(top) {
	 if((top.hasClassName("popup_hover_js")) & ("UL" == top.tagName)){
	    if(Element.visible(top)) {
	    	top.hide();
	    }
	 }
	});
}

function buildAll() {
	$('menu').descendants().each(function(top) {
	 if((top.hasClassName("popup_hover")) & ("UL" == top.tagName)){
    	top.hide();
		top.addClassName("popup_hover_js");
		top.removeClassName("popup_hover");
	 }
	});
}

script_loaded = true;


