$(function(){ $(".moreless.more").click(function(){ $(this).addClass('inactive'); $(".lastPart").fadeIn(); $(".moreless.less").removeClass('inactive'); return false; }); $(".moreless.less").click(function(){ $(this).addClass('inactive'); $(".lastPart").fadeOut(); $(".moreless.more").removeClass('inactive'); return false; }); $(".ml.more").click(function(){ $(this).addClass('inactive'); $(".lastPart2").fadeIn(); $(".ml.less").removeClass('inactive'); return false; }); $(".ml.less").click(function(){ $(this).addClass('inactive'); $(".lastPart2").fadeOut(); $(".ml.more").removeClass('inactive'); return false; }); }); var isIOS; var tmpTitle; var selectIsFocused=0; var sAddr = new Array(); var paddingAdded = 'no'; var isCategory = 0; var isjquery=1; var cbTO; var nowMoving=0; sAddr['jAddress']='';sAddr['jHouse']='';sAddr['jCorpus']='';sAddr['jApt']='';sAddr['jLevel']='';sAddr['jDomofon']=''; // sAddr['jMetro']=''; function sendCB(){ err=0; $("#cbName").removeClass('red'); $("#cbPhone").removeClass('red'); cName = $("#cbName").attr('value'); cPhone = $("#cbPhone").attr('value'); if(cPhone==''){ $("#cbPhone").addClass('red'); $("#cbPhone").focus(); err=1; } if(cName==''){ $("#cbName").addClass('red'); $("#cbName").focus(); err=1; } if(err==0){ CBdone(); } return false; } function isAppleDevice(){ return ( (navigator.userAgent.toLowerCase().indexOf("ipad") > -1) || (navigator.userAgent.toLowerCase().indexOf("iphone") > -1) || (navigator.userAgent.toLowerCase().indexOf("ipod") > -1) ); } function canIHide(e) { if($('.catalog').is(":hover")){ return false; } return true; } function openCatalog(){ if(nowMoving==0){ nowMoving=1; setTimeout(function(){ nowMoving=0; },400); // открываем меню по клику $(".catalogButtonMinBg").fadeOut(); $(".catalogButtonHandler").removeClass('closed'); $(".catalogContent").slideDown('fast'); $(".catalogText").animate({paddingLeft: '55'},300); } } function closeCatalog(){ if(nowMoving==0){ // закрываем меню по клику nowMoving=1; setTimeout(function(){ nowMoving=0; },400); $(".catalogButtonMinBg").fadeIn(); $(".catalogButtonHandler").addClass('closed'); $(".catalogContent").slideUp('fast'); $(".catalogText").animate({paddingLeft: '20'},300); } } function addressProcessor(that){ sAddr[$(that).attr('id')] = $(that).val(); var adr1=''; var adr2=''; var adr3=''; var adr4=''; var adr5=''; var adr6=''; // var adr7=''; if(sAddr['jAddress']){adr1=sAddr['jAddress'];} if(sAddr['jHouse']){adr2=', д.'+sAddr['jHouse'];} if(sAddr['jCorpus']){adr3=' к.'+sAddr['jCorpus'];} if(sAddr['jApt']){adr4=', кв.'+sAddr['jApt'];} if(sAddr['jLevel']){adr5=', этаж '+sAddr['jLevel'];} if(sAddr['jDomofon']){adr6=', Домофон '+sAddr['jDomofon'];} // if(sAddr['jMetro']){adr7=', м.'+sAddr['jMetro'];} // $('textarea.address_elem').val(sAddr['jAddress']+' д.'+sAddr['jHouse']+' '+sAddr['jCorpus']+' кв.'+sAddr['jApt']+' эт. '+sAddr['jLevel']+' домофон: '+sAddr['jDomofon']+' м.'+sAddr['jMetro']); // $('textarea.address_elem').val(adr1+adr2+adr3+adr4+adr5+adr6+adr7); $('textarea.address_elem').val(adr1+adr2+adr3+adr4+adr5+adr6); //
// } function closeIframe() { $(".frameBase").remove(); } function contentPadding(){ if(paddingAdded=='no') { if($(window).width()<1162) { // $(".rightCol").css('padding-right','15px'); paddingAdded='yes'; } } else { if($(window).width()>=1162){ $(".rightCol").css('padding-right','0'); paddingAdded='no'; } } // $(".footer").html($(window).width()); } function burnDiscount(endy) { var rt; if(!endy || endy==undefined || endy==''){ $(".discountEndSoon").hide(); return false; } var countDownDate = new Date(endy).getTime(); var now = new Date().getTime(); var distance = countDownDate - now; var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); if(days>0 && days<30){ rt = 'Промокод сгорает через '; rt = rt+' '+days+' '+declOfNum(days, ['день', 'дня', 'дней']); if(hours>0){ rt = rt+' '+hours+' '+declOfNum(hours, ['час', 'часа', 'часов']); } }else if(days<30){ rt = 'Промокод сгорает через '; if(hours>0){ rt = rt+' '+hours+' '+declOfNum(hours, ['час', 'часа', 'часов']); } if(minutes>0){ rt = rt+' '+minutes+' '+declOfNum(minutes, ['минуту', 'минуты', 'минут']); rt = rt+' '+seconds+' '+declOfNum(seconds, ['секунду', 'секунды', 'секунд']); }else{ rt = rt+' '+seconds+' '+declOfNum(seconds, ['секунду', 'секунды', 'секунд']); } } if(rt!=undefined){ $(".discountEndSoon").slideDown(); if(distance > 0){ $(".discountEndSoon").html(rt); }else{ $(".discountEndSoon").html('Срок действия скидки истёк'); /* $.ajax({ type: 'POST', url: "/json/cart.php?action=removeDiscount&output=json", success: function(data){ $("#promocode").val(''); $("#changePromo").html(''); $(".discountInfo").hide().removeClass('showed'); $("#promoButton").show(); refreshCart(data); clearInterval(x); }, dataType: "json" }); */ } } } function declOfNum(number, titles) { cases = [2, 0, 1, 1, 1, 2]; return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; } Number.prototype.formatMoney = function(c, d, t){ var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "." : d, t = t == undefined ? "," : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); }; Number.prototype.format = function(n, x) { var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\.' : '$') + ')'; return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$& '); }; function addZeroz(int,total){ if(int.length