//flash in header // flashembed('menu_bg', {src: '/swf/sae3.swf', wmode: 'opaque', bgcolor: '#345B87'}); flashembed('ukraine', {src: '/swf/ukraine.swf', bgcolor: '#ffffff', menu: false }); $(function(){ $('.menu div.list div.list').css({opacity:0.8}) $('#main_menu .item').hover(function(){ if($(this).parents('.list').length != 2){ var _this = this; setTimeout(function(){ $(_this).find('.hidden:first').show(); },20) } else { $(this).closest('.list').find('.hidden').hide(); $(this).find('.hidden:first').show(); } },function(){ if($(this).parents('.list').length != 2 ){ var _this = this; setTimeout(function(){ var list = $(_this).find('.hidden:first'); if(!list.hasClass('actitem')) list.hide(); },20) } }) $('#main_menu > .list > .item').hover(function(){ if( !$(this).hasClass('active')){ $('#main_menu .actitem:eq(1)').hide() } },function(){ $('#main_menu .actitem:eq(1)').show() }) }) function pop_up(link, width, height) { width = parseInt(width) + 30; height = parseInt(height) + 30; var params='toolbar=no,height='+height+',width='+width+',location=no,scrollbars=yes,status=no,menubar=no,resizable=yes'; var address = link.href win = window.open(address,"_blank",params); } $('.council_links a').click(function(e) { e.preventDefault(); pop_up(this,500,400); }); $('.map a').click(function(e) { e.preventDefault(); if ($(this).attr('href') != '#') { pop_up(this,500,400); } }); (function() { var subscribe = $('.subscribe'); var show = function() { subscribe.find('form').fadeIn('fast').addClass('shown'); } var hide = function() { subscribe.find('form.shown').fadeOut('fast').removeClass('shown'); } subscribe.find('h4').click(function(e) { !subscribe.find('form.shown').length ? show() : hide(); }); $(document).click(function(e) { if (!$(e.target).parents('.subscribe').length) hide(); }); })(); //calendar // $(function() { var lang = location.pathname.match(/^\/([a-z]{2})/); lang = lang? lang[1] : 'ru'; var text = { ru: { month: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'], week: ['Пн','Вт','Ср','Чт','Пт','Сб','Вс'], prev_next: ['Предыдущий','Следующий'], today: 'Сегодня' }, en: { month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], week: ['Mn','Tu','We','Th','Fr','Sa','Su'], prev_next: ['Prev','Next'], today: 'Today' }, gr: undefined }; var local = text[lang] || text['ru']; var d = new Date(); var month = d.getMonth(); var year = d.getFullYear(); var days = {}; var holiday_class = ['h1','h2','h3','h4','h5','h6','h7','h8','h9','h10']; var desc = '
#title
' var update_cal = function(block, month, year) { var date = ((new Date(year, month, 1)).getDay() || 7) - 1; days .attr('title', '') .removeClass(holiday_class.join(' ') +' t o') .show().slice(32 - new Date(year, month, 32).getDate()).hide().end() .each(function(i) { if ((i + date) % 7 == 5 || (i + date) % 7 == 6) $(this).addClass('o') }); var first = block.find('.d1'); var padding = parseInt(first.css('padding-left')); var margin = parseInt(block.find('.d2').css('margin-left')); first.css('margin-left', (first.width() + padding + margin) * date + margin); block.find('.m').text(local.month[month] + ' ' + year); block.find('.desc').remove(); if (holidays && holidays[month]) { var n = 0; $.each(holidays[month], function(i,v) { if (n < 7 && v) { i = parseInt(i); days.eq(i-1).addClass(holiday_class[n]).attr('title', v.title); n++; block.find('.all_holidays').before($(desc.replace('#i',n).replace('#link', v.link).replace('#title', v.title))); } }) } if (month == d.getMonth() && year == d.getFullYear()) { var t = days.eq(d.getDate()-1) if (t.attr('title') == '') { t.addClass('t').attr('title', local['today']); } else { t.attr('title', local['today'] + ': ' + t.attr('title')); } } }; $('.calendar.block').each(function() { var block = $(this); days = block.find('.cal > .d'); block .find('.week .d') .each(function(i) { $(this).text(local.week[i]); }) .end() .find('a.prev') .attr('title', local.prev_next[0]) .click(function(e) { e.preventDefault(); month--; if (month < 0) { month = 11; year--; } update_cal(block, month, year); }) .end() .find('a.next') .attr('title', local.prev_next[1]) .click(function(e) { e.preventDefault(); month++; if (month > 11) { month = 0; year++; } update_cal(block, month, year); }) .end(); update_cal(block, month, year); setTimeout(function(){ block.fadeTo('slow', 1); }, 300); }); }); //photo and video viewer // $(function() { $('.spoiler') .live('click', function () { $(this).toggleClass('spoiler-expanded') .next().slideToggle(); }) .next().slideUp(0); $('.viewer').each(function() { var block = $(this); var small = { items: block.find('.small .item'), scroll: block.find('.small .scroll'), pos: 0, step: 78, full_items: 4, time: 200 }; var big = { items: block.find('.big .item'), scroll: block.find('.big .scroll'), pos: 0, step: 300, time: 150 }; var up = block.find('.up'); var down = block.find('.down'); var effect = 'linear'; var effect_time = 1; //per pixel var animate = function(obj) { var v = obj.pos * obj.step; //var d = Math.abs(v + parseInt(obj.scroll.css('top'))); obj.scroll.stop().animate({ top: -v }, { duration: obj.time, easing: effect }); } var update_src = function() { var d = small.full_items-1; var start = big.pos - d; if (start < 0) start = 0; var end = big.pos + d; big.items.slice(start, end).each(function() { var img = $(this).find('img'); if (img.length && img.attr('src') != img.attr('src2')) { img.attr('src', img.attr('src2')); } }); } var update_viewer = function() { update_src(); animate(big); animate(small); } small.items.each(function(i) { $(this).data('pos', i); }); if (small.items.length > 1) { small.items.click(function() { var item = $(this); small.items.removeClass('active'); item.addClass('active'); big.pos = item.data('pos'); $('.photo_comment').hide(); var pic_id = $(this).attr('id').replace('photo_sm_', ''); $('#photo'+pic_id).show(); //console.log(item.data('pos'), small.pos) //отладить это место на большом количестве фотографий if (item.data('pos') == small.pos) { up.click(); } else if (item.data('pos') == small.pos + small.full_items - 1) { down.click(); } update_viewer(); }) small.items.first().click(); if (small.items.length > small.full_items) { up.click(function () { small.pos--; if (small.pos < 0) small.pos = 0; update_viewer(); }); down.click(function() { small.pos++; if (small.pos > small.items.length - small.full_items) small.pos = small.items.length - small.full_items; update_viewer(); }); } else { up.hide(); down.hide(); } } else { small.items.hide(); } update_viewer(); }); });