var loader = 'загрузка...'; var is_show_loader = true; function Debug(filter) { txt = "category: "+filter.category; txt += "\nproducers: "+filter.producers.join(','); txt += "\nimp_producers: "+filter.imp_producers.join(','); txt += "\nisProdFilterActive: "+filter.isProdFilterActive; txt += "\nisProdMoreOpen: "+filter.isProdMoreOpen; alert(txt); } loadedProducers = {}; $(document).ready(function(){ $('#catalog .producer-link').click(function(){ this_obj = $(this); this_obj.parents('.level1').toggleClass('active'); var objGet = { c: goodsFilter.category, p: this_obj.attr('id'), get_type: 'goods' }; if(!loadedProducers[objGet.p]) { $.get('/include/get_content.php', objGet , function(data) { loadedProducers[objGet.p] = true; this_obj.parents('.level1').find('.level2-block').html(data); this_obj.parents('.level1').find('a.nyroModal').nyroModal(); $('#level1_'+objGet.p+' .level2 .name a').bind('click', function(){ $(this).parents('.level2').toggleClass('act'); return false; }); }); } return false; }); $('#catalog .region-link').click(function(){ this_obj = $(this); this_obj.parents('.level1').toggleClass('active'); return false; }); $('#catalog .button-close').click(function(){ $(this).parents('.level1').removeClass('active'); return false; }); }); function ToggleDirectGoodLink(obj) { var tag = obj.tagName.toLowerCase(); if(tag=='a') { $(obj).css('visibility','hidden'); $(obj).parent().find('input').css('visibility','visible').select(); } else if(tag=='input') { $(obj).css('visibility','hidden'); $(obj).parent().find('a').css('visibility','visible'); } } function checkData(objForm) { if (objForm.legal_name.value=='') { alert("Пожалуйста, укажите название организации."); objForm.legal_name.focus(); return false; } if (objForm.fio.value=='') { alert("Пожалуйста, укажите контактное лицо."); objForm.fio.focus(); return false; } if (!objForm.email.value.match(/^\s*[a-zA-Z0-9._-]+\@[^\s:,]+\.[^\s:,]+$/i)) { if(objForm.email.value=='') alert("Пожалуйста, укажите E-mail."); else alert("Пожалуйста, введите корректный E-mail адрес."); objForm.email.focus(); return false; } return true; } partitions_height = ''; function TogglePaymentType(objInput) { obj = $('#slide'); if(!partitions_height) partitions_height = obj.height(); // открытие/закрытие блока с разделами if(objInput.value=="1") obj.stop().animate({height: 0}, function() {$(this).css('display','none')}); else obj.stop().animate({height: partitions_height}); } function checkFeedbackData(d) { if (!d.fio.value.match(/\s*.+\s*/)) { alert("Пожалуйста, укажите ваше имя."); d.fio.focus(); return false; } if (!d.city.value.match(/\s*.+\s*/)) { alert("Пожалуйста, укажите город."); d.city.focus(); return false; } if (!d.message.value.match(/\s*.+\s*/)) { alert("Пожалуйста, введите текст сообщения."); d.message.focus(); return false; } if (!d.robotcode.value.match(/^\s*[0-9]+$\s*/)) { alert("Пожалуйста, введите цифры, указанные на картинке."); d.robotcode.focus(); return false; } return true; } // работа с coockies через JS function setCookie(name, value, expires, path, domain, secure) { //expires - дни if (expires) { var expireDate = new Date(); expireDate.setTime(expireDate.getTime() + 3600000*24*expires); } document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expireDate.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } // /работа с coockies через JS function RestorFilter() { p = getCookie('p'); if(p) goodsFilter.producers = p.split(','); p_imp = getCookie('p_imp'); if(p_imp) goodsFilter.imp_producers = p_imp.split(','); if(getCookie('is_f')=='1') goodsFilter.isProdFilterActive = 1; if(getCookie('is_m')=='1') goodsFilter.isProdMoreOpen = 1; } function ShowHideFilterReminder() { return true; if(goodsFilter.isProdFilterActive==false && goodsFilter.price.min==0 && goodsFilter.price.max==99999) filterReminder.slideUp(300); else filterReminder.slideDown(300); } function UpdateCookies(filter) { deleteCookie('p','/','.'+domain); deleteCookie('p_imp','/','.'+domain); deleteCookie('is_f','/','.'+domain); deleteCookie('is_m','/','.'+domain); if(filter.producers.length) setCookie('p',filter.producers.join(','),false,'/','.'+domain) if(filter.imp_producers.length) setCookie('p_imp',filter.imp_producers.join(','),false,'/','.'+domain) setCookie('is_f',(filter.isProdFilterActive?'1':'0'),false,'/','.'+domain) setCookie('is_m',(filter.isProdMoreOpen?'1':'0'),false,'/','.'+domain) } function ChangeProducersFilter(a) { objA = $(a); if(objA.attr('id').match(/^prod_/)) { p_id = objA.attr('id').replace(/^prod_/,''); if (objA.hasClass('active')) { goodsFilter.producers.push(p_id); } else { for(i=0; i