$(document).ready(function(){ if ($('.mainNav li.currentLast UL').length) { $('.mainNav li.currentLast').addClass('no_padding'); } $('.pageImage').cycle(); $('.action').show().cycle(); { // каталог $('.switch').click(function () { var _imgObject = $('img:first', $(this).parents('.image')), _imgSrc = _imgObject.attr('src'), _backSrc = $(this).attr('rel'); $(this).attr('rel', _imgSrc); _imgObject.attr('src', _backSrc); return false; }); $('#type_2').before($('#type_3')); $('.type_list_unjs').removeClass('type_list_unjs'); $('.jcarousel-skin-collection').each(function () { if ($('li', this).length > 2) { $(this).jcarousel({ scroll: 2 }); } }) var _nabor = $('#typeSelector .current a').attr('rel') $('#nabor').attr('class', 'nabor_' + _nabor); $('#typeSelector a').click(function () { var _nabor = $(this).attr('rel'); $('#nabor').attr('class', 'nabor_' + _nabor); $('#typeSelector li').removeClass('current'); $(this).parents('li').addClass('current'); return false; }); { // титульная каталога var _timer = null, _count = $('#collections_list LI').length, _maxWidth = 500, _minWidth = (1000 - _maxWidth) / (_count - 1), _midWidth = 1000 / _count, _speed = 400; $('#collections_list LI').css({width: _midWidth}); $('#collections_list LI').hover(function () { clearTimeout(_timer); $('#collections_list LI').stop(); var _index = $('#collections_list LI').index(this); $('#collections_list LI').each(function (i) { $(this).animate({width: (_index == i ? _maxWidth : _minWidth)}, _speed); }) $('#collections_list .current').removeClass('current'); $(this).addClass('current'); }, function () { _timer = setTimeout(function () { $('#collections_list .current').removeClass('current'); $('#collections_list LI').animate({width: _midWidth}, _speed); }, 400); }); } { // popup каталога $('#popup .close, #popup .overlay').click(function () { $('#popup').fadeOut(); return false; }); var _setHeightOverlay = function () { return false; var _height = $('html').get(0).clientHeight > $('html').get(0).offsetHeight ? $('html').get(0).clientHeight : $('html').get(0).offsetHeight; $('#popup .overlay').height(_height); //$('#popup .image IMG').attr('src', ''); } $(window).resize(function () { if ($('#popup').is(':visible')) { _setHeightOverlay(); } }) $('.popupLink').click(function () { _setHeightOverlay(); var _image = $(this).attr('rel'), _parent = $(this).parents('li'), _article = $('.article', _parent).html(), _sizes = $('.sizes', _parent).html(), _descr = $('.descr', _parent).html(), _back = $('.back_big_image', _parent).html(); $('#popup .image IMG').load(function () { $('#popup').fadeIn(); }); $('#popup .image IMG').attr('src', _image); $('#popup .description h2').html(_article); $('#popup .sizes').html(_sizes); $('#popup .descr').html(_descr); if (_back) { $('#popup .switch') .show() .attr('rel', _back); } else { $('#popup .switch').hide(); } return false; }); } } { // Где купить if ($('select[name=country]').length) { $('select[name=country]').change(function () { $('select[name=city] option').each(function (i) { if (i > 0) { $(this).remove() } }); if ($(this).val()) { $.get(_link_shops, {action: 'getCityJson', country: $(this).val()}, function (data) { for(var key in data) { $('select[name=city]').append(''); } $('select[name=city]').val(_currCity); }, 'json'); } }); $('select[name=country]').val(_currCountry); $('select[name=country]').change(); } } $('tr:nth-child(odd)', $('.tbl')).addClass('odd'); $('.jcarousel-skin-history').jcarousel({ scroll: 3 }) $('a.popupLink').click(function(){ $('.popup').show(); return false; }) $('.popup .close').click(function(){ $('.popup').hide(); }) $(document).click(function (e) { if (!$(e.target).parents('.popup').length) { $('.popup .close').click(); } }); $('.shopsWrap').jScrollPane(); $('.contentWrap').jScrollPane(); if ($.browser.msie && $.browser.version == 6) { $('.mainNav a').hover(function(){ $(this).children('img').show(); },function(){ $(this).children('img').hide(); }) DD_belatedPNG.fix('.wrapper, .shadow, .action, .logo, .actionIn, .action .info, .description, .window .top, .window.middle, .window .bottom'); } $('.cat_href').click(function () { setTimeout(function () { $('.shopsWrap').jScrollPane(); $('.contentWrap').jScrollPane(); }, 1200); return false; }); });