Shadowbox.init({ language: 'ru', adapter: 'mootools', skipSetup: true, players: ['img'] }); window.addEvent('domready', function() { $(document.body).addClass('js'); // включаем shadowbox var Shadowbox_options = { viewportPadding: 10, handleOversize: 'drag', viewportPadding: 5, autoDimensions: true }; list = $$(document.links); list = list.filter(function(item){ return item.href.test(/\.(jpe?g|png|gif)$/) }); if (list && list.length) { Shadowbox.setup(list, Shadowbox_options); } smscroll = new SmoothScroll(); var lprev = $('prev_link'); var lnext = $('next_link'); var keycatcher = Browser.Engine.trident ? document.body : window; if (lprev || lnext) keycatcher.addEvent('keydown', function(e) { if (e.control) { if (e.key == 'right' && lnext) location = lnext.href; if (e.key == 'left' && lprev) location = lprev.href; } }); new Tips('*[title]',{className: 'atip'}); // карта if (window.points) InitMap(); // комменты if ($('text')) { $$('#text, #email, #name').addEvent('click', function() { if (this.inited) return; this.inited = true; this.value = ""; }).addEvent('focus', function() { if (this.inited) return; this.inited = true; this.value = ""; }).addEvent('keydown', function(e) { if (e.key == 'enter' && e.control) { $$('#text, #email, #name').each(function(item) { if (!item.inited) item.value = ''; }); $(this.form).submit(); } }); $($('text').form).addEvent('submit', function() { $$('#text, #email, #name').each(function(item) { if (!item.inited) item.value = ''; }); }); } }); function InitMap() { var imap = $('map'); var foto_img = new Asset.image('/images/map/_foto.png'); var foto_img_hover = new Asset.image('/images/map/_foto_hover.png'); $$('#map_area area').each(function(area) { area.n = area.id.match(/\d+/)[0]; area.data = window.points[area.n]; area.img = new Asset.image('/images/map/' + area.data.image, {styles: { left: area.data.offset_left + 'px', top: area.data.offset_top + 'px', position: 'absolute', opacity: 0 }}); area.img.set('tween', {duration: 200}); // комнаты if (area.data.foto == 0) { area.addEvent('mouseenter', function(e) { imap.adopt(area.img, 'top'); area.img.tween('opacity', 1); }).addEvent('mouseleave', function(e) { area.img.tween('opacity', 0); }); // свободные фотографии } else { area.img.inject(imap).addClass('foto').setStyle('opacity', 1); if (area.img.src == foto_img.src) { area.addEvent('mouseenter', function(e) { area.img.src = foto_img_hover.src; }).addEvent('mouseleave', function(e) { area.img.src = foto_img.src; }); } } $('room_src' + area.n).setStyles({ opacity: 0, visibility: 'hidden' }); // клик area.addEvent('click', function(e) { if (!this.href.match(/room/)) { e.stop(); return false; } if (window.active_bigpane) window.active_bigpane.tween('opacity', 0); window.active_bigpane = $('room_src' + this.n); $('spacer').tween('height', 500 + window.active_bigpane.getSize().y); window.active_bigpane.tween('opacity', 1); }); var m = window.location.toString().match(/room(\d+)/); if (m) $('map_areaitem' + m[1]).fireEvent('click'); });