var xMenu = Class.create(); xMenu.prototype = { initialize: function(){ this.exceptions = new Array('/common/','/faq','/podbor'); this.parse_level(); this.current_level = this.page_level; this.set_container(this.anc_name,this.current_level); this.uns = -1; }, parse_level: function(){ var loc = document.location.toString().split('~'); this.loc = loc[0]; this.levels = this.loc.split('/'); addr = []; this.levels.shift(); this.levels.shift(); this.levels.shift(); if (this.levels[this.levels.length-1]=='') this.levels.pop(); if (this.levels.length<=1) { this.page_level = 1; this.anc_level = 0; this.anc_name = "root"; } else { this.page_level = this.levels.length; this.anc_level = this.page_level - 1; this.anc_name = this.levels[this.anc_level-1]; } }, mnext: function(elt){ var d = elt.getAttribute('rel'); elt.href="javascript:void(0)"; if (this.current_level==1){this.levels=new Array(); this.levels.push(d);} else {this.levels.push(d);} var new_level = this.current_level+1; var str = '[x="'+d+'"]'; d = $('section1').getElementsBySelector(str); $('section'+new_level).innerHTML = d[0].innerHTML; mglider.next(); this.current_level++; this.canc_name = d[0].getAttribute('x'); }, mprev: function(elt){ if (this.current_level<3) {mglider.previous();} else{ this.levels.pop(); var lev = this.levels[this.current_level-3]; var str = '[x="'+lev+'"]'; var elts = $('section1').getElementsBySelector(str); var level = this.current_level - 1; $('section'+level).innerHTML = elts[0].innerHTML; setTimeout("mglider.previous()",300); } this.current_level-=1; }, set_container: function(anc_name,anc_level){ if (anc_level>1){ var level = anc_level; var str = '[x="'+anc_name+'"]'; elts = $('section1').getElementsBySelector(str); if (elts.length>0){ $('section'+level).innerHTML = elts[0].innerHTML; } else {this.current_level=1; this.anc_level=0} } element = 'section'+this.current_level; container = $('scroller'); Position.prepare(); var containerOffset = Position.cumulativeOffset(container), elementOffset = Position.cumulativeOffset($(element)); this.scrolling = new Effect.SmoothScroll(container,{duration:0, x:(elementOffset[0]-containerOffset[0]), y:(elementOffset[1]-containerOffset[1])}); } }