$(window).load(function() {
// страница "Коллекция"
$('div.carousel').jCarouselLite({btnNext: ".a-right", btnPrev: ".a-left", circular: false}).css('width', parseInt($('.carousel').width()) - 15);
});
$(function() {
if(window.location.pathname == '/') $('#home').addClass('selected');
var gtext;
//Главная страница
$('.banner').click(function() {window.location.href = $(this).children('a').attr('href');});
// отключаем анимация для банеров в ие6
if(!/MSIE 6.0/.test(navigator.userAgent)) {
$('.banner').hover(
function () {
$(this).animate({opacity: .3}, 200, "easeInSine", function() {
$(this).addClass('hover');
$(this).animate({opacity: .9}, 200, "easeInSine", function() {});
});
},
function () {
$(this).animate({opacity: .3}, 200, "easeInSine", function() {
$(this).removeClass('hover');
$(this).animate({opacity: .9}, 200, "easeInSine", function() {});
});
});
}
//////////////////////////////////////
// Страница "Коллекция"
$('div.element').hover(function() {$(this).children('div.descr').fadeIn(800);}, function() {$(this).children('div.descr').fadeOut(300);});
$('div.descr').live('click', function() {
window.location.href = $(this).parent('div.element').find('a').attr('href');
return false;
});
var xcatalog = new fConnector('catalog');
// Подбор кухни на странице "Коллекция"
$('div.menu2 > ul > li').hover(
function() {
$(this).find('a.podbor').addClass('selected');
$(this).find('ul').css('left', $(this).offset().left - $('div.menu2').offset().left).stop(true, true).slideDown();
},
function() {
$(this).find('a.podbor').removeClass('selected');
$(this).find('ul').slideUp();
}
);
$('#fasad a, #model a, #sort-price a').live('click', function() {
var param = $($(this).parents('ul')[0]).attr('id');
switch(param) {
case 'model':
$('#model a.selected, #fasad a.selected').removeClass('selected');
xcatalog.execute({getFasads:{model:$(this).attr('id')}})
if(xcatalog.result.fasads) {
$('#fasad').html('');
$.each(xcatalog.result.fasads, function(i) {
$('#fasad').append('
' + xcatalog.result.fasads[i].Name + '');
});
}
else {
$('#fasad').html('Пусто');
}
$('#model-text').text($(this).text());
$('#fasad-text').text('Фасад кухни');
break;
case 'fasad':
$('#fasad a.selected').removeClass('selected');
$('#fasad-text').text($(this).text());
break;
case 'sort-price':
$('#sort-price a.selected').removeClass('selected');
$('#price-text').text($(this).text());
break;
}
$(this).addClass('selected');
var sort = 'asc'
if($('#sort-price a.selected').length) {
sort = $('#sort-price a.selected').attr('rel');
}
$('div.carousel').animate({opacity:0.1}, 'normal', '', function() {
xcatalog.execute({search:{inchilds:[$('#model a.selected').attr('id'), $('#fasad a.selected').attr('id')], sort:sort}})
if(xcatalog.result.objs) {
$('div.carousel').html(xcatalog.result.objs);
$('div.element').hover(function() {$(this).children('div.descr').fadeIn(800);}, function() {$(this).children('div.descr').fadeOut(300);});
if($('#carousel > li').length > 3) {
$('.a-right, .a-left').removeClass('disabled');
$('#carousel').parent().jCarouselLite({btnNext: ".a-right", btnPrev: ".a-left", circular: false})
.css('width', parseInt($('.carousel').width()) - 15)
.css('visibility', 'visible');
}
else if($('#carousel > li').length <= 3) {
$('#carousel').parent().jCarouselLite({btnNext: ".a-right", btnPrev: ".a-left", circular: false})
.css('width', parseInt($('.carousel').width()) - 15)
.css('visibility', 'visible');
$('.a-right, .a-left').addClass('disabled');
}
$('div.carousel').animate({opacity:1}, 'slow');
}
});
});
// Обзор кухни
if($('#bone').text()){
$('ul.h-menu > li.last').text($('#bone').text()); // добавляем название кухни в градусник
}
$('#descr-to').html($('#descr-from').html());
// презентация
$('#slideshow').cycle({fx: 'fade'}); // choose your transition type, ex: fade, scrollUp, shuffle, etc...
$('#info, #uhod').live('click', function() {
var self = $(this);
switch($(this).attr('id')) {
case 'info':
if(!$('#block-info').is(':visible')) {$('#block-uhod').fadeOut('slow', function() {$('#block-info').fadeIn('slow');});}
break;
case 'uhod':
if(!$('#block-uhod').is(':visible')) {$('#block-info').fadeOut('slow', function() {$('#block-uhod').fadeIn('slow');});}
break;
}
});
$('#show-gallery').click(function() {
$('#block-info, #block-uhod').fadeOut('slow');
$('.v-menu').animate({ 'right' : "-=250px"})
$('.gallery').animate({ 'right' : "+=250px"})
$('#back').attr('rel', 'rgallery').fadeIn();
var f = $('.carousel-gal ul > li:eq(3) > a');
var href = f.addClass('selected').attr('rel');
var descr = f.next().html();
gtext=$('.about-i1').html();
$('#wrap-big-pic-shiftzoom').animate({opacity:0}, 'slow', function() {
shiftzoom.remove(this);
$('#slideshow').animate({opacity:0}, 'normal', function() {
$('#wrap-big-pic-shiftzoom').html('')
.find('#big-pic-shiftzoom').bind('load', function() {
$(this).fadeIn('normal')
if($.browser.msie){
shiftzoom.defaultOverview = false;
}
shiftzoom.add(this,{zoom:0});
$('#descr-to').html(descr)
$('#wrap-big-pic-shiftzoom').animate({opacity:1}, 'slow');
}).attr('src', href);
});
});
return false;
});
$('#show-accessories').click(function() {
$('#block-info, #block-uhod').fadeOut('slow');
$('.v-menu').animate({ 'right' : "-=250px"})
$('.accessories').animate({ 'right' : "+=250px"})
$('#back').attr('rel', 'raccessories').fadeIn();
return false;
});
$('#show-color').click(function() {
$('#block-info, #block-uhod').fadeOut('slow');
$('.v-menu').animate({ 'right' : "-=250px"})
$('.color').animate({ 'right' : "+=250px"})
$('#back').attr('rel', 'rcolor').fadeIn();
var ff = $('#rfasad > li > a:eq(0)')
ff.addClass('selected');
var part1 = ff.attr('rel');
var regexp = /(\w|[-.])+$/
part1 = regexp.exec(part1)
part1 = part1[0].split('.');
im=$('#variants').val() + part1[0] + '.jpg';
filename ='/image.php/'+im+'?image='+im+'&outwatermark=/media/watermark.png&wposition=center-center-2';
$('#wrap-big-pic').animate({opacity:0}, 'slow', function() {
$('#slideshow').animate({opacity:0}, 'normal');
$('img').attr('id', 'big-pic');
$('#wrap-big-pic').html('').find('img').show().attr('src', filename).bind('load', function() {
$('#wrap-big-pic').show().animate({opacity:1}, 'normal');
});
});
return false;
});
$('#back').click(function() {
$('.v-menu').animate({ 'right' : "+=250px"})
if($(this).attr('rel') == 'rcolor')
$('#' + $(this).attr('rel')).animate({ 'right' : "-=250px"});
else
$('#' + $(this).attr('rel')).animate({ 'right' : "-=250px"});
$('.carousel-gal ul > li > a.selected').each(function() {$(this).removeClass('selected');})
$('#items').fadeOut();
$('.about-i1').html(gtext);
$(this).fadeOut();
$('#wrap-big-pic').fadeOut('normal', function() {$('#slideshow').animate({opacity:1}, 'normal');})
$('#wrap-big-pic-shiftzoom').animate({opacity:0}, 'normal');
return false;
});
$('#raccessories-inner > ul > li > a').click(function() {
$('#raccessories-inner > ul > li > a.selected').each(function() {$(this).removeClass('selected')});
$(this).addClass('selected');
xcatalog.execute({getAccessoriesItems : {id : $('#raccessories-inner > ul > li > a.selected').attr('rel')}});
if(xcatalog.result.items) {
$('#items').fadeOut('slow', function() {
$(this).html(xcatalog.result.items).fadeIn('slow');
$('a[rel=colorbox]').colorbox();
});
}
return false;
});
$('#rfasad > li > a').click(function() {
$('#rfasad > li > a.selected').removeClass('selected');
$(this).addClass('selected');
var part1 = $(this).attr('rel');
var regexp = /(\w|[-.])+$/
part1 = regexp.exec(part1)
part1 = part1[0].split('.');
im=$('#variants').val() + part1[0] + '.jpg';
filename ='/image.php/'+im+'?image='+im+'&outwatermark=/media/watermark.png&wposition=center-center-2';
$('#wrap-big-pic').animate({opacity:0}, 'slow', function() {
$('#slideshow').animate({opacity:0}, 'normal');
$('img').attr('id', 'big-pic');
$('#wrap-big-pic').html('').find('img').show().attr('src', filename).bind('load', function() {
$('#wrap-big-pic').show().animate({opacity:1}, 'normal');
});
});
return false;
});
$('.pic-mid table td h3').each(function(){$('> a', this).attr('href', $('> a', this).attr('href').replace(/%7E/ig, '~'));});
});