$(document).ready(function(){ $(document).pngFix(); $('.mnBtn .flag').click(function(){ $(this).next().next().toggle(); if ($(this).hasClass('mnBtnOff')) { $(this).removeClass('mnBtnOff'); $(this).addClass('mnBtnOn'); } else { $(this).addClass('mnBtnOff'); $(this).removeClass('mnBtnOn'); } }); $('#topMenu td').hover(function(){ if($(this).prev().hasClass('topMenuCrnr-t-l')){ $('.topMenuCrnr-t-l').addClass('hover-t-l'); $('.topMenuCrnr-b-l').addClass('hover-b-l'); } if($(this).next().hasClass('topMenuCrnr-t-r')){ $('.topMenuCrnr-t-r').addClass('hover-t-r'); $('.topMenuCrnr-b-r').addClass('hover-b-r'); } $(this).addClass('hover'); },function(){ $('.topMenuCrnr-t-l').removeClass('hover-t-l'); $('.topMenuCrnr-b-l').removeClass('hover-b-l'); $('.topMenuCrnr-t-r').removeClass('hover-t-r'); $('.topMenuCrnr-b-r').removeClass('hover-b-r'); $(this).removeClass('hover'); }); $('#insideMenuBtm td').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); }); /*$(function(){ // Datepicker $('#datepicker').datepicker({ inline: true, altFormat: 'yy-mm-dd' }); });*/ $.fn.wrappH1 = function(){ $('h1', $(this)).each(function(){ var h1Txt = $(this).html(); $(this).replaceWith('

'+h1Txt+'

'); }); }; $.fn.wrappH2 = function(){ $('h2', $(this)).each(function(){ var h2Txt = $(this).html(); $(this).replaceWith('

'+h2Txt+'

'); }); }; $.fn.wrappH3 = function(){ $('h3', $(this)).each(function(){ var h3Txt = $(this).html(); $(this).replaceWith('

'+h3Txt+'

'); }); }; $('#center').wrappH1(); $('#center').wrappH2(); $('#center').wrappH3(); /*$("#datepicker").click(function(){ var ttp = $(this).datepicker( "getDate", "altFormat" ); });*/ /*Begin Gallery*/ $("#itemGallerySlider .imgBorder a").click(function() { var bigImg = $(this).attr("href"); var bigImgBig = $(this).attr("rel"); var gCur = $(this).attr("count"); var bigImgTitle = $(this).attr("title"); $("#itemGalleryBigImg img").attr("src", bigImg); $("#itemGalleryBigImg a").attr("href", bigImgBig); $("#itemGalleryBigImg a").attr("count", gCur); $("#itemGalleryBigImg a").attr("title", bigImgTitle); $("#itemGallerySlider p").removeClass("active"); $(this).parent().addClass("active"); return false; }); var click = 0; $("#itemGallerySlider #next").click(function(){ //var t = 0; var count = $(".imgBorder img").length; if ((click+2) < count) { var hidImg = $(".imgBorder img").get(click); $(hidImg).parent().parent().hide(); var showImg = $(".imgBorder img").get(click + 2); $(showImg).parent().parent().show(); click++; } if (click>0) { $('#prev img').attr('src','/html/i/ico/prev-active.png'); }if (click==(count-2)){ $('#next img').attr('src','/html/i/ico/next.png'); } return false; }); $("#itemGallerySlider #prev").click(function(){ if (click > 0) { var hidImg = $(".imgBorder img").get(click + 1); $(hidImg).parent().parent().hide(); var showImg = $(".imgBorder img").get(click - 1); $(showImg).parent().parent().show(); click--; } var count = $(".imgBorder img").length; if (click==0) { $('#prev img').attr('src','/html/i/ico/prev.png'); }if (click<(count-2)){ $('#next img').attr('src','/html/i/ico/next-active.png'); } return false; }); /*End Gallery*/ /* Галерея в каталоге by Petrov Nikolay*/ $('.gallBox').each(function (){ var gal = $(this); var visible = 7; // количество видимых элементов var elemWidth = 76; // ширина элемента var nw = gal.find('.items'); // текущая галерея var speed = 500; var galEq = $('.gallBox').index(this); // номер текущей галереи var total = nw.children('p').length; // кол-во элементов в галерее var canvasWidth = total * elemWidth; // ширина полотна var maxLeft = total - visible; // максимальная левая позиция var maxLeftPx = maxLeft * elemWidth; // она-же в пикселях $('.gallBox:eq('+galEq+')').data('cur', 0); nw.css('width', canvasWidth + "px"); // выставляем ширину полотна function move ( offset ) { var offsetWidth = offset * elemWidth; // смещение в пикселях /* начало */ if(offset <= 0 ) { nw.animate({ left: 0 }, speed); gal.find('.prev').children().children().attr('src','/i/ico/prev.png'); // скрываем стрелку влево gal.find('.next').children().children().attr('src','/i/ico/next-active.png'); // отображаем стрелку вправо /* конец */ } else if ( offset >= maxLeft ) { nw.animate({ left: -maxLeftPx }, speed); gal.find('.next').children().children().attr('src','/i/ico/next.png'); // скрываем gal.find('.prev').children().children().attr('src','/i/ico/prev-active.png'); // отображаем /* листание */ } else { nw.animate({ left: -offsetWidth }, speed); gal.find('.next').children().children().attr('src','/i/ico/next-active.png'); // отображаем gal.find('.prev').children().children().attr('src','/i/ico/prev-active.png'); // отображаем } }; // клик вправо gal.find('.next').click(function(){ var current = $('.gallBox:eq('+galEq+')').data('cur'); $('.gallBox:eq('+galEq+')').data('cur', current + 1 ); move($('.gallBox:eq('+galEq+')').data('cur')); return false; }); // клик влево gal.find('.prev').click(function(){ var current = $('.gallBox:eq('+galEq+')').data('cur'); $('.gallBox:eq('+galEq+')').data('cur', current - 1 ); move($('.gallBox:eq('+galEq+')').data('cur')); return false; }); // если элементов в галерее мало - скрываем правую стрелку if(total<=visible){ gal.find('.next').children().children().attr('src','/i/ico/next.png');// скрываем } }); /* / Галерея */ $('.popupNews').click(function(){ newWin=window.open(this.href,'printWindow','width=750','Toolbar=0,Location=0,Directories=0,Status=0,Menubar=0,Scrollbars=1,Resizable=0'); return false; }); });