$(function() { $('#call_request1').find($('.radioblock input')).change(function() { $('#convenient_time').toggle(); }); /* $('#call_request1 #call_request-form1').submit(function(){ $(this).hide().siblings('.success_text').show(); });*/ $(document).ready(function() { $('#navleft .menu_main').html('Главная'); }); setTimeout(function() { $('.colorsWrapp').find('li:eq(0)').click(); }, 100); $('.colorsWrapp').each(function() { var colors_wrapp = $(this); $(this).find('li').click(function() { colors_wrapp.find('li').removeClass('active'); $(this).addClass('active'); var color_name = $(this).find('div').attr('id'); colors_wrapp.find('.colorView').attr('id', color_name); colors_wrapp.find('.colorView span').text(color_name); if ($(this).find('span').hasClass('dark')) { colors_wrapp.find('.colorView span').addClass('dark'); } else { colors_wrapp.find('.colorView span').removeClass('dark'); } }); }); $('.inpTtl.otkos').hover(function() { $(this).find('span').show(); $(this).find('em').css('border-bottom', 'none'); }, function() { $(this).find('span').hide(); $(this).find('em').css('border-bottom', 'dotted 1px'); }); $('.wood-type-img').click(function() { var current = $(this).index('.wood-type-img'); $('.wood-type-descr').hide(); $('.wood-type-descr:eq(' + current + ')').show(); }); $('.win-price-block').click(function() { $('.win-price-block').removeClass('active'); $(this).addClass('active'); }); $('.win-price-block').on('click', function() { var item_id = $(this).data('item_id'), series = $(this).find('.win-price-info span').text(), variant = $(this).data('variant'), width = $(this).data('width'), height = $(this).data('height'), currentImage = $(this).css('backgroundImage'), currentPrice = $(this).find('.win-price-label').html(), currentInfo = $(this).find('.win-price-info').html(), currentAdd = $(this).find('.win-price-additional').html(); $('#callmaster-popup #win-price-block').removeAttr('class'); $('#callmaster-popup #win-price-block').addClass('win-price-block'); $('#callmaster-popup #win-price-block').css('backgroundImage', currentImage); $('#callmaster-popup .win-price-label').html(currentPrice); $('#callmaster-popup .win-price-info').html(currentInfo); $('#callmaster-popup .win-price-additional').html(currentAdd); $('#callmaster-popup .win-price-additional').find('i').remove(); $('#callmaster-popup .win-price-additional').find('.callmaster').remove(); $('#callmaster-popup input[name="form_data[id]"]').val(item_id); $('#callmaster-popup input[name="form_data[variant]"]').val(series + ' - ' + variant + ' ' + width + ' x ' + height); }); $('.benefits li > span').click(function(event) { event.preventDefault(); var parent_width = $(this).closest('.benefits').width(), current_left = $(this).parent().position().left, next_width = $(this).parent().find('.benefits-info').width(); $('.benefits-info').hide(); if (parent_width < (current_left + next_width + 25)) { $(this).parent().addClass('reverse'); } else { if ($(this).parent().hasClass('reverse')) $(this).parent().removeClass('reverse'); } $(this).parent().find('.benefits-info').show(); }); $('.benefits-info .close').click(function(event) { event.preventDefault(); $(this).parent().hide(); }); }); $(document).ready(function(){ $(".btn-consultant").hover(function(){ $(".conslink").stop().animate({"margin-left": 0}, "slow", function(){ $(".btn-consultant").addClass("active"); }); },function(){ $(".conslink").stop().animate({"margin-left": "-184px"}, "slow", function(){ $(".btn-consultant").removeClass("active"); }); }); /*показ и скрытие окна авторизации*/ var al = $('#enterlogin'); var div = $('#registr'); var main = $('#backregistr'); var authWidth = $(window).width(); var authHeight = $(window).height(); authWidth = (authWidth - 676)/2 authHeight = (authHeight - 592)/2; checkLogin(); $('#popupClose').click(function(){ hideDiv(); return false; }); al.click(function(){ showDiv(); }); main.click(function(){ hideDiv(); }); function showDiv(){ al.blur(); main.add(div).css({display: 'block'}); div.show(); //div.animate({opacity: '1'}, 'fast'); $('#login').focus(); } function hideDiv(){ //div.animate({opacity: '0'}, 'fast', div.hide(); main.add(div).css({display: 'none'}); /*function(){ main.add(div).css({display: 'none'}); });*/ $('#loader').hide(); $('#notif').fadeOut(50); } $(div).css({ top: authHeight + 20, left: authWidth }); /*подгоняем размер области затенения при авторизации и центруем окно авторизации*/ $(window).bind("resize", function(){ main.css({ height: $('#all').height(), width: $(window).width() }); }); $(window).resize(); /*проверка текстовых полей*/ $('#search').textCheck({text: 'поиск'}); $('#search').keypress(function(eventObject){ $(this).next().attr('disabled',''); },function(){ $(this).next().attr('disabled','disabled'); }); $('#login').keypress(function(eventObject){ // $('#formauth #send').attr('disabled',''); $('#pass').keypress(function(eventObject){ if($('#login').val() == ''){ $('#formauth #send').attr('disabled','disabled'); } if($('#pass').val() == ''){ $('#formauth #send').attr('disabled','disabled'); } $('#formauth #send').attr('disabled',''); }); }); /*показ слайдов окна*/ var index = 0; var thumbs = $('#thumbs a'); var slides = $('#slides div'); for (i = 0; i < thumbs.length; i++){ $(thumbs[i]).addClass("t"+i); $(slides[i]).addClass("i"+i); } thumbs.click(sift); show(index); setInterval(sift, 5000); function sift(){ if ($(this).attr('class')){ $(this).blur(); index = parseInt($(this).attr('class').substr(1, $(this).attr('class').length)); } else { if (index < (thumbs.length-1)){ index += 1 ; } else { index = 0 } } show(index); return false; } function show(num){ slides.hide(); $(".i" + num).fadeIn(600); } /*эмулируем наведение на ссылку у баннеров*/ var elem = $('.banner'); elem.hover(function(){ $('a[href='+$(this).parent().attr('href')+']').addClass('hover'); }, function(){ $('a[href='+$(this).parent().attr('href')+']').removeClass('hover'); }); $('#navleft a.menuLinks').each(function(){ if ($(this).next('ul').length > 0) { $(this).click(function(){ $(this).next('ul').slideToggle(400); return false; }); } }); $('#navleft a.lodjii').click(function(){ var href = $(this).next('ul').find('li:first a').attr('href'); if (href == undefined) window.location.reload() else window.location.href = href; return false; }) /* $('#navleft a').each(function(){ if ($(this).next('ul').length > 0) { $(this).click(function(){ $(this).next('ul').slideToggle(400); return false; }); } }); */ }); $(function() { //scrollpane parts var scrollPane = $(".scroll-pane"), scrollContent = $(".scroll-content"); //build slider var scrollbar = $(".scroll-bar").slider({ slide: function(event, ui) { if (scrollContent.width() > scrollPane.width()) { scrollContent.css("margin-left", Math.round( ui.value / 100 * (scrollPane.width() - scrollContent.width()) ) + "px"); } else { scrollContent.css("margin-left", 0); } } }); //append icon to handle var handleHelper = scrollbar.find(".ui-slider-handle") .mousedown(function() { scrollbar.width(handleHelper.width()); }) .mouseup(function() { scrollbar.width("100%"); }) .append("") .wrap("
").parent(); //change overflow to hidden now that slider handles the scrolling scrollPane.css("overflow", "hidden"); //size scrollbar and handle proportionally to scroll distance function sizeScrollbar() { var remainder = scrollContent.width() - scrollPane.width(); var proportion = remainder / scrollContent.width(); var handleSize = scrollPane.width() - (proportion * scrollPane.width()); scrollbar.find(".ui-slider-handle").css({ width: handleSize, "margin-left": -handleSize / 2 }); handleHelper.width("").width(scrollbar.width() - handleSize); } //reset slider value based on scroll content position function resetValue() { var remainder = scrollPane.width() - scrollContent.width(); var leftVal = scrollContent.css("margin-left") === "auto" ? 0 : parseInt(scrollContent.css("margin-left")); var percentage = Math.round(leftVal / remainder * 100); scrollbar.slider("value", percentage); } //if the slider is 100% and window gets larger, reveal content function reflowContent() { var showing = scrollContent.width() + parseInt(scrollContent.css("margin-left"), 10); var gap = scrollPane.width() - showing; if (gap > 0) { scrollContent.css("margin-left", parseInt(scrollContent.css("margin-left"), 10) + gap); } } //change handle position on window resize $(window).resize(function() { resetValue(); sizeScrollbar(); reflowContent(); }); //init scrollbar size setTimeout(sizeScrollbar, 10);//safari wants a timeout //Проверка на заполнение обязательного поля в форме калькулятора $('input.ffrevise').blur(function() { if($(this).val().length == 0){ $(this).addClass('fferror').after('Поле должно быть заполнено!'); $('submit').disabled = true; } }); $(':input[type="text"]').focus(function(){ $(this).removeClass('fferror').next('span').remove(); $('submit').disabled = false; }); //