// this function [un]decorates the links that toggle the bell tops
function bellsTopAnchors(clicked, parent, anchor_class) {
    // extend the clicked anchor
    Element.extend(clicked);
    // cycle through all the anchors
    $(parent).getElementsBySelector('.js_bellsTab').each(function(e) {
        if (e == clicked) e.addClassName(anchor_class);
        else {
            e.removeClassName('hpTopsdown_har');
            e.removeClassName('hpTopsdown_pol');
            e.removeClassName('hpTopsdown_jud');
            e.removeClassName('hpTopsdown_bog');
        }
    });
}

// this function toggles the bell tops on the homepage
function bellsTopToggle(clicked, anchor_class, id_to_show, parent) {
    // decorate anchors
    bellsTopAnchors(clicked, parent, anchor_class);
    // prepare common params
    var params = {
        'selector': '.js_bellsTopBox',
        'parent': $(parent),
        'hardStyle': true
    };
    // retrieve target element
    var es = $(id_to_show);
    // decide what to do based on its state
    if (es.visible()) return;
    else params.closeAllExcept = es;
    // toggle elements
    basculate_elements(params);
}

// change the news entry in the "New" box
function showNew(from, which, prefix) {
    Element.extend(from);
    from.adjacent('a.newttl').each(function(e){
        e.removeClassName('newttl_sel');
    });
    from.addClassName('newttl_sel');
    for (var i = 1; i <= 4; i++) {
        var name = prefix + i;
        if (which == i) {
            $(name).show();
        }
        else {
            $(name).hide();
        }
    }
    return false;
}

// toggle promo box (personal pages / fanclubs)
function toggleBox(hide_id, show_id, tabs_id, bkgnd, no)
{
   if(document.getElementById(hide_id) != null) {
       document.getElementById(hide_id).style.display = 'none';       
   }	       
   
   if(document.getElementById(show_id) != null) {
       document.getElementById(show_id).style.display = 'block';       
   }

   if(document.getElementById(tabs_id) != null) {
       document.getElementById(tabs_id).style.background = 'url(' + HTTPTEMPLATE + 'homepage/imgs/' + bkgnd + ') repeat scroll 0 ' + no + 'px';
   }  
}