var toclose=new Array();
var interval;             
var interval_timer=3000;
interval = window.setInterval("menu_ausblenden()", interval_timer);

//----Durchsuche Array nach einem Spezifischen Wert 
function in_array(wert,array){
    var check;
    for(var i=0;i<=array.length;i++){
        if(wert == array[i]){
            check=1;
            break;
        }
    }
    if(check==1){
        return true;
    }else{
        return false;
    }
}
//----Löschen eines Spezifischen Wert aus dem Array 
function del_in_array(wert,array){
    for(var i=0;i<=array.length;i++){
        if(wert == array[i]){
             array.splice(i,1);
        }
    }
}

function menu_einblenden(id,art) {
    if(!art){var art='inline';}
    menu_ausblenden();
    
    if(document.getElementById(id)){
        document.getElementById(id).style.MozOpacity = 1;
        document.getElementById(id).style.filter = "alpha(opacity=100)";
        document.getElementById(id).style.display=art;
    }
    
    del_in_array(id,toclose);
}
function menu_timer_ausblenden(id){
    if(!in_array(id,toclose)){
        toclose.push(id);
    }
}

var trans=100;
var timer;
function blend_out_slowly(id){
    trans = trans-5;
    document.getElementById(id).style.filter = "alpha(opacity="+trans+")";
    document.getElementById(id).style.MozOpacity = (trans/100);
    if(trans!=0){
        timer = window.setTimeout(function(){blend_out_slowly(id);},20);
    }else{
        window.clearTimeout(timer);
        trans = 100;
        document.getElementById(id).style.display="none";
        document.getElementById(id).style.filter = "alpha(opacity="+trans+")";
        document.getElementById(id).style.MozOpacity = (trans/100);
    }
}


function menu_ausblenden(){
    for(var i=0;i<toclose.length;i++){
        if(document.getElementById(toclose[i])){
            //blend_out_slowly(toclose[i]);
            document.getElementById(toclose[i]).style.display="none";
        }
    }
}
