// ################################################################################################## // Скролл вверх и копирайт // ################################################################################################## $(document).ready(function(){ $(window).scroll(function () {if ($(this).scrollTop() > 0) {$('#scroller').fadeIn();} else {$('#scroller').fadeOut();}}); $('#scroller').click(function () {$('body,html').animate({scrollTop: 0}, 400); return false;}); $("#lexmor").html('web-программинг: lexmor'); }); // ################################################################################################## // Настройки colorbox // ################################################################################################## jQuery.extend(jQuery.colorbox.settings, { current: "изображение {current} из {total}", previous: "назад", next: "вперёд", close: "закрыть", xhrError: "Не удалось загрузить содержимое.", imgError: "Не удалось загрузить изображение.", slideshowStart: "начать слайд-шоу", slideshowStop: "остановить слайд-шоу" }); // ################################################################################################## // Функция создания COOKIE // ################################################################################################## jQuery.cookie = function (key, value, options) { if (arguments.length > 1 && (value === null || typeof value !== "object")) { options = jQuery.extend({}, options); if (value === null) { options.expires = -1; } if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } return (document.cookie = [ encodeURIComponent(key), '=', options.raw ? String(value) : encodeURIComponent(String(value)), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } options = value || {}; var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;}; // ################################################################################################## // Функция ограничения кол-ва вводимых символов // ################################################################################################## jQuery.fn.maxlength = function(options) { var settings = jQuery.extend({ maxChars: 10, infotext: 'осталось символов'}, options); return this.each(function() { var me = $(this); var l = settings.maxChars; me.bind('keydown keypress keyup',function(e) { if(me.val().length>settings.maxChars) me.val(me.val().substr(0,settings.maxChars)); l = settings.maxChars - me.val().length; me.next('div').html('...' + settings.infotext + ': ' + l); }); me.after('
...' + settings.infotext + ': ' + settings.maxChars + '
'); }); }; // ################################################################################################## // Кеширование изображений // ################################################################################################## function preloadImages(imgs){ var picArr = []; for (i = 0; i= 0;){if (/\S/.test(str.charAt(i))){ str = str.substring(0, i + 1); break; }} return str;} // ################################################################################################## // Обработчик форм обратной связи // ################################################################################################## function reloadCaptcha(form){var Time = new Date(); $("#"+form+" .captcha-img").attr("src","/class/img_access.php?rnd="+Time.getTime());} function postSubmit(form) { $("#"+form+" .butSubmit").hide(); $("#"+form+" .ajaxSubmit").show(); if(form == "PostMessage") var ajax = "message"; else if(form == "PostOrder") var ajax = "order"; else if(form == "PostComMessage") var ajax = "comments"; else if(form == "PostCallback") var ajax = "callback"; else if(form == "PostCallback2") var ajax = "callback_full"; else return false; $.post("/ajax/"+ajax+".php", $("#"+form).serialize(), updateSubmit); } function updateSubmit(data) { if(data == "") return false; var error = data.split("|"); var count_error = error.length; var form = error[0]; $("#"+form+" .ajaxSubmit").hide(); $("#"+form+" .butSubmit").show(); if(count_error > 1){ $("#"+form+" .error").removeClass("error"); for (var i = 1; i < count_error; i++) { $("#"+form+" ."+error[i]).addClass("error"); } var Time = new Date(); $("#"+form+" .captcha-input").val(""); $("#"+form+" .captcha-img").attr("src","/class/img_access.php?rnd="+Time.getTime()); } else { var def_text_message = '

Сообщение отправлено!
Наш менеджер свяжется с вами в ближайшее время.

'; var def_text_order = '

 

 

Спасибо!

Наш менеджер свяжется с вами в ближайшее время.

'; var def_text_comment = '

 

 

Ваш отзыв отправлен модератору.
В случае успешной проверки - отзыв будет опубликован.

Спасибо!

'; var def_text_callback = '


Спасибо!

Наш менеджер свяжется с вами в ближайшее время.

'; if(form == "PostMessage") $("#"+form).html(def_text_message); else if(form == "PostOrder") $("#"+form).html(def_text_order); else if(form == "PostComMessage") $("#"+form).html(def_text_comment); else if(form == "PostCallback") $("#"+form).html(def_text_callback); else if(form == "PostCallback2") $("#"+form).html(def_text_callback); } } // ################################################################################################## // ФУНКЦИИ ДЛЯ РАБОТЫ С ИНФОРМЕРОМ КОРЗИНЫ // ################################################################################################## var cmlex_cart_th_name = 'Наименование'; var cmlex_cart_one_add = 'Товар добавлен:'; var cmlex_cart_th_price = 'Цена, ⃏'; var cmlex_cart_th_count = 'Кол-во'; var cmlex_cart_th_total = 'Сумма, ⃏'; var cmlex_cart_link = '/cart'; var cmlex_cart_currency = '⃏'; var cmlex_comp_link = '/compare'; function html_cart_info(){ document.write('
'); document.write('
'); document.write('

