document.observe('dom:loaded', initId);

var globalId = '';
var globalBl = '';

/*
 *  inits of the standart id and country
 */
function initId(){
    /* init standart id and bl */
    globalId = $('dd_head_id').innerHTML;
    globalBl = $('dd_head_t').innerHTML;
    
    $('visible_container').observe('mouseout', setBack);
}

/*
 *  sets DropDown and Map back to default
 */
function setBack(){
    $('dd_head_t').innerHTML = globalBl;
    if(globalId != 0)
        $('ovl_'+globalId).show();
}

/*
 *  shows/hides th DropDown Box with countries
 */
function show_hide(){
    if($('ansp_container').style.display == 'none')
    {
        $('ansp_container').show();
        $('dd_head_arrow').setStyle({background: 'url(/images/bew_arrow_up.png)'});
    }
    else
    {
        $('ansp_container').hide();
        $('dd_head_arrow').setStyle({background: 'url(/images/bew_arrow_down.png)'});
    }
}

/*
 *  shows the countryOverlay which is set by id
 *
 *  @param  string  id  ID of the div-container which holds
 *                      the countryOverly
 */
function showBl(id){
    /* hide all countries */
    var countryOverlayArray = document.getElementsByClassName('bl_overlay');
    for(var x=0; x<countryOverlayArray.length; x++){
        countryOverlayArray[x].hide();
    }
    /* making the active country-overlay visible */
    $(id).show();
    /* changing country-description in rollOut-head  */
    $('dd_head_t').innerHTML = $('dd_'+id.substr(4)).childElements()[0].childElements()[0].innerHTML;
}

/*
 *  hides the countryOverlay which ist set by id
 *
 *  @param  string  id  ID of the div-container which holds
 *                      the countryOverlay
 */
function hideBl(id){
    $(id).hide();
}
