function load_yandex_api() { var script = document.createElement('script'); script.src = "http://api-maps.yandex.ru/2.0-stable/?load=package.standard&lang=ru-RU"; document.getElementsByTagName('head')[0].appendChild(script); start_yandex_api() } function start_yandex_api() { if (typeof ymaps == 'undefined') { window.setTimeout(start_yandex_api, 1000); } else { try { ymaps.ready( function() { isUkraine=(ymaps!==undefined && ymaps.geolocation!==undefined && ymaps.geolocation['country']!==undefined && ymaps.geolocation['country']=='Украина')?true:false; if (isUkraine){ $.get("/single.page.ajax", {action:"getTargetWebsite", siteId: siteId}, function(data){ if (data.site != null && data.site != ''){ location.href = data.site; } }, 'json'); } if(ymaps!==undefined && ymaps.geolocation!==undefined && ymaps.geolocation['city']!==undefined){ $('#cbaddress').val(ymaps.geolocation['city']+"(определено автоматически)"); } }); } catch(err){} } } $(document).ready(function() { setTimeout(load_yandex_api, 3000); if($(".thumnails img").length<=6) $(".thumnails img").addClass('big'); $(".thumnails img").mouseover(function(event) { event.preventDefault(); $(".thumnails img").removeClass('active'); $(this).addClass('active'); $('.image').attr('src',$(this).attr('src')); }); $('.image').click(function(event) { event.preventDefault(); $('.modal_window').css('width','inherit').css('top',90+$(document).scrollTop()); var modalImg=$(this).clone(); modalImg.appendTo('.modal_content'); $('.modal').show(); modalImg.load(function(){ $('.modal_window').css('left',($(document).width()-$('.modal_window').outerWidth())/2); }); }); $("#conf_link").click(function(event) { $(".modal_close").click(); event.preventDefault(); $('.modal_window').css('top',90+$(document).scrollTop()); $('.conf_text').appendTo('.modal_content'); $('.modal').fadeIn('fast'); }); $("#about_us").click(function(event) { $(".modal_close").click(); event.preventDefault(); $('.modal_window').css('top',90+$(document).scrollTop()); $('.about_us_text').appendTo('.modal_content'); $('.modal').fadeIn('fast'); }); $("#about_delivery").click(function(event) { $(".modal_close").click(); event.preventDefault(); $('.modal_window').css('top',90+$(document).scrollTop()); $('.about_delivery_text').appendTo('.modal_content'); $('.modal').fadeIn('fast'); }); $("#guranites").click(function(event) { $(".modal_close").click(); event.preventDefault(); $('.modal_window').css('top',90+$(document).scrollTop()); $('.guranites_text').appendTo('.modal_content'); $('.modal').fadeIn('fast'); }); $("#faq").click(function(event) { $(".modal_close").click(); event.preventDefault(); $('.modal_window').css('top',90+$(document).scrollTop()); $('.faq_text').appendTo('.modal_content'); $('.modal').fadeIn('fast'); }); $("#our_benefits").click(function(event) { $(".modal_close").click(); event.preventDefault(); $('.modal_window').css('top',90+$(document).scrollTop()); $('.our_benefits_text').appendTo('.modal_content'); $('.modal').fadeIn('fast'); }); $("#order_show_button").click(function(event) { $(".modal_close").click(); event.preventDefault(); $('.modal_window').css('top',90+$(document).scrollTop()); $('.order_content').appendTo('.modal_content'); $('.modal').fadeIn('fast'); }); $(".modal_close").click(function(event) { event.preventDefault(); $(".modal").fadeOut(); $('.modal_window').css('width',''); $('.order_content').appendTo('.order_form'); $('.conf_text').appendTo('.conf_content'); $('.about_us_text').appendTo('.conf_content'); $('.about_delivery_text').appendTo('.conf_content'); $('.guranites_text').appendTo('.conf_content'); $('.faq_text').appendTo('.conf_content'); $('.our_benefits_text').appendTo('.conf_content'); if(open_modal_object) $(open_modal_object).appendTo(open_modal_object_parent); $('.modal .image').remove(); }); $(".modal_overlay").click(function(event) { event.preventDefault(); $(".modal").fadeOut(); $('.modal_window').css('width',''); $('.order_content').appendTo('.order_form'); $('.conf_text').appendTo('.conf_content'); $('.about_us_text').appendTo('.conf_content'); $('.about_delivery_text').appendTo('.conf_content'); $('.guranites_text').appendTo('.conf_content'); $('.faq_text').appendTo('.conf_content'); $('.our_benefits_text').appendTo('.conf_content'); if(open_modal_object) $(open_modal_object).appendTo(open_modal_object_parent); $('.modal .image').remove(); }); var order_content=$('.order_content,.order_content_inline'); $('input[name=fio]',order_content).focus(function () { inputs_event(this, order_content, 'focus', 'ФИО', 4); }); $('input[name=fio]',order_content).blur(function () { inputs_event(this, order_content, 'blur', 'ФИО', 4); }); $('input[name=fio]',order_content).keyup(function() { inputs_event(this, order_content, 'keyup', 'ФИО', 4); }); $('input[name=email]',order_content).focus(function () { inputs_event(this, order_content, 'focus', 'email@email.com', 5); }); $('input[name=email]',order_content).blur(function () { inputs_event(this, order_content, 'blur', 'email@email.com', 5); }); $('input[name=email]',order_content).keyup(function() { inputs_event(this, order_content, 'keyup', 'email@email.com', 5); }); $('input[name=phone]',order_content).focus(function () { inputs_event(this, order_content, 'focus', '+7(___) ___ __ __', 5); }); $('input[name=phone]',order_content).blur(function () { inputs_event(this, order_content, 'blur', '+7(___) ___ __ __', 5); }); $('input[name=phone]',order_content).keyup(function() { inputs_event(this, order_content, 'keyup', '+7(___) ___ __ __', 5); }); $('input[name=address]',order_content).focus(function () { inputs_event(this, order_content, 'focus', 'ул.Юннатов, д.1, кв.2', 5); }); $('input[name=address]',order_content).blur(function () { inputs_event(this, order_content, 'blur', 'ул.Юннатов, д.1, кв.2', 5); }); $('input[name=address]',order_content).keyup(function() { inputs_event(this, order_content, 'keyup', 'ул.Юннатов, д.1, кв.2', 5); }); $('select[name=city]',order_content).focus(function () { inputs_event(this, order_content, 'focus', 'Регион и способ доставки', 0); }); $('select[name=city]',order_content).blur(function () { inputs_event(this, order_content, 'blur', 'Регион и способ доставки', 0); }); $('select[name=city]',order_content).change(function() { inputs_event(this, order_content, 'change', 'Регион и способ доставки', 0); }); $('select[name=payment_type]',order_content).focus(function () { inputs_event(this, order_content, 'focus', '', 0); }); $('select[name=payment_type]',order_content).blur(function () { inputs_event(this, order_content, 'blur', '', 0); }); $('select[name=payment_type]',order_content).change(function() { inputs_event(this, order_content, 'change', '', 0); }); $('select[name=delivery_type]',order_content).focus(function () { inputs_event(this, order_content, 'focus', '', 0); }); $('select[name=delivery_type]',order_content).blur(function () { inputs_event(this, order_content, 'blur', '', 0); }); $('select[name=delivery_type]',order_content).change(function() { inputs_event(this, order_content, 'change', '', 0); }); resize_modal() resize_social(); resize_menu(); resize_phone(); resize_timer(); $(window).resize(function() { resize_phone(); resize_timer(); resize_social(); resize_menu(); resize_modal(); }); start_timer(); }); var open_modal_object=undefined; var open_modal_object_parent=undefined; function open_modal(name) { $(".modal_close").click(); $('.modal_window').css('top',90+$(document).scrollTop()); open_modal_object_parent=$(name).parent(); open_modal_object=$(name); open_modal_object.appendTo('.modal_content'); $('.modal').fadeIn('fast'); } function resize_modal(){ $('.modal_content').css('left',($(window).width()/2-261)+$(document).scrollTop()); $('.modal_window').css('top',90+$(document).scrollTop()); $('.modal_content').css('left',$(window).width()/2-261); } function resize_menu(){ if($(window).width()<=1024){ $('.header_menu td a').addClass('small'); }else{ $('.header_menu td a').removeClass('small'); } } function resize_social(){ if($(window).width()<1400){ $('.social').hide(); }else{ $('.social').show(); } } function resize_timer(){ if($(".timer").offset().left<0){ $(".timer").css('left','100px').css('top','145px'); }else{ $(".timer").css('left','').css('top',''); } } function resize_phone(){ try { if($(".phone_container").length==0) return; if($(window).width()<=1300){ $(".phone_container").css('right','50px').css('top','-50px'); } else{ $(".phone_container").css('right','').css('top',''); if($(".phone_container").offset().left+$(".phone_container").outerWidth()<$(window).width()){ $(".phone_container").css('right',''); }else{ $(".phone_container").css('right','-163px'); } } }catch (exception_var) { } } $(document).ready(function(){ $('.bxslider').bxSlider(); }); var dbt=new Date(new Date().getTime() + (2 * 24 * 60 * 60 * 1000)); var finisDate = (dbt.getMonth()+1)+"/"+dbt.getDate()+"/"+dbt.getFullYear()+" 5:00 AM"; function start_timer() { var finisTime = new Date(finisDate); var nowTime = new Date(); var diffTime = new Date(finisTime-nowTime); var finishSeconds = Math.floor(diffTime.valueOf()/1000); var days=parseInt(finishSeconds/86400); var hours = parseInt(finishSeconds/3600)%24; var minutes = parseInt(finishSeconds/60)%60; var seconds = finishSeconds%60; if (hours < 10) hours = "0" + hours; if (minutes < 10) minutes = "0" + minutes; if (seconds < 10) seconds = "0" + seconds; $(' .timer .digits').html(days+":"+hours + ":" + minutes + ":" + seconds); $(' .timer .text').html("Осталось: дней:"+days+", часов:"+hours + ", минут:" + minutes + " и секунд: " + seconds); var date = dbt.getDate(); if (date < 10) date = '0' + date; var month = dbt.getMonth() + 1; if (month < 10) month = '0' + month; var year = dbt.getFullYear(); $('.action_date_end').html((date)+"."+(month)+"."+year); setTimeout(start_timer, 1000); } function inputs_event(object, order_content, action, default_text, min_length) { if(action=='focus') { if($(object).val()==default_text) $(object).val(''); } if(action=='blur') { inputs_event(object, order_content, 'keyup', default_text, min_length); if($(object).val()==default_text || $(object).val()=='') $(object).val(default_text); } if(action=='keyup' || action=='change') { if($(object).val()!=default_text && $(object).val()!='' && $(object).val().length>min_length){ $(object).addClass('filled').removeClass("error"); }else $(object).removeClass('filled'); /*show слои от заполненных правильно*/ if($('input[name=fio]',order_content).hasClass('filled') && $('input[name=phone]',order_content).hasClass('filled') && $('input[name=address]',order_content).hasClass('filled') && $('select[name=city]',order_content).hasClass('filled') && $('select[name=payment_type]',order_content).hasClass('filled') && $('select[name=delivery_type]',order_content).hasClass('filled') ) { // $('#order_send_button').removeClass('disabled'); // $('.city_label',order_content).slideDown(); // $('.payment_type_label',order_content).slideDown(); } else { // $('#order_send_button').addClass('disabled'); if($('input[name=fio]',order_content).hasClass('filled') && $('input[name=phone]',order_content).hasClass('filled') && $('select[name=city]',order_content).hasClass('filled') ) { // $('.city_label',order_content).slideDown(); // $('.payment_type_label',order_content).slideDown(); } else { if($('input[name=fio]',order_content).hasClass('filled') && $('input[name=phone]',order_content).hasClass('filled')) { // $('.city_label',order_content).slideDown(); // $('.payment_type_label',order_content).slideUp(); } else { // $('.city_label',order_content).slideUp(); // $('.payment_type_label',order_content).slideUp(); } } } } } $(document).ready(function(){ if($(".timer").offset().left<0){ $(".timer").css('left','56px').css('top','145px'); }else{ $(".timer").css('left','').css('top',''); } }); $(window).resize(function() { if($(".timer").offset().left<0){ $(".timer").css('left','56px').css('top','145px'); }else{ $(".timer").css('left','').css('top',''); }; }); $(document).ready(function(){ $('#cb_order_send_button').click(function(){ callingBack(true); return false; }); $('#cb_order_send_button2').click(function(){ callingBack(false); return false; }); });