/* var navigator_tabs = new navigatorTabs( 'navpanel', '_toggler', '_toggler_over', 'search_feedback_container', '_absolute', 'tab_block', 'hidden_element'); */ var navigatorTabs = Class.create(); navigatorTabs.prototype = { initialize: function( toggler_container_id, toggler_over_class, block_container_id, block_container_class, block_class, hidden_block_class, open_toggler_class ) { this.open_toggler_class = open_toggler_class; this.toggler_container = $(toggler_container_id); this.toggler = this.toggler_container; //this.toggler_container.getElementsByClassName(toggler_class); this.container = $(block_container_id); this.blocks = this.container; //this.container.getElementsByClassName(block_class); /* if( this.toggler.length != this.blocks.length ) { return false; } */ this.toggler_over_class = toggler_over_class; this.hidden_block_class = hidden_block_class; this.container.addClassName( block_container_class); this.container.addClassName( this.hidden_block_class ); this.blocks.addClassName( this.hidden_block_class ); // this.blocks[1].addClassName( this.hidden_block_class ); this.observeToggler(this.toggler, this.blocks ); // this.observeToggler(this.toggler[1], this.blocks[0], this.blocks[1]); return true; }, observeToggler: function(toggler_obj, block ) { Event.observe ( toggler_obj, 'click', this.switchBlocks.bind(this, block, toggler_obj ) ); Event.observe ( toggler_obj, 'mouseover', this.toggleClass.bind( this, toggler_obj ) ); Event.observe ( toggler_obj, 'mouseout', this.toggleClass.bind( this, toggler_obj ) ); return true; }, toggleClass: function( toggler_obj ) { if( toggler_obj.hasClassName(this.toggler_over_class) ) { toggler_obj.removeClassName(this.toggler_over_class); } else { toggler_obj.addClassName(this.toggler_over_class); } return true; }, switchBlocks: function( block, toggler ) { if( !block.hasClassName(this.hidden_block_class) ) { block.addClassName(this.hidden_block_class); toggler.removeClassName( this.open_toggler_class ); this.container.addClassName(this.hidden_block_class); } else { block.removeClassName( this.hidden_block_class ); toggler.addClassName( this.open_toggler_class ); this.container.removeClassName( this.hidden_block_class ); } return true; } };