var SearchPar = new Class({ initialize: function(el) { this.el = $(el); if (!this.el) return false; this.el.getElement('ul').slide('hide'); // make element visible, if it was hidden this.el.getElement('ul').style.display = 'block'; this.fx = new Fx.Slide(this.el.getElement('ul'), {duration: '250'}); this.el./* bug fixed - getElement('div'). */addEvent('click', this.show.bind(this)); this.el.getElements('li').addEvents({ /* 'mouseenter': this.enterMenu, 'mouseleave': this.leaveMenu, BUG — undefined functions */ 'click': this.setFilter }); }, show: function() { this.fx.cancel(); this.fx.toggle(); return false; }, hide: function() { this.fx.cancel(); this.fx.slideOut(); return false; }, setFilter: function() { this.getParent('div').getParent().getElement('div p').set('text', this.get('text')); this.getParent('ul').set('slide', {duration: 250}); this.getParent('ul').slide('out'); } }); var inputText = new Class({ initialize: function(el) { this.el = $(el); if (!this.el) return false; this.el.val = this.el.get('value'); this.el.addEvents({ 'click': this.hideText.bind(this), 'blur': this.showText.bind(this) }); }, hideText: function() { if (this.el.get('value') == this.el.val) this.el.set('value', ''); }, showText: function() { if (this.el.get('value') == '') this.el.set('value', this.el.val); } }); var mapSlide = new Class({ initialize: function(map, cat) { this.el = $(map); if (!this.el) { return false; } this.map = this.el.getParent('#map'); this.cat = $(cat); if (!this.cat) return false; this.mapSlide = new Fx.Morph(this.map, { duration: 500, fps: 200 }); this.butSlide = new Fx.Morph(this.el.getParent()),{duration: 500}; this.catMorph = new Fx.Morph(this.cat); this.scrollMorph = new Fx.Morph(this.cat.getElement('.vScrollbar')); this.mapPos = true; this.el.addEvent('click', this.slideMap.bind(this)); }, slideMap: function() { if (this.mapPos) { this.catMorph.start({ opacity: 0 }).chain(function() { this.mapSlide.start({ 'margin-left': 15 }).chain(function() { this.el.set('class', 'map-left'); }.bind(this)); }.bind(this)); if (this.cat.getElement('.vScrollbar')) { this.cat.getElement('.vScrollbar').set('opacity', 0); } ; this.butSlide.start({ 'margin-left': 0 }); this.mapPos = false; } else { this.mapSlide.start({ 'margin-left': 372 }).chain(function() { this.catMorph.start({ opacity: 1 }); this.butSlide.start({ 'margin-left': -25 }).chain(function() { this.el.set('class', 'map-right'); }.bind(this)); }.bind(this)); this.mapPos = true; } return false; } }); var op_m = ''; var menuSlide = new Class({ Implements: [Options], options: { slidePos: false, scroller: null }, initialize: function(menu, options) { this.setOptions(options); this.menu = $(menu); if (!this.menu) return false; this.menuHead = this.menu.getElements('strong'); this.LevelTwo = this.menu.getElements('ul'); openTab = 0; //Количество открытых вкладок меню this.LevelTwo.set('slide', {duration: 800, transition: 'bounce:out'}); if (!this.options.slidePos) { this.LevelTwo.slide('hide'); } else { this.LevelTwo.slide('show'); this.menuHead.getParent('.first-level-cat').set('class', 'first-level-cat active-cat'); } this.menuHead.addEvent('click', this.toggleMenu); var cnm = this.menuHead.getParent('.first-level-open'); for (nm in cnm) { if (cnm[nm] != null && typeof cnm[nm] == 'object' && nm != '$family') { cnm[nm].getElement('strong').fireEvent('click'); } } }, toggleMenu: function() { if (op_m != '' && op_m != this.id && openTab != 0) { openTab = 1; $('razvcat').fireEvent('click'); $('razvcat').fireEvent('click'); } op_m = this.id; this.getParent('li').getElement('ul').slide('toggle'); mTop = this.getParent('li').getElement('ul').getStyle('margin-top').toInt(); if (mTop < 0) { this.getParent('.first-level-cat').set('class', 'first-level-cat active-cat') openTab++; ; } else { this.getParent('.first-level-cat').set('class', 'first-level-cat'); openTab--; } }, showAll: function() { this.LevelTwo.slide('in'); this.menuHead.getParent('.first-level-cat').set('class', 'first-level-cat active-cat'); }, hideAll: function() { this.LevelTwo.slide('out'); this.menuHead.getParent('.first-level-cat').set('class', 'first-level-cat'); }, toggleAll: function() { if (openTab == this.LevelTwo.getParent('li').length) { this.hideAll(); openTab = 0; // $('razvcat').set('html', 'развернуть'); } else { this.showAll(); openTab = this.LevelTwo.getParent('li').length; // $('razvcat').set('html', 'свернуть'); } } }); var Scrollbar = new Class({ Implements: [Options], options: { vDur: 2000 }, initialize: function(sbar, main, options) { this.setOptions(options) this.sbar = $(sbar); this.main = $(main); if (!this.sbar || !this.main) return false; this.arrowUp = this.sbar.getElement('.arrowUp'); this.arrowDown = this.sbar.getElement('.arrowDown'); this.vThumb = this.sbar.getElement('.vThumb'); this.vTrack = this.sbar.getElement('.vTrack'); this.hsteps = this.main.getParent('.moocontent').getHeight() - this.main.getHeight(); this.steps = this.hsteps; this.vTrackLine = this.vTrack.getHeight() - this.vThumb.getHeight(); this.fxscroll = new Slider(this.vTrack, this.vThumb, { mode: 'vertical', steps: this.hsteps, onChange: function(h) { this.textPause(); this.main.setStyles({top: h * this.hsteps / this.steps }); return false; }.bind(this) }); this.arrowUp.addEvents({ 'mousedown': this.textUp.bind(this), 'mouseup': this.textPause.bind(this) }); this.arrowDown.addEvents({ 'mousedown': this.textDown.bind(this), 'mouseup': this.textPause.bind(this) }); this.sbar.set('morph', {duration: 500}); this.vThumb.set('morph', {duration: this.options.vDur}); this.main.set('morph', {duration: this.options.vDur}); this.main.getParent('.moocontent').addEvent('mousewheel', this.textWheel.bind(this)); //this.main.getParent('.moocontent').addEvent('mousemove', this.updatePos.bind(this)); // check state periodically this.updatePos.periodical(500, this); this.vThumb.setStyle('top', 0); this.main.setStyle('top', 0); this.updatePos(); }, textUp: function() { this.dur('up'); this.main.morph({ top: 0 }); this.vThumb.morph({ top: 0 }); return false; }, textDown: function() { this.dur('down'); this.main.morph({ top: this.hsteps }); this.vThumb.morph({ top: this.vTrack.getHeight() - this.vThumb.getHeight() }); return false; }, textPause: function() { this.dur('pause'); return false; }, getPos: function() { this.scrollerpos = this.vThumb.getStyle('top').toInt(); this.blockpos = this.main.getStyle('top').toInt(); return false; }, dur: function(pos) { this.getPos(); if (pos == 'up') { this.durat = this.scrollerpos * this.options.vDur / this.vTrackLine; if (this.durat == 0) this.durat = this.options.vDur; this.stepScroll = this.scrollerpos + 25 * this.vTrackLine / this.hsteps; this.stepMain = this.blockpos + 25; if (this.stepScroll < 0) this.stepScroll = 0; if (this.stepMain > 0) this.stepMain = 0; } else if (pos == 'down') { this.durat = this.options.vDur - this.scrollerpos * this.options.vDur / this.vTrackLine; if (this.durat == 0) this.durat = this.options.vDur; this.stepScroll = this.scrollerpos - 25 * this.vTrackLine / this.hsteps; this.stepMain = this.blockpos - 25; if (this.stepScroll > this.vTrackLine) this.stepScroll = this.vTrackLine; if (this.stepMain < this.hsteps) this.stepMain = this.hsteps; } else if (pos == 'pause') { this.durat = 0; } this.vThumb.set('morph', {duration: this.durat}); this.main.set('morph', {duration: this.durat}); return false; }, textWheel: function(e) { if (this.hsteps < 0) { if (e.wheel > 0) { this.dur('up'); this.main.setStyle('top', this.stepMain); this.vThumb.setStyle('top', this.stepScroll); } else if (e.wheel < 0) { this.dur('down'); this.main.setStyle('top', this.stepMain); this.vThumb.setStyle('top', this.stepScroll); } } return false; }, scrollOp: function() { if (this.hsteps > 0) { this.sbar.morph({ opacity: 0 }); } else { this.sbar.morph({ opacity: 1 }); } }, updatePos: function() { this.curHeight = this.main.getParent('.moocontent').getHeight() - this.main.getHeight(); if (this.curHeight != this.hsteps) { this.raznHeight = this.curHeight - this.hsteps; this.hsteps = this.curHeight; this.setPos(); } this.scrollOp(); }, setPos: function() { this.getPos(); this.dur('up'); if (this.curHeight < 0) { this.main.morph({ top: this.scrollerpos * this.curHeight / this.vTrackLine }); } else { this.vThumb.morph({ top: 0 }); this.main.morph({ top: 0 }); } } }); var Help = new Class({ initialize: function(elem, Link) { this.elem = $(elem); this.Link = $(Link); if (!this.elem) return false; this.close = this.elem.getElement('.close'); this.fx = new Fx.Morph(this.elem, {duration: 600}); this.Link.addEvent('click', this.show.bind(this)); this.close.addEvent('click', this.hide.bind(this)); this.elem.setStyle('display', 'none'); this.fx.set({ opacity: 0 }); }, show: function() { this.elem.setStyle('display', 'block'); this.fx.start({ opacity: 1 }); }, hide: function() { this.fx.start({ opacity: 0 }).chain(function() { this.elem.setStyle('display', 'none'); }.bind(this)); } }); var changeZindex = new Class({ initialize: function(menu) { this.menu = $$(menu); if (!this.menu) return false; this.curZind = 100000; this.menu.getElements('li span').each(function(name) { name.addEvent('click', this.setZindex.bind(this)); }.bind(this)); this.window = this.menu.getParent('div').getElements('.head-window'); this.window.each(function(name) { name.addEvent('click', this.setWindZindex.bind(this)); }.bind(this)); }, setZindex: function(e) { this.curEl = $(e.target); this.getZindex(); if (this.Zind < this.curZind - 1) { this.wind.setStyle('z-index', this.curZind); this.curZind++; } }, getZindex: function() { this.windClass = this.curEl.get('class'); this.wind = this.menu.getParent('div').getElement('div.' + this.windClass); this.Zind = this.wind.getStyle('z-index'); return this.Zind; }, setWindZindex: function(e) { this.curEl = $(e.target).getParent('.head-window'); if (!this.curEl) this.curEl = $(e.target); this.Zind = this.curEl.getStyle('z-index'); if (this.Zind < this.curZind - 1) { this.curEl.setStyle('z-index', this.curZind); this.curZind++; } } }); var clearInput = new Class({ initialize: function(ar) { this.ar = $$(ar); if (!this.ar) return false; this.ar.addEvent('click', this.clearIn.bind(this)); }, clearIn: function(e) { this.cur = $(e.target); this.cur.getParent('form').getElements('input').set('value', ''); } }); var FormValid = new Class({ Implements: [Options], options: { rule: 'login' }, initialize: function(elem, options) { this.setOptions(options); // Quick fix: IE searches element by name, not only id :( // mootools will fix it only in 2.0 version var elemObj = getElementByIdIEFix(elem); this.elem = $(elemObj); if (!this.elem) return false; this.pass = this.elem.getParent('.valid-form').getElement('.valid-pass'); this.repPass = this.elem.getParent('.valid-form').getElement('.valid-reppass'); this.fx = new Fx.Morph(this.elem); if (this.options.rule == 'password') { this.elem.addEvent('keyup', this.passwordValid.bind(this)); } if (this.options.rule == 'reppass') { this.elem.addEvent('keyup', this.repPassValid.bind(this)); this.pass.addEvent('keyup', this.repPassValid.bind(this)); } if (this.options.rule == 'login') { this.elem.addEvent('keyup', this.loginValid.bind(this)); } if (this.options.rule == 'email') { this.elem.addEvents({ 'keyup': this.emailValid.bind(this), 'blur': this.emailValid.bind(this) }); } }, noVal: function() { this.fx.cancel(); this.fx.start({ 'border-width': '2px', 'border-color': '#EF1D25', 'border-style': 'solid', margin: '0 13px 7px 0' }); return false; }, Val: function() { this.fx.cancel(); this.fx.start({ 'border-width': '2px', 'border-color': '#2EEF00', 'border-style': 'solid', margin: '0 13px 7px 0' }).chain(function() { this.fx.start({ 'border-width': '0px', 'border-color': '#fff', margin: '2px 15px 9px 2px' }); }.bind(this)); return false; }, repPassValid: function() { this.getPassValue(); if (this.fpass == '' || this.sPass == '') { this.noVal(); } else if (this.fPass == this.sPass) { this.Val(); } else { this.noVal(); } }, getPassValue: function() { this.fPass = this.pass.get('value'); this.sPass = this.repPass.get('value'); }, loginValid: function(e) { if (/^([\-0-9a-zA-Z_]+)$/.test(this.elem.get('value'))) { this.Val(); } else { this.noVal(); } }, passwordValid: function() { if (/^([\-0-9a-zA-Z_]{6,})$/.test(this.elem.get('value'))) { this.Val(); } else { this.noVal(); } }, emailValid: function() { if (/^([\-0-9A-Za-z_]+)@([\-0-9a-z_^.]+\.[a-z]{2,4})$/.test(this.elem.get('value'))) { this.Val(); } else { this.noVal(); } } }); window.addEvent('domready', function() { //var slmenu = new SearchPar('search-cat'); var searchText = new inputText('search-text'); var ms = new mapSlide('razvmap', 'catalog'); var catScroller = new Scrollbar('cat-scrollbar', 'flevel-catalog'); var catSlide = new menuSlide('flevel-catalog', { scroller: catScroller }); var cat2Scroller = new Scrollbar('cat-tree-scrollbar', 'slevel-cat'); //var helpScroller = new Scrollbar('help-scrollbar', 'help-content'); var repPassVal = new FormValid('reppwd', {rule: 'reppass'}); var passVal = new FormValid('pwd', {rule: 'password'}); var logVal = new FormValid('login', {rule: 'login'}); var mailVal = new FormValid('email', {rule: 'email'}); var slmenu = new SearchPar('spec-obj'); //специальные объекты //var slmenu = new SearchPar('city'); //города if ($('razvcat')) { $('razvcat').addEvent('click', function() { catSlide.toggleAll(); }); } ; // var heplmenu = new Help('help', 'help-link'); var signinwindow = new Help('signin', 'signin-link'); var signupwindow = new Help('signup', 'signup-link'); //var ukoz = new Help('ukoz', 'karta'); var chngwind = new changeZindex('.hnav'); var signinInp = new clearInput('.clearinput'); // FIX for showing cities list if ($('city')) { $('city').addEvent('click', function () { var citiesList = $(document.createElement('div')); // List of cities HTML code citiesList.store('title', $('cities-list').innerHTML); citiesList.store('href', '/img/mapindex.png'); citiesList.store('rev', 'width:600,height:200'); milkbox.openMilkbox([citiesList], 0); // Who will delete citiesList ? }); } }); window.addEvent('domready', function() { if ($('posl-dob')) var mVS1 = new Fx.Slide('posl-dob'); if ($('news')) var mVS2 = new Fx.Slide('news'); if ($('comments')) var mVS3 = new Fx.Slide('comments'); if ($('obj-desc')) var mVS4 = new Fx.Slide('obj-desc'); if ($('map-cont')) var mVS6 = new Fx.Slide('map-cont', { duration: 40}); if ($('banner')) var mVS7 = new Fx.Slide('banner'); if ($('v_t2')) $('v_t2').addEvent('click', function(e) { e.stop(); var m_s = $('v_t2').get('src'); if (m_s == '/img/up-arrow.png') $('v_t2').set('src', '/img/down-arrow.png'); else $('v_t2').set('src', '/img/up-arrow.png'); mVS2.toggle(); }); if ($('v_t1')) $('v_t1').addEvent('click', function(e) { e.stop(); var m_s = $('v_t1').get('src'); if (m_s == '/img/up-arrow.png') $('v_t1').set('src', '/img/down-arrow.png'); else $('v_t1').set('src', '/img/up-arrow.png'); mVS1.toggle(); }); if ($('v_t3')) $('v_t3').addEvent('click', function(e) { e.stop(); var m_s = $('v_t3').get('src'); if (m_s == '/img/up-arrow.png') $('v_t3').set('src', '/img/down-arrow.png'); else $('v_t3').set('src', '/img/up-arrow.png'); mVS3.toggle(); }); if ($('v_t4')) $('v_t4').addEvent('click', function(e) { e.stop(); var m_s = $('v_t4').get('src'); if (m_s == '/img/up-arrow.png') $('v_t4').set('src', '/img/down-arrow.png'); else $('v_t4').set('src', '/img/up-arrow.png'); mVS4.toggle(); }); if ($('v_t7')) $('v_t7').addEvent('click', function(e) { e.stop(); var m_s = $('v_t7').get('src'); if (m_s == '/img/up-arrow.png') $('v_t7').set('src', '/img/down-arrow.png'); else $('v_t7').set('src', '/img/up-arrow.png'); mVS7.toggle(); }); if ($('v_t6')) $('v_t6').addEvent('click', function(e) { var mVS51 = $('mapcor-lb'); var mVS52 = $('mapcor-rb') var mVS53 = $('mapcor-lt'); var mVS54 = $('mapcor-rt') var mVS55 = $('map-button') e.stop(); var m_s = $('v_t6').get('src'); if (m_s == '/img/up-arrow.png') { $('v_t6').set('src', '/img/down-arrow.png'); mVS55.setStyle('display', 'none'); mVS53.setStyle('display', 'none'); mVS54.setStyle('display', 'none'); mVS6.hide(); mVS51.setStyle('display', 'none'); mVS52.setStyle('display', 'none'); } else { $('v_t6').set('src', '/img/up-arrow.png'); mVS51.setStyle('display', 'block'); mVS52.setStyle('display', 'block'); mVS6.show(); mVS53.setStyle('display', 'block'); mVS54.setStyle('display', 'block'); mVS55.setStyle('display', 'block'); } }); if ($('cho')) { mVS4.toggle(); $('v_t4').set('src', '/img/down-arrow.png'); } }); /** Fix for stupid IE6 & 7 */ function getElementByIdIEFix(id) { var elem = document.getElementById(id); if (elem) { //verify it is a valid match! if (elem.attributes['id'] && elem.attributes['id'].value == id) { //valid match! return elem; } else { //not a valid match! //the non-standard, document.all array has keys for all name'd, and id'd elements //start at one, because we know the first match, is wrong! for (var i = 1; i < document.all[id].length; i++) { if (document.all[id][i].attributes['id'] && document.all[id][i].attributes['id'].value == id) { return document.all[id][i]; } } } } } function siteTime() { var adrs = window.location.pathname.toString(); adrs = adrs.split('/'); adrs = adrs[1]; if (adrs == 'en') { dayarray = new Array("sun", "mon", "tue", "wed", "thu", "fri", "sat"); montharray = new Array('january', "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"); } else if (adrs == 'de') { dayarray = new Array("so", "mo", "di", "mi", "do", "fr", "sa"); montharray = new Array("januar", "februar", "märz", "april", "könnte", "june", "juli", "august", "september", "oktober", "november", "dezember"); } else if (adrs == 'fr') { dayarray = new Array("dim", "lun", "mar", "mer", "jeu", "ven", "sam"); montharray = new Array("janvier", "février", "mars", "avril", "peut", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"); } else if (adrs == 'cn') { dayarray = new Array("週日", "週一", "週二", "週三", "週四", "週五", "週六"); montharray = new Array("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"); } else { dayarray = new Array("вс", "пн", "вт", "ср", "чт", "пт", "сб"); montharray = new Array("января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"); } ndata = new Date(); month = montharray[ndata.getMonth()]; date = ndata.getDate(); hours = ndata.getHours(); mins = ndata.getMinutes(); if (mins < 10) { mins = "0" + mins } if ($('time_c')) { var t_str = date + " " + month + "
" + hours + ":" + mins; document.getElementById("time_c").innerHTML = t_str; } setTimeout("siteTime()", 1500); } siteTime();