Теперь в корзине товар(ов) на сумму ' + cmlex_cart_currency + '

'); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write('
' + cmlex_cart_th_name + '' + cmlex_cart_th_price + '' + cmlex_cart_th_count + '' + cmlex_cart_th_total + '
'); document.write(''); document.write(''); document.write(''); document.write('
'); document.write(''); document.write(''); document.write(''); document.write('
'); $("#minicart-count-td").hover(function(){$(this).children(".but_val_change").show();}, function(){$(this).children(".but_val_change").hide();}); $("#minibut_val_up").click(function(){tval = $(this).next(); if(parseInt(tval.val()) < 999) tval.val(parseInt(tval.val())+1); cart_change_count(tval.val()); }); $("#minibut_val_dwn").click(function(){tval = $(this).prev(); if(parseInt(tval.val()) > 1) tval.val(parseInt(tval.val())-1); cart_change_count(tval.val()); }); } function cart_change_count(count) { $("#minicart-but-order").hide(); $("#ajaxSubmit").show(); id = $("#minicart-heading").attr("rel"); option = 0; $.post("/ajax/cart.php",{workPOST: "onAddCart", id: id, option: option, count: count}, cart_info_upload); } function cart_add(id, option, count){ $.colorbox({inline:true, title:cmlex_cart_one_add, href:"#minicart", width:"800px", height:"330px"}); $("#cmlex-cartbut-"+id).attr("onClick","location.href = \'' + cmlex_cart_link + '\';").text("В корзине"); count = $("#cmlex-count-"+id).val(); $.post("/ajax/cart.php",{workPOST: "onAddCart", id: id, option: option, count: count}, cart_info_upload);} function cart_info_upload(data){ if(data != "null") { var cartinfo = data.split("|"); $("#ajaxSubmit").hide(); $("#minicart-but-order").show(); cart_informer_upload(cartinfo[0], cartinfo[1]); $("#minicart-heading").attr("rel", cartinfo[2]); $("#minicart-heading").html($("#cmlex-title-"+cartinfo[2]).attr("title")); $("#minicart-price").html($("#cmlex-price-"+cartinfo[2]).html()); $("#minicart-count").val(cartinfo[5]); $("#minicart-total").html(cartinfo[4]); $("#minicart-all-count").html(cartinfo[0]); $("#minicart-all-price").html(cartinfo[1]); } else cart_informer_upload(0, 0); } function cart_informer_upload(count, price) { if(count > 0) $("#cartinfo").html("
Корзина:
"+count+" товаров
"); else $("#cartinfo").html("
Корзина пуста
"); } // ################################################################################################## // ФУНКЦИИ ДЛЯ РАБОТЫ СО СРАВНЕНИЕМ ТОВАРА // ################################################################################################## function comp_add(id_part, id){$.post("/ajax/compare.php",{workPOST: "onAddCompare", id_part: id_part, id: id}, function(){$("#cmlex-compbut-"+id).attr("href", cmlex_comp_link+"?p="+id_part).css("background-position","0 -180px");});} // ################################################################################################## // ФУНКЦИИ ДЛЯ РАБОТЫ С WISHLIST // ################################################################################################## function wishlist_add(id){$.post("/ajax/wishlist.php",{workPOST: "onAddWishlist", id: id}, function(){$("#cmlex-wishlist-"+id).css("background-position","0 -330px");});} function wishlist_del(id){$.post("/ajax/wishlist.php",{workPOST: "onDelWishlist", id: id}, function(){$("#cmlex-wishlist-item-"+id).hide();});} // ################################################################################################## // ФУНКЦИИ АВТОРИЗАЦИИ // ################################################################################################## function postSubmitAuthMini() { $.post("/ajax/authorization.php", $("#auth-form-mini").serialize(), updateAuthMini); } function updateAuthMini(data) { if(data == "") var count_error = 0; else { var error = data.split("|"); var count_error = error.length; } if(count_error > 0){ var form = error[0]; $("#auth-form-mini .error").removeClass("error"); } if(count_error > 1){ for (var i = 1; i < count_error; i++) { $("#auth-form-mini #" + error[i]+"-mini").addClass("error"); } } else location.reload(); }