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

function checkNewsletterAnmeldung() {
	if (document.forms.newsletter_form.newsletter_anmelden.value.length > 3) {
		document.forms.newsletter_form.submit();
	}
}

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");
	 }
	});
}

<!-- image preload for language selection & menu + scroller-script -->

<!-- lang_en_on      = new Image();-->
<!-- lang_en_on.src  = "bilder/lang_en_on.gif";-->
<!-- lang_en_off     = new Image();-->
<!-- lang_en_off.src = "bilder/lang_en.gif";-->
<!-- lang_de_on      = new Image();-->
<!-- lang_de_on.src  = "bilder/lang_de_on.gif";-->
<!-- lang_de_off     = new Image();-->
<!-- lang_de_off.src = "bilder/lang_de.gif"; -->
function farbe_name(txt) {
    elm = document.getElementById('farbcontainer');
    elm.innerHTML = txt;
}

function mouseoverOverviewProdukt(divId){
    $(divId).setStyle({
        backgroundColor: '#C9E9F8'
        });
}

function mouseoutOverviewProdukt(divId){
    $(divId).setStyle({
        backgroundColor: '#FFFFFF'
        });
}

//blendet den naechsten Text ein
function prevText(){
    if(cur_text > 0){
        var prev_text = cur_text*1-1;
        $('text_'+cur_text).hide();
        $('text_'+prev_text).show();

        $('subpagenav_next').show();
        if(prev_text <= 0){$('subpagenav_prev').hide();cur_text = 0;}
        else{$('subpagenav_prev').show();}
        cur_text = prev_text;
    }
}

//blendet den vorhergehenden Text ein
function nextText(){
    if(cur_text < max_text){
        var next_text = cur_text*1+1;
        $('text_'+cur_text).hide();
        $('text_'+next_text).show();

        $('subpagenav_prev').show();
        if(next_text >= max_text){$('subpagenav_next').hide();cur_text = max_text;}
        else{$('subpagenav_next').show();}
        cur_text = next_text;
    }
}


function spracheOff(bildpfad){
    $('flaggebild').src = bildpfad;
}

function spracheOn(bildpfad){
    $('flaggebild').src = bildpfad;
}

function showContact(partner_inh_id){
    var partner_to_block = 'contact_' + partner_inh_id;
    if(blocked_partner != ''){
        $(blocked_partner).hide();
    }
    $(partner_to_block).show();
    blocked_partner = partner_to_block;
}

script_loaded = true;



