var localized = {
	initialize: function() {
    $$('.localizable').each(function(localizable) {
      var activeControls = localizable.down('.item.active .controls');
      var hideLink       = activeControls.down('.hide_other');
      var showLink       = activeControls.down('.show_other');
      var bindings       = {localizable: localizable, showLink: showLink, hideLink: hideLink};
      
      showLink.observe('click', function() {
        this.showLink.hide();
        this.hideLink.show();
        this.localizable.select('.item').invoke('show');
      }.bind(bindings));
      
      hideLink.observe('click', function() {
        this.showLink.show();
        this.hideLink.hide();
        this.localizable.select('.item:not(.active)').invoke('hide');
      }.bind(bindings));
    });
	}
}

Event.addBehavior({
  '.two_levels_tab:mouseover': function() {
		var c = this.select('.children');
		if(c) {
			this.select("a").first().addClassName("active");
			c.invoke("show");
		}
  },

	'.two_levels_tab:mouseout': function() {
		var c = this.select(".children");
		if(c) {
			this.select("a").first().removeClassName("active");
			c.invoke("hide");
		}
	}
});
