PageSourceSearch

https://www.ls-comp.ru/media/js/common.js?rand=20190227

js ls-comp.ru collected 2026-10-02 18:18:23 UTC 31,840 bytes, 1,013 lines download raw bytes

1	function checkDeliverySum() {		
2		if ($("input[name=is_req_delivery]:checked").val() > 0 && $("input[name=contact_type]:checked").val() == 'p' ) {
3			$("#basket-box .total .without-delivery").hide();
4			$("#basket-box .total .with-delivery").show();
5		} else {
6			$("#basket-box .total .without-delivery").show();
7			$("#basket-box .total .with-delivery").hide();
8		}
9	};
10	
11
12
13    var convertToCurrencyDisplayFormat = function(str) {
14	
15        var regex = /(-?[0-9]+)([0-9]{3})/;
16		
17		str = stripNonNumeric(str);
18        str += '';
19		
20        while (regex.test(str)) {
21            str = str.replace(regex, '$1 $2');
22        }
23		
24        return str;
25    };
26    var stripNonNumeric = function(str) {
27        str += '';
28        str = str.replace(/[^0-9]/g, '');
29        return str;
30    };
31
32//Èíôîðìàöèîííîå ñîîáùåíèå
33
34var mt;
35function doMessage( title, text, obj, _ga ) {
36	
37	clearTimeout(mt);
38
39	$("#message-button").removeClass("ga_callback");
40	
41	$('#message-title').html(title);
42	$('#message-text').html(text);	
43
44	$('#message-box').removeClass('orange-message');	
45
46//	$('#background').css('display', 'block');
47	if ( $("#basket-box").css("display") == "none" || $("#basket-box").css("display") == undefined ) {
48		$('.popup').css('display', 'none');
49	}
50
51	var top;
52	console.log($(obj));
53	console.log($(obj).offset());
54	if ( obj != undefined ) {
55		var offset = $(obj).offset();
56		top = offset.top;
57		var left = offset.left + $(obj).width() + 20;
58		if ( $(obj).hasClass("compare") || $(obj).hasClass("add-to-favorites") || $(obj).hasClass("add-favorite") || $(obj).hasClass("pseudo") ) { 
59			left = offset.left;
60			top = offset.top + $(obj).height() + 3;
61		}
62		if ( ( left + $('#message-box').width() ) > $(window).width() ) {
63			left = $(document).width() - $('#message-box').width() - 5;
64		}
65		$('#background').css('display', 'none');
66		$("#message-button").hide();
67		$('#message-box').css({display:'block', top:'' + top + 'px', left:'' + left + 'px', right: 'auto', marginRight: 'auto'});
68		mt = setTimeout("$('#message-box').hide()", 5000);
69	} else {
70		top = getScrollTop() + 50;
71		$('#background').css('display', 'block');
72		$("#message-button").show();
73		$('#message-box').css({display:'block', top:'' + top + 'px', right: '50%', marginRight: '-152px', left: 'auto'});
74	}
75	
76	if ( _ga == "callback" ) {
77		$("#message-button").addClass("ga_callback");
78	}
79	
80	if ( title == "Ìîè ïîêóïêè" ) {
81		
82		if ( $(obj).hasClass("a-buy") ) { //äîáàâëåíèå èç ñïèñêà
83			_gaq.push(['_trackEvent', 'in_basket', '2']);
84		} else { //äîáàâëåíèå èç êàðòî÷êè òîâàðà
85			_gaq.push(['_trackEvent', 'buy', '1']);
86		}
87	
88		_gaq.push(['_trackEvent', ' buy ', 'first']);
89		$('#message-box').hide();
90		$("#basket").click();
91	}	
92}
93
94function hideS(tbl){
95	var tbl = document.getElementById(tbl);
96	var _idx = 1;
97	var i = 0;
98	var j = _idx;
99	
100	while( tbl.rows[i].style.display == 'none' && i < tbl.rows.length ) { i++; }
101	while( tbl.rows[i].cells[j].style.display == 'none' && j < tbl.rows[i].cells.length ) { j++; }
102	_idx = j;
103
104	for (var i=0; i < tbl.rows.length; i++) {
105		var notHide = 0;
106		var isOne = 0; 
107
108		for(var j=_idx+1; j < tbl.rows[i].cells.length; j++) {
109			if(tbl.rows[i].cells[j].style.display != 'none' && tbl.rows[i].cells[j].innerHTML != tbl.rows[i].cells[_idx].innerHTML) {
110				notHide++;
111			} else if( tbl.rows[i].cells[j].style.display != 'none' ) {
112				isOne++;
113			}
114		}
115		
116		if( notHide == 0 && isOne > 0 ) {
117			tbl.rows[i].style.display='none';
118//			tbl.rows[i-1].style.display='none';
119		}
120	}
121	
122//	$("#xhider").after("<a id='xhider' href=# onclick=\"try { showS('cmpTbl'); } catch(e) {}; return false;\"> <span class='pseudo'>Ïîêàçàòü âñå ïîëÿ</span></a>").remove();
123}
124
125function showS(tbl){
126	var tbl = document.getElementById(tbl);
127
128	for (var i=0; i < tbl.rows.length; i++) {
129		try {
130			tbl.rows[i].style.display='table-row';
131		} catch(e) {
132			tbl.rows[i].style.display='block';
133		}
134	}
135
136//	$("#xhider").after("<a  id='xhider' href=# onclick=\"try { hideS('cmpTbl'); } catch(e) {}; return false;\"> <span class='pseudo'>Ñêðûòü îäèíàêîâûå ïîëÿ</span></a>").remove();
137}
138
139function fastBuyFromList(id_position, id_ex_category, id_repository, name, description) {
140	
141	if ( false && $("#fast-buy" + id_position).attr("price") < 5000 ) { 						
142		callbackErrorMessage("Îøèáêà!", "<p>Âíèìàíèå! Çàêàç íå ìîæåò áûòü îôîðìëåí - <a href='/z-about-giving-out/'>ìèíèìàëüíàÿ ñóììà çàêàçà ñîñòàâëÿåò 5 000 ðóá.</a></p>");
143	} else { 
144
145		$('#background').css('display', 'block');
146		$('.popup').css('display', 'none');
147		
148		if ( $.trim($('#fast-buy-box').html()) == "" ) {
149			$('#fast-buy-box').load("/getFastBuyPopup.php", function() {			
150				$("#id_position_fast_buy").val(id_position);
151				$("#id_ex_category_fast_buy").val(id_ex_category);
152				$("#id_repository_fast_buy").val(id_repository);
153				$("#fast-buy-item-name").html(name);
154				$("#fast-buy-item-description").html(description);	
155				$('#fast-buy-box').css({display:'block', top:(getScrollTop() + 112) + 'px'});
156				$('#fast-buy-box input:first').focus();
157			});
158		} else {
159			$("#id_position_fast_buy").val(id_position);
160			$("#id_ex_category_fast_buy").val(id_ex_category);
161			$("#id_repository_fast_buy").val(id_repository);
162			$("#fast-buy-item-name").html(name);
163			$("#fast-buy-item-description").html(description);	
164			$('#fast-buy-box').css({display:'block', top:(getScrollTop() + 112) + 'px'});
165			$('#fast-buy-box input:first').focus();
166		}
167		
168		if ($(".item-buy").length > 0) {
169			_gaq.push(['_trackEvent', 'fast_buy', 'click']);
170		} else {
171			_gaq.push(['_trackEvent', 'fast_katalog_buy', 'click']);
172		}
173		
174	}
175	return false;
176}
177
178function updateFiltersBlock(x) {
179	var re = /(\?.*)/
180	if (matches = x.href.match(re)) {
181	
182		$.ajax({
183			type: "GET",
184			url: "/getFilters.php"+matches[1],
185			dataType: "html",
186			success: function(data) {
187				$("#filtersBlock").html(data);
188				if ( location.href.indexOf("/brands/") > -1 ) {
189					if ( x.href.indexOf("?cat=") > -1 ) {
190						$("#selectedCategory a").attr("href", $("#selectedCategory a").attr("href")+"<?=$brand?>");
191						$("#selectedCategory").show();
192					} else { 
193						$("#selectedFilters").remove();
194					}
195				}
196			}
197		});
198	}
199	return false;
200}
201	
202function showPhoto(k) {
203
204	$('div.item-big img').removeClass("current");
205	$('div.item-big img#b' + k).addClass("current");
206	
207	$('div.item-big #zoomin').remove();
208	if ( $('div.item-big img#b' + k).hasClass("expandable") ) {
209		$('div.item-big').append("<img id='zoomin' src='/media/js/highslide/graphics/zoom-in.png' />");
210	}
211	
212	$('div.prew div.p ul li').removeClass("current");
213	$('div.prew div.p ul li#p' + k).addClass("current");
214	
215//	$('#view_image_'+k).fadeIn("slow");
216	
217//	var div_id = $('.more_photo div b').parent().attr("id");
218//	$("#"+div_id).html("<span>"+$('.more_photo div b b b b').html()+"</span>");
219//	$("#preview_div_"+k).html("<b><b><b><b>"+$("#preview_div_"+k+" span").html()+"</b></b></b></b>");
220	
221}
222
223//âû÷èñëåíèå scrollTop
224function getScrollTop() {
225	//var canvas = document.getElementsByTagName((document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY")[0];
226	return $(document).scrollTop();
227	//return (canvas.scrollTop > 0 ? canvas.scrollTop : 0);
228}	
229
230function checkRequired() {
231	var ok = true;
232	$("#basket-box input.required").each(function () {
233		if ( $.trim($(this).val()) == "" ) {
234			ok = false;
235		}
236	});
237	
238	if ( !ok ) {
239		if ( $("#basket-fast").length <= 0 ) {
240			$("#bs4").removeClass("pseudo");
241			$("#bs4").parent().removeClass("submit").addClass("disabled");
242		}
243		$('#basket-box input.submit').attr("disabled", true);
244	} else {
245		if ( $("#basket-fast").length <= 0 ) {
246			$("#bs4").addClass("pseudo");
247			$("#bs4").parent().removeClass("disabled").addClass("submit");
248		}
249		$('#basket-box input.submit').attr("disabled", false);
250	}
251	
252	return ok;
253}
254
255function add2basket(id_position, id_ex_category, id_repository, qty, type, tr_id, id_credit) {
256	
257	var id_variants = 0;
258
259	if ( tr_id != null ) { // â êîðçèíå
260		id_variants = parseInt($("#"+tr_id).attr("id_variants"));
261		$(".basket_input").attr({"readonly" : true, "disabled" : true});
262	} else if ( id_credit != null ) {
263		id_variants = parseInt(id_credit);					
264	} else if ( $("input.bvselected").val() != undefined ) {
265		id_variants = parseInt($("input.bvselected").val());			
266	}
267	
268	$.post("/addGoods.php", { where: "basket", id_position: id_position, id_ex_category: id_ex_category, id_repository: id_repository, qty: qty, type: type, id_variants: id_variants, id: (tr_id != null && type == "del" ? tr_id.replace(/basketLine/, "") : 0) }, function(data) {
269/*		if ( tr_id != null ) {
270			$.getJSON("/getBasket.php", { id: tr_id.replace(/basketLine/, "") }, function(data) {
271				$("#"+tr_id).find(".amount").html(data.amount);
272				$("#"+tr_id).find(".qty").val(data.qty);
273				$("#basketResultLine").find(".amount").html(data.total_amount);
274				$("#basketResultLine").find(".qty").html(data.total_qty);
275				$(".quan").html(data.total_qty);
276				$("#cart_amount").html(data.total_amount);
277			});
278			$.getJSON("/getBasket.php", { id: tr_id.replace(/basketLine/, ""), payment_type: "credit_card" }, function(data) {
279				$("#CC_"+tr_id).find(".amount").html(data.amount);
280				$("#CC_"+tr_id).find(".qty").val(data.qty);
281				$("#CC_basketResultLine").find(".amount").html(data.total_amount);
282				$("#CC_basketResultLine").find(".qty").html(data.total_qty);
283			});
284		} else {
285			updateCart();
286		}
287*/
288		if ( type == "strict" ) {
289			updateCart(tr_id);
290		} else {
291			updateCart();
292		}
293	});
294	
295	return false;
296}
297
298function add2credit(id_position, id_ex_category, qty, type) {
299	
300	var qty_strong = parseInt($("#credit_qty").text());
301	if ( type == "inc" ) {
302		qty_strong += qty;
303	} else if ( type == "dec" ) {
304		qty_strong -= qty;
305	} else if ( type = "strong" ) {
306		qty_strong = qty;		
307	}
308	
309	$.post("/getCredit.php", { id_position: id_position, id_ex_category: id_ex_category, qty: qty_strong }, function(data) {
310		$("#credit_goods").html(data);
311	});
312	
313	return false;
314}
315
316function add2compare(id_position, id_ex_category, id_repository) {
317	$("#compare_view_"+id_position).parent("li").removeClass("compare_visible").addClass("compare_hidden");
318	$("#compare_list_"+id_position).removeClass("compare_visible").addClass("compare_hidden");
319	var cat = $("li.comparison").attr("id");
320	$.post("/addGoods.php", { where: "compare", id_position: id_position, id_ex_category: id_ex_category, id_repository: id_repository }, function(data) {
321		if ( id_ex_category > 0 ) {
322			$.post("/getCompare.php", {type: 1, id_ex_category: cat}, function(data3) {
323				$("li.comparison").find("i").html(data3);
324			});
325		}
326/*
327		$.post("/getCompare.php", {id_ex_category: cat}, function(data2) {
328			if ( data2 != "" ) {
329				$("#compare").html(data2);
330				$("#compareBlock").show();
331			}
332		});
333*/
334	});
335	
336	return false;
337}
338
339function basketMessage( title, text ) {
340	
341	$('#basket-message-title').html(title);
342	$('#basket-message-text').html(text);	
343
344	//$('#basket-message-box').removeClass('orange-message');	
345
346	var top = getScrollTop() + 50;
347	$("#basket-message-button").show();
348	$('#basket-message-box').css({display:'block', top:'' + top + 'px', right: '50%', marginRight: '-152px', left: 'auto'});
349	
350}	
351
352function callbackErrorMessage( title, text ) {
353	
354	$('#callback-error-title').html(title);
355	$('#callback-error-text').html(text);	
356
357	//$('#basket-message-box').removeClass('orange-message');	
358
359	var top = getScrollTop() + 50;
360	$('#background').css('display', 'block');
361	$("#callback-error-button").show();
362	$('#callback-error-box').css({display:'block', top:'' + top + 'px', right: '50%', marginRight: '-152px', left: 'auto'});
363	
364}	
365
366//Çàêðûòèå âñåõ îêîí
367function closeAll() {
368	$('#background').css('display', 'none');
369	$('.popup').css('display', 'none');
370	$('#basket-in-menu').css('display', 'block');
371}	
372
373//Îòïðàâèòü îøèáêó íà ñàéòå ïî Ctrl + Enter
374function getSel() {
375	var w=window,d=document,gS='getSelection';
376	return (''+(w[gS]?w[gS]():d[gS]?d[gS]():d.selection.createRange().text)).replace(/(^\s+|\s+$)/g,'');
377}
378
379function basketBoxSubmit() {
380		var step = $("#basket-step").val();
381		if ( step == 3 || step == 6 ) {
382			if ( !checkRequired() ) {
383				return;
384			}
385		}
386	
387		$("#basket-box").ajaxSubmit({
388			target: "#basket-box",
389			success: function(data) {
390				$("#id_delivery_date").datepicker({ "constrainInput": true, "minDate" : 1, "option" : $.datepicker.regional['ru'], "showOn": "both", "buttonImage": "/media/img_old/datepicker-button.gif", "buttonImageOnly": true });
391				$("#id_delivery_date").mask("99.99.9999");
392				$("#id_payment_type").change();
393				if ( $("#id_is_req_delivery input:checked").val() != undefined ) {
394					if ( $("#id_is_req_delivery input:checked").val() > 0 ) {
395						$("#basket-box .delivery_details").show();
396					} else {
397						$("#basket-box .delivery_details").hide();
398					}
399				}
400				checkDeliverySum();
401				$("#basket-box #id_contact_person").focus();						
402				var step = $("#basket-step").val();
403				if ( step == 3 || step == 6 ) {
404					checkRequired();
405				}
406			}
407		});
408		
409}
410
411function updateCartX(step, kupivkredit) {
412		updateCart(null, step, function() {
413						$("#id_delivery_date").datepicker({ "constrainInput": true, "minDate" : 1, "option" : $.datepicker.regional['ru'], "showOn": "both", "buttonImage": "/media/img_old/datepicker-button.gif", "buttonImageOnly": true });
414						$("#id_delivery_date").mask("99.99.9999");
415						$("#id_payment_type").change();
416						if ( $("#id_is_req_delivery input:checked").val() != undefined ) {
417							if ( $("#id_is_req_delivery input:checked").val() > 0 ) {
418								$("#basket-box .delivery_details").show();
419							} else {
420								$("#basket-box .delivery_details").hide();
421							}
422						}
423						checkDeliverySum();
424						$("#basket-box #id_contact_person").focus();
425						if ( kupivkredit ) {
426							$("#basket-fast").replaceWith("<input type='hidden' name='kupivkredit' value='1' />");
427							$("#basket-tab-title").html("Ïîêóïêà â êðåäèò");
428						}
429			
430		});
431}
432		
433$(function() {
434
435	$('#alphabet .alphabet-list li').click(function() {
436		$('#alphabet li.current').removeClass('current');
437		$(this).addClass('current');
438		
439		if( ($(this).children("a").attr('char') > 0) ) {
440			$('#alphabet .sub-list').children("ul").hide();
441			$('#alphabet .sub-list').show();
442			$('#list-' + $(this).children("a").attr('char') ).show();
443			
444			$('#background-producers').css('display', 'block');
445			
446		}
447		
448		return false;
449	});
450
451	$('#alphabet .sub-list .close .pseudo, #background-producers').click(function() {
452		$('#alphabet li.current').removeClass('current');
453		$('#alphabet .sub-list').hide();
454		$('#background-producers').css('display', 'none');
455		return false;
456	});
457	
458	$('a.list-popular').click(function() {
459		$('ul.popular').hide();
460		$('ul.all').show();
461		
462		return false;
463	});
464	
465	$('a.list-all').click(function() {
466		$('ul.all').hide();
467		$('ul.popular').show();
468		
469		return false;
470	});
471	
472	$('#background, #message-close, #message-button, #quality-close, #login-close, #fast-buy-close, #kupivkredit-close, #order-call-close, #basket-close, #mfu_cost_close, #callback-error-close, #callback-error-button, #compare-close, #delivery-close').live("click", function() {
473		closeAll();
474	});
475
476	$('#basket-message-close, #basket-message-button').live("click", function() {
477		$("#basket-message-box").hide();
478	});
479		
480	//Íåäîâîëüíû êà÷åñòâîì
481	$('#quality-compliment').click(function() {
482		$('#background').css('display', 'block');
483		$('.popup').css('display', 'none');
484		
485		if ( $.trim($('#quality-box').html()) == "" ) {
486			$('#quality-box').load("/getQualityPopup.php", function() {			
487				$('#quality-box-type').val(0).change();				
488				$('#quality-box').css({display: 'block', top:(getScrollTop() + 50) + 'px'});
489				$('#quality-box input:first').focus();
490			});
491		} else {
492			$('#quality-box-type').val(0).change();			
493			$('#quality-box').css({display: 'block', top:(getScrollTop() + 50) + 'px'});
494			$('#quality-box input:first').focus();
495		}
496
497
498		
499	});
500	
501	$('#quality-complain').click(function() {
502		$('#background').css('display', 'block');
503		$('.popup').css('display', 'none');
504		if ( $.trim($('#quality-box').html()) == "" ) {
505			$('#quality-box').load("/getQualityPopup.php", function() {			
506				$('#quality-box-type').val(1).change();				
507				$('#quality-box').css({display: 'block', top:(getScrollTop() + 50) + 'px'});
508				$('#quality-box input:first').focus();
509			});
510		} else {
511			$('#quality-box-type').val(1).change();			
512			$('#quality-box').css({display: 'block', top:(getScrollTop() + 50) + 'px'});
513			$('#quality-box input:first').focus();
514		}
515	});
516
517	$('#quality-idea').click(function() {
518		$('#background').css('display', 'block');
519		$('.popup').css('display', 'none');
520		if ( $.trim($('#quality-box').html()) == "" ) {
521			$('#quality-box').load("/getQualityPopup.php", function() {			
522				$('#quality-box-type').val(2).change();				
523				$('#quality-box').css({display: 'block', top:(getScrollTop() + 50) + 'px'});
524				$('#quality-box input:first').focus();
525			});
526		} else {
527			$('#quality-box-type').val(2).change();			
528			$('#quality-box').css({display: 'block', top:(getScrollTop() + 50) + 'px'});
529			$('#quality-box input:first').focus();
530		}
531	});	
532
533	$(document).keypress(function(e) {
534		//åñëè ïîñåòèòåëü íàæàë Ctrl + Enter...
535		if ( (e.ctrlKey == true) && (e.keyCode == 13 || e.keyCode == 10) && ($("#error-box").css("display") == "none") ) {			
536			//...èùåì âûäåëåííûé òåêñò... 
537			var text = jQuery.trim(getSel());
538			if ( text.length > 300 ) {
539				//doMessage("Îøèáêà!", "Ìîæíî âûäåëèòü íå áîëåå 300 ñèìâîëîâ.");		
540				$('#message-title').html('Îøèáêà!');
541				$('#message-text').html('Ìîæíî âûäåëèòü íå áîëåå 300 ñèìâîëîâ.');
542				$('.popup').css('display', 'none');
543				var top;
544				top = getScrollTop() + 50;
545				$('#background').css('display', 'block');
546				$('#message-box').addClass('orange-message');
547				$("#message-button").show();
548				$('#message-box').css({display:'block', top:'' + top + 'px', right: '50%', marginRight: '-152px', left: 'auto'});
549	
550			} else if ( text.length > 0 ) {
551
552				$('#background').css('display', 'block');
553				$('.popup').css('display', 'none');
554			
555				if ( $.trim($('#error-box').html()) == "" ) {
556					$('#error-box').load("/getErrorPopup.php", function() {			
557						$('#error-text').val(text);
558						$('#error-right').val(text);					
559						$('#error-pageurl').val(window.location.href);
560						
561						$('#error-box').css({display:'block', top:(getScrollTop() + 50) + 'px'});
562					});
563				} else {
564					$('#error-text').val(text);
565					$('#error-right').val(text);					
566					$('#error-pageurl').val(window.location.href);
567					
568					$('#error-box').css({display:'block', top:(getScrollTop() + 50) + 'px'});
569				}
570			}
571		}
572	});				
573
574	$('#error-box').submit(function() {
575		$(this).ajaxSubmit(function(data) {
576			if ( data.length > 0 ) {
577				doMessage("Îòïðàâëåíî!", data);
578			} else {
579				closeAll();
580			}
581		});
582		return false;
583	});
584	
585	//Êîðçèíà
586	
587	$('#basket, #basket-message').live("click", function() {
588	
589		$('#background').css('display', 'block');
590		$('.popup').css('display', 'none');
591		updateCart(null, 1, function() {
592			$('#basket-box').css({display:'block', top:(getScrollTop() + 50) + 'px'});
593			$('#background').css('height', Math.max($('#basket-box').height()+250, $(document).height()) + 'px');
594			$('#basket-in-menu').css('display', 'none');
595		});
596		return false;
597	});
598
599	$('#compare, #compare-message').live("click", function() {
600		$('#background').css('display', 'block');
601		$('.popup').css('display', 'none');
602		
603		var id_ex_category = $(this).attr("href").replace("#", "");
604		
605		$.post("/getCompare.php", { id_ex_category: id_ex_category, type: 2 }, function(data) {
606			$('#compare-box').html(data).css({display:'block', top:(getScrollTop() + 50) + 'px'});
607			
608			$("#cmpTbl tr").each(function() {
609				$("#leftTbl table").append($("<tr style='height:" + $(this).children("td.first").height() + "px;'></tr>").append($(this).children("td.first").clone(true)));
610				$(this).css("height", $(this).children("td.first").height() + "px");
611				$(this).children("td.first").remove();				
612			});
613			
614		});
615		
616		return false;
617	});
618	
619	$('#basket-switch li.link span, #basket-box input.back, #basket-box input.fast').live("click", function() {
620	
621		var kupivkredit = $(this).attr("kupivkredit") == "1";
622		var step = $(this).attr("id").replace("bs", "");
623		
624		if ( kupivkredit ) {
625		
626			$.post("/setCashPayment.php", 
627				{
628					"is_cash": 0
629				}, 
630				function(data) {
631					updateCartX(step, kupivkredit);
632				}
633			);
634
635		} else {
636			updateCartX(step, kupivkredit);
637		}
638			
639	});
640	
641	$('#login').click(function() {
642		$('#background').css('display', 'block');
643		$('.popup').css('display', 'none');
644		$('#login-box').css('display', 'block');
645		return false;
646	});
647
648	$('#credit').click(function() {
649		$('#background').css('display', 'block');
650		$('.popup').css('display', 'none');
651
652		if ( $.trim($('#credit-box').html()) == "" ) {
653			$.post("/getCreditPopup.php", {id_ex_category: $('#credit-box').attr("id_ex_category"), id_position: $('#credit-box').attr("id_position")}, function(data) {
654				$('#credit-box').html(data).css({display:'block', top:(getScrollTop() + 50) + 'px'});			
655			});
656		} else {
657			$('#credit-box').css({display:'block', top:(getScrollTop() + 50) + 'px'});
658		}
659
660		return false;
661	});
662
663	$('#order_call').click(function() {
664		_gaq.push(['_trackEvent', 'call', '5']);
665		$('#background').css('display', 'block');
666		$('.popup').css('display', 'none');
667		if ( $.trim($('#order-call-box').html()) == "" ) {
668			$('#order-call-box').load("/getOrderCallPopup.php", function() {
669				$('#order-call-box').css({display:'block', top:(getScrollTop() + 50) + 'px'});
670				$('#order-call-box input:first').focus();
671                $("#id_order_call_date").datepicker({ "minDate" : 0, "option" : $.datepicker.regional['ru'], "showOn": "button", "buttonImage": "/media/img_old/datepicker-button.gif", "buttonImageOnly": true });
672			});
673		} else {
674			$('#order-call-box').css({display:'block', top:(getScrollTop() + 50) + 'px'});
675			$('#order-call-box input:first').focus();
676		}		
677		return false;
678	});	
679	
680	// Mainmenu
681	$('#mainmenu li .pseudo').click(function() {
682		$('#mainmenu li .popup-menu').css('display', 'none');
683		$(this).parent('li').find('.popup-menu').css('display', 'block');
684		
685		$('.wrapper').unbind('click');
686		
687		setTimeout(function() {
688			
689			$('.wrapper').bind('click', function() {
690				
691				$('#mainmenu li .popup-menu').css('display', 'none');
692				$('.wrapper').unbind('click');
693				
694			});
695			
696		}, 50);
697	});
698	$('.popup-menu .pseudo').click(function() {
699		$(this).parent().parent().parent().css('display', 'none');
700		
701		setTimeout(function() {
702			
703			$('.wrapper').unbind('click');
704			
705		}, 50);
706	});
707
708	$('.pseudo-select').click(function() {
709		$(this).parent('li').find('.popup-menu').css('display', 'block');
710		
711		$('.wrapper').unbind('click');
712		
713		setTimeout(function() {
714			
715			$('.wrapper').bind('click', function() {
716				
717				$('.city-select').css('display', 'none');
718				$('.wrapper').unbind('click');
719				
720			});
721			
722		}, 50);
723	});
724
725	$('.city-select .sub a').live("click", function() {
726	
727		var phone = $(this).siblings("b").html();
728		var city = $(this).text();
729		var id_cities = $(this).attr("href").replace("#", "");
730		
731		$.post("/setCity.php", {id_cities : id_cities}, function() {
732			$(".pseudo-select").html(city);
733			$('.city-select .title .a .pseudo').html(city);
734			$('b.phone_content').html(phone);
735			
736			$('.city-select').css('display', 'none');
737			
738			if ( $("#variants-buy").length ) {
739			
740				if ( id_cities == 2 ) {
741					//ID_MOSCOW
742					location.reload();
743				} else {
744					$('#cashpayment').attr('checked', false);				
745					$("#cashpayment").trigger("change");
746					$("#cashpayment").closest("table").remove();
747				}
748				
749			}
750					
751		});
752		
753		return false;
754	});
755	
756	$('#catalog-menu li .arrow .pseudo').click(function() {
757		
758		if ($(this).parent().parent().hasClass('open'))
759		{
760			$(this).parent().parent().removeClass('open');
761		}
762		else
763		{
764			$(this).parent().parent().addClass('open');
765		}
766		
767	});
768	
769       $('.option-buy-item input').click(function() {
770		
771		$('.option-buy-item').removeClass('option-buy-item-adv');
772		$(this).parent().parent().parent().addClass('option-buy-item-adv');
773		
774	});
775
776	$("#popup-catalog").click(function() {
777	
778				$.post(
779				"/MenuCatalog.php",
780				function(data){$("#popup-catalog div.sub-popup-menu").html(data)}
781					   )
782				});
783						
784	$('.catalog .item-line .item .padding a.name-img').live("click", function() {
785		
786			var id_ex_category = $(this).children("img").attr("cid");
787			var href = $(this).attr("href");
788			$.post("/sendCategory.php", { id_ex_category: id_ex_category }, function(data) {
789				location.href=href;
790			});
791		
792		return false;
793	});	
794	
795});
796	
797$(document).ready(function() {
798
799	$('#background').css('height', $(document).height() + 'px');
800	
801	$(".ga_callback").live("click", function() {
802		_gaq.push(['_trackEvent', ' Callback ', 'Îê']);
803	});	
804
805	var numberInputs = $("#amount1, #amount2");
806	numberInputs.each(function() {
807		this.value = convertToCurrencyDisplayFormat(this.value);
808	});
809	numberInputs.blur(function() {
810		this.value = convertToCurrencyDisplayFormat(this.value);
811	});
812	numberInputs.focus(function() {
813		this.value = stripNonNumeric(this.value);
814	});
815
816	$("#basket-box :input.ownership").live("change", function () {	
817		$("#basket-step").val(2);
818		basketBoxSubmit();
819	});
820	
821	$("#basket-box input.required").live("keyup", function () {
822		checkRequired();
823	});
824	
825	$('#quality-box-type').live("change", function() {
826		
827		switch(parseInt($('#quality-box-type :selected').val())) {
828			case 1:
829				$('#quality-box .title').hide();
830				$('#quality-box .complain').show();
831				break;
832			case 2:
833				$('#quality-box .title').hide();
834				$('#quality-box .idea').show();
835				break;
836			case 0:
837			default:
838				$('#quality-box .title').hide();
839				$('#quality-box .compliment').show();
840				break;
841		}
842	});
843	
844	$('#quality-box #quality-submit').live("click", function() {
845
846        //console.log(reCAPTCHA_SITE_KEY);
847        if (reCAPTCHA_SITE_KEY) {
848            grecaptcha.ready(function() {
849                grecaptcha.execute(reCAPTCHA_SITE_KEY, {action: 'quality'}).then(function(token) {
850                    //console.log(token);
851                    //$('#rctoken-quality').val(token);
852                    $("#quality-box").ajaxSubmit({
853                        target: "#quality-form",
854                        data: {rctoken: token},
855                        success: function(data) {
856                            $('#quality-box-type').change();
857                        }
858                    });
859                });
860            });
861        } else {
862
863            $("#quality-box").ajaxSubmit({
864                target: "#quality-form",
865                success: function (data) {
866                    $('#quality-box-type').change();
867                }
868            });
869
870        }
871	
872		return false;				
873		
874	});	
875
876	$('#basket-box .submit').live("click", function() {
877
878		basketBoxSubmit();
879		
880		return false;				
881		
882	});	
883	
884	$('#basket-box #list .pseudo').live("click", function() {
885		if ( $(this).parent().hasClass("close_list") ) {
886			$(this).html("Ñêðûòü çàêàçàííûå òîâàðû").parent().addClass("open_list").removeClass("close_list");
887		} else {
888			$(this).html("Ïîñìîòðåòü çàêàçàííûå òîâàðû").parent().addClass("close_list").removeClass("open_list");
889		}
890	});
891	
892	$("#id_payment_type").live("change", function() {
893		
894		//$("#basket-box .total .payment_type").hide();
895		//$("#basket-box .total ." + $(this).val()).show();
896		
897	});
898
899	$("#id_is_req_delivery input").live("click", function() {
900		if ( $(this).val() > 0 ) {
901			$("#basket-box .delivery_details").show();
902		} else {
903			$("#basket-box .delivery_details").hide();
904		}
905		checkDeliverySum();
906	});
907
908	$('#fast-buy-box #fast_buy_submit').live("click", function() {
909		//var id_buyvariants = ($(".bvselected").val() != undefined ? $(".bvselected").val() : 0);
910		//$("#id_buyvariants_fast_buy").val(id_buyvariants);
911
912		$("#fast-buy-box").ajaxSubmit({
913			target: "#fast-buy-form",
914			success: function(data) {
915			}
916		});
917	
918		return false;				
919		
920	});	
921
922	$('#order-call-box #order_call_submit').live("click", function() {
923
924        if (reCAPTCHA_SITE_KEY) {
925            grecaptcha.ready(function() {
926                grecaptcha.execute(reCAPTCHA_SITE_KEY, {action: 'callback'}).then(function(token) {
927                    $("#order-call-box").ajaxSubmit({
928                        url: "/doOrderCall-220512.php",
929                        data: {rctoken: token},
930                        target: "#order-call-form",
931                        success: function (data) {
932                            $("#id_order_call_date").datepicker({
933                                "minDate": 0,
934                                "option": $.datepicker.regional['ru'],
935                                "showOn": "button",
936                                "buttonImage": "/media/img_old/datepicker-button.gif",
937                                "buttonImageOnly": true
938                            });
939                        }
940                    });
941                });
942            });
943
944        } else {
945
946            $("#order-call-box").ajaxSubmit({
947                url: "/doOrderCall-220512.php",
948                target: "#order-call-form",
949                success: function (data) {
950                    $("#id_order_call_date").datepicker({
951                        "minDate": 0,
952                        "option": $.datepicker.regional['ru'],
953                        "showOn": "button",
954                        "buttonImage": "/media/img_old/datepicker-button.gif",
955                        "buttonImageOnly": true
956                    });
957                }
958            });
959
960        }
961
962		return false;				
963		
964	});	
965
966	$("#id_order_call_date").datepicker({ "minDate" : 0, "option" : $.datepicker.regional['ru'], "showOn": "button", "buttonImage": "/media/img_old/datepicker-button.gif", "buttonImageOnly": true });
967
968	$("#search_input").autocomplete("/getSearchAutocomplete.php?q="+$(this).val(), {
969		width: $("#search_input").width()+3,
970		scrollHeight: 404,
971		max: 10,
972		cacheLength: 0,
973		delay: 400,
974		formatItem: function(row) { return row[1]; },
975		selectFirst: false
976	}).result(function(event, item) { 
977		$("#search_form").submit(function() { 
978			return false; 
979		}); 
980		location.href = item[2];
981	});
982		
983
984
985	$("#search_input").focus(function() {
986		if ( $(this).attr("title") == $(this).val() ) {
987			$(this).val("").removeClass("empty");	
988			whereSubmit = 1;
989		}
990	});
991	
992	$("#search_input").blur(function() {
993		if ( jQuery.trim($(this).val()) == "" ) {
994			$(this).val($(this).attr("title")).addClass("empty");
995			whereSubmit = 0;
996		}
997	});
998	
999	
1000	$(".block-info .close").click(function(){
1001		$.get("/hideInfo.php", {type: "top", id: $(this).attr("id")}, function(data) {
1002			$(".block-info").hide();
1003		});
1004	});
1005	$(".block-info-white .close").click(function(){
1006		$.get("/hideInfo.php", {type: "bottom", id: $(this).attr("id")}, function(data) {
1007			$(".block-info-white").hide();
1008		});
1009	});
1010	
1011	
1012});
1013		

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.