

  
  function showCategory(id_category)
  {
    if(old_id_category)
    {
      old_category_link = 'parent_cat_link_' + old_id_category;
      old_category_div = 'child_cat_' + old_id_category;
      $(old_category_link).removeClassName('active_cat_parent');
      $(old_category_div).hide();
    }
    
    //remove content to move to another category
    //if post
    if($('posts'))
    {
      $('posts').remove();
      $('post_details').remove();
      $('post_container_up').remove();
      $('post_container').remove();
      $('post_container_down').remove();

    }
    if($('page'))
    {
      $('page_decoration').remove();
      $('page').remove();
    }
    
    new_category_link = 'parent_cat_link_' + id_category;
    new_category_div = 'child_cat_' + id_category;
    $(new_category_link).addClassName('active_cat_parent');
    $(new_category_div).show();
    old_id_category = id_category;
  }
  


  function onLoadBody()
  {
    var active_link = $$('a.enlace_activo_cambiar_elemento');
    var inactive_links = $$('a.enlace_desactivo_cambiar_elemento');
    
    
    var links = active_link.concat(inactive_links)

    for (var i = 0; i < links.length; i++) { 
        links[i].onclick = function() {
          
            new_element = this.getAttribute("href", 2);
            
            //chagen visibility
            active_elements = $$('.elemento_activo');
            new_active_elements = $$('#' + new_element)
            
            
            for (var i = 0; i < active_elements.length; i++) { 
              active_elements[i].removeClassName('elemento_activo');
              active_elements[i].addClassName('elemento_inactivo');
              active_elements[i].addClassName('none');
            }

            for (var i = 0; i < new_active_elements.length; i++) { 
              new_active_elements[i].addClassName('elemento_activo');
              new_active_elements[i].removeClassName('elemento_inactivo');
              new_active_elements[i].removeClassName('none');
            }
            
            //change style to links
            old_links_to_actives = $$('.enlace_activo_cambiar_elemento')
         
            for (var i = 0; i < old_links_to_actives.length; i++) {
              old_links_to_actives[i].removeClassName('enlace_activo_cambiar_elemento');
              old_links_to_actives[i].addClassName('enlace_desactivo_cambiar_elemento');
            }
            
            this.removeClassName('enlace_desactivo_cambiar_elemento')
            this.addClassName('enlace_activo_cambiar_elemento');

            // by returning false normal link behaviour is skipped 
            return false; 
        } 
    }
    
    var must_have_none = $$('.elemento_inactivo');
    for (var i = 0; i < must_have_none.length; i++) { 
      must_have_none[i].addClassName('none');
    }
    
  }

