$(function (){ $('#textsearch').textCheck({text: 'Поиск'}); if($.browser.msie && $.browser.version == 6){ var menuli = $('#menu li'); menuli.hover(function (){ $(this).addClass('hover').find('ul').css('display', 'block'); }, function (){ $(this).removeClass('hover').find('ul').css('display', 'none'); }); } if($('.accordion').length){ var link = $('.accordion .liea'); var collapsible = $('.accordion .collapse'); collapsible.css('display', 'none'); link.bind('click', function (){ $(this).blur().closest('.accordion').children('.collapse').toggle('blind'); return false; }); } if($('.crimg').length){ if(($.browser.msie && $.browser.version == 6) || ($.browser.msie && $.browser.version == 7)){ } else { var cri = $('.crimg'); var val_l = '
'; var tl = ''; var tr = ''; var bl = ''; var br = ''; var h = 0; cri.each(function (){ var el = $(this); h = el.height(); el.wrap(val_l).parent().css({ height: h, float: el.css('float') }).append(tr, br, tl, bl); el.css({ float: 'none', margin: '0', position: 'relative', zIndex: '50' }); if((h == 0) || (h < 40)){ el.load(function (){ h = el.height(); el.parent().css('height', h); }); } }); } } if($('a.fbox').length){ $('a.fbox').fancybox({ 'titlePosition': 'inside', 'showCloseButton': false, 'titleFormat': formatTitle, 'padding': 5, 'overlayColor': '#000' }); } function formatTitle(title, currentArray, currentIndex, currentOpts){ return ''; } //end function formatTitle var s_button = $('#search_site'); var s_form = $('#searchpopup'); var s_close = $('#closebutton'); s_button.bind('click', function (){ s_form.css('display', 'block'); $('#textsearch').focus(); }); s_close.bind('click', function (){ s_form.css('display', 'none'); }); if($('.customch').length){ var che = $('.customch'); function changeCheckStart(el){ var input = el.find('input').eq(0); if(input.attr('checked')) { el.css('background-position', '-14px 0'); input.attr('checked', true) } return true; } //end function changeCheckStart che.each(function (){ changeCheckStart($(this)); }); che.bind('click', function (){ changeCheck($(this)); }); function changeCheck(el){ var input = el.find('input').eq(0); if(!input.attr('checked')) { el.css('background-position', '-14px 0'); input.attr('checked', true) } else { el.css('background-position', '0 0'); input.attr('checked', false) } return true; } //end function } if($('#tabs_top').length || $('#tab_bottom').length){ var topred = $('#tabs_top .redtab_md'); var bottomred = $('#tabs_bottom .redtab_md'); var graytop = $('#tabs_top .graytab_md'); var graybottom = $('#tabs_bottom .graytab_md'); var str = ''; var str2 = ''; var ltb = $('#left_b_top'); var rtb = $('#right_b_top'); var lbb = $('#left_b_bottom'); var rbb = $('#right_b_bottom'); var topgallery = $('#topgallery'); var bottomgallery = $('#bottomgallery'); var all_gallery = $('.framegallery table'); var widthgallery = 4; //количество видимых эелементов на странице галереи var widthelemgallery = 196; //ширина ячейки галереи var speedroll = 1200; //скорость прокрутки галереи var move = widthelemgallery * widthgallery; all_gallery.data('pos', 0); all_gallery.each(function (){ var gt = $(this); gt.data('countelements', gt.find('td').length); }); function checkButton(gallery, button, typebutton){ //функция проверки кнопок прокрутки на активность switch (typebutton){ case 'right':{ if((gallery.data('countelements') <= widthgallery) || (gallery.data('countelements') * widthelemgallery + move * gallery.data('pos') <= move)){ button.addClass('noactive_r'); } else { button.removeClass('noactive_r'); } break; } case 'left':{ if(gallery.data('pos') < 0){ button.removeClass('noactive_l'); } else { button.addClass('noactive_l'); } break; } } } //end function checkButton checkButton(topgallery, rtb, 'right'); checkButton(bottomgallery, rbb, 'right'); topred.live('click', function (){ var onetab = $(this); changeTab(onetab, graytop); topgallery.addClass('hidegallery'); topgallery = all_gallery.eq(onetab.index()); topgallery.removeClass('hidegallery'); checkButton(topgallery, rtb, 'right'); checkButton(topgallery, ltb, 'left'); }); bottomred.live('click', function (){ var onetab = $(this); changeTab(onetab, graybottom); bottomgallery.addClass('hidegallery'); bottomgallery = all_gallery.eq(onetab.index() + topred.length+1); bottomgallery.removeClass('hidegallery'); checkButton(bottomgallery, rbb, 'right'); checkButton(bottomgallery, lbb, 'left'); }); ltb.bind('click', function (){ if(!ltb.hasClass('noactive_l')){ moveGallery(1, topgallery, rtb, $(this)); } }); rtb.bind('click', function (){ if(!rtb.hasClass('noactive_r')){ moveGallery(-1, topgallery, $(this), ltb); } }); lbb.bind('click', function (){ if(!lbb.hasClass('noactive_l')){ moveGallery(1, bottomgallery, rbb, $(this)); } }); rbb.bind('click', function (){ if(!rbb.hasClass('noactive_r')){ moveGallery(-1, bottomgallery, $(this), lbb); } }); function changeTab(elem, lepos){ //функция смены активного таба str = lepos.children('span').html(); lepos.append(''+ str +'').find('span, p').remove(); lepos.removeClass('graytab_md').addClass('redtab_md'); if(!lepos.hasClass('tabfirst')){ lepos.css('z-index', lepos.prev().css('z-index')-10); } if(lepos === graytop){ topred.add(graytop); } else { bottomred.add(graybottom); } topred.add(lepos); str2 = elem.children('em').html(); elem.append(''+ str2 +''+ str2 +'
').find('em').remove(); elem.removeClass('redtab_md').addClass('graytab_md').css('z-index', 700); if(lepos === graytop){ graytop = elem; } else { graybottom = elem; } } //end function changeTab function moveGallery(direction, gallery, button_r, button_l){ //функция прокрутки галереи gallery.stop().animate({ marginLeft: gallery.data('pos')*move + move*direction }, speedroll, 'easeOutQuart'); gallery.data('pos', gallery.data('pos') + direction); checkButton(gallery, button_r, 'right'); checkButton(gallery, button_l, 'left'); } //end function moveGallery } if($('#map').length){ $('#map').gMap({ markers: [{ latitude: 59.92430, longitude: 30.35050 }], controls: ['GSmallMapControl'], zoom: 14 }); } if($('#other').length || $('#other2').length){ var ot = $('#other').add($('#other2')); var otl = ot.parent(); ot.bind('change', function(){ $(this).parent().trigger('click'); $(this).parent().nextAll('input[type="text"]').toggleClass('hidd').focus(); }); otl.bind('click', function(){ $(this).nextAll('input[type="text"]').toggleClass('hidd').focus(); }); } //banners var banners = $('div.topbanner'); if ( banners.length ) { var hasFlash = false; try{ var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); if(fo) hasFlash = true; }catch(e){ if(navigator.mimeTypes['application/x-shockwave-flash']!=undefined && navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin ){ hasFlash = true; } } banners.each(function(){ if ( !hasFlash ) { $('object', $(this)).hide(); var img = $('img', $(this)); if ( !img.length ) $(this).hide(); else img.show(); } }); delete hasFlash; } delete banners; });