PageSourceSearch

https://vyatich.ru/js2.js?rand=683277

js vyatich.ru collected 2026-10-07 06:08:55 UTC 102,388 bytes, 3,302 lines download raw bytes

1//ресторан js
2$(document).ready(function () {
3   if(typeof mapvizov1 == 'function') {
4     setTimeout(function() { mapvizov1(); }, (200));
5	
6}
7 if(typeof initmp3play == 'function') {
8    initmp3play ();
9	}
10if (typeof $.fancybox !=="undefined") {
11$("a.grouped_elements").fancybox();
12}
13
14 if(typeof selectinit == 'function') {
15    selectinit ();
16	}
17
18});
19
20
21
22
23function  contentvyatichsize () {
24	razmeri = getrazmobh();
25	if (razmeri[1] < razmeri[0]) {
26		deldelta = 0;
27	} else {
28		deldelta = 30;
29	}
30	newrazmcontent = razmeri[1] - (($("#plashkimenu1").height() + ($("#plashkimenu2").height()) - deldelta));
31	//adalert(razmeri[1]+" ! "+($("#plashkimenu1").height() + ($("#plashkimenu2").height() - deldelta))+" ! "+newrazmcontent+"px");
32	var minrazmercontentdop = $("#contentblockdop").children().outerHeight(true);
33	if (newrazmcontent < minrazmercontentdop) {
34			newrazmcontent = minrazmercontentdop;
35	}
36	$("#contentblockdop").css({ "min-height": newrazmcontent+"px","width": razmeri[0]+"px"});
37}
38
39
40function adreaimgs(teka) {
41	
42	var tekkartinki = $('#shopblock_'+teka+' .imgblock').html();
43	$('#imgshopblock').html(tekkartinki);
44}
45
46function openbaloon(returnevent,idb) {
47	$(".shopblocki").not('#shopblock_'+idb).hide();
48	$('#shopblock_'+idb).show();
49	$(".shopmenu").removeClass("active");
50	$('#shopmenu_'+idb).addClass("active");
51	console.log(returnevent);
52	console.log(idb);
53	adreaimgs(idb);
54	
55	var banketblocki = $('#shopblock_'+idb+' .infonazamenu');
56	if (banketblocki.length > 0) {
57		$('.banketblock h1').html($(banketblocki).find('.zag').html());
58		$('.banketblock #opisglav').html($(banketblocki).find('.opis').html());
59		$('.banketblock #imgblockglav').html($(banketblocki).find('.imglist').html());
60		$('.banketblock #kontaktsglav').html($(banketblocki).find('.kontakts').html());
61		$('.banketblock #zakazlink').attr("href",$(banketblocki).find('.link').html());
62		
63	}
64	
65	if (typeof mapfullscreenControl !=="undefined") {
66		if (mapfullscreenControl.isSelected()) {
67	mapfullscreenControl.exitFullscreen();
68	//myPlacemark[idb].open();
69
70	myPlacemark[idb].balloon.close();
71	setTimeout(function() {myPlacemark[idb].balloon.open(); }, (200));
72		}
73	}
74}
75
76var kollpopitokmap = 0;
77
78
79
80(function ($) {
81	var methods = {
82		init: function (options) {
83			var p = {
84				show: function (linkEl, landingItem) {}, 
85				hide: function (linkEl, landingItem) {}
86			};
87			if (options) {
88				$.extend(p, options);
89			}
90			return this.each(function () {
91				var el = $(this);
92				var elPos = el.offset().top;
93				var razmerielementa = [];
94				razmerielementa[0] = el.innerHeight();
95				razmerielementa[1] = el.outerHeight(true);
96			var tekmargin = el.css("margin-bottom");
97			if (tekmargin != '' && tekmargin != ' ' && tekmargin !='0px') {
98			var razdelim  = tekmargin.split("px");
99			razdelim[0] = razdelim[0] - 0;
100			if (!isNaN(razdelim[0])) {
101				tekmargin = razdelim[0];
102							}
103			}
104				
105				elPos = elPos + (razmerielementa[0] / 2);
106				//console.log(elPos+" ! "+el.offset().top+" ! "+print_r(razmerielementa))
107				var wHalf = $(window).height()/2
108				var scrollId = function(){};
109				
110				//assign events only links with anchors
111				
112				$('a[href^=#]',el).on('click',function(){
113					var linkItem = $(this);
114					if(!linkItem.is('.active')){
115						var linkHref = linkItem.attr('href');
116						var linkTarget = $(linkHref);
117						var linkTargetPos = linkTarget.offset().top;
118						if (tekmargin > 0) {
119							razmerielementa[1] = razmerielementa[1] - tekmargin;
120						}
121						if (el.hasClass("menu1")) {
122						linkTargetPos = linkTargetPos - razmerielementa[1];
123						}
124						
125						var windowPos = $(window).scrollTop();
126						var animDuration = linkTargetPos - windowPos
127						if(animDuration < 0){
128							animDuration = animDuration*-1	
129						}
130						if (animDuration > 2000) {
131						animDuration = Math.round(animDuration / 2);
132						}
133						//scroll the page to the desired block
134						if(linkTarget.length){
135							$('html, body').stop(true).animate({scrollTop:linkTargetPos},animDuration,function(){
136								$(window).trigger('scroll');
137							});
138						}
139					}
140					return false;
141				})
142				//stop the animation by scrolling
143				var mousewheelevt=(/Firefox/i.test(navigator.userAgent))? "DOMMouseScroll" : "mousewheel" //FF doesn't recognize mousewheel as of FF3.x
144				if (document.attachEvent) //if IE (and Opera depending on user setting)
145					document.attachEvent("on"+mousewheelevt, function(e){
146						$('html, body').stop(true);		
147					});
148				else if (document.addEventListener) //WC3 browsers
149					document.addEventListener(mousewheelevt, function(e){
150						//e.detail //direction
151						$('html, body').stop(true);
152					}, false)
153				//highlight the desired link in the menu by scrolling
154				$(window).on('scroll',function(e){
155					clearTimeout(scrollId);
156					var windowPos = $(window).scrollTop();
157					//console.log(windowPos+" ! "+elPos);
158					if(windowPos > elPos){
159						el.addClass('landingFix');
160					}else{
161					
162						if(!el.hasClass("landingFixStatic")) {el.removeClass('landingFix');}
163					}
164					razmerielementa[1] = el.outerHeight(true);
165					scrollId = setTimeout(function(){
166						$('.blockilend').each(function(){
167							var landingItem = $(this);
168							var landingItemHeight = landingItem.height();
169							var landingItemTop = landingItem.offset().top - wHalf;
170							var linkHref = landingItem.attr('id');
171							var linkEl = $('a[href="#'+linkHref+'"]',el);
172							var status;
173
174							if(windowPos > landingItemTop && windowPos < (landingItemTop + landingItemHeight)){
175								if(!linkEl.parent().is('.active')){
176									linkEl.parent().addClass('active');
177									if (p.show !== undefined) {
178										p.show(linkEl, landingItem);
179									}
180								}
181							}else{
182								if(linkEl.parent().is('.active')){
183									linkEl.parent().removeClass('active');
184									if (p.hide !== undefined) {
185										p.hide(linkEl, landingItem);
186									}
187								}
188							}
189						});
190					},100);
191				})
192				$(window).trigger('scroll');
193			});
194		}
195	};
196	$.fn.liLanding = function (method) {
197		if (methods[method]) {
198			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
199		} else if (typeof method === 'object' || !method) {
200			return methods.init.apply(this, arguments);
201		} else {
202			$.error('Метод ' + method + ' в jQuery.liLanding не существует');
203		}
204	};
205})(jQuery);
206
207//Инициализация плагина
208$(window).load(function(){
209					//	var menuhki = $('.menurazdelov');
210					//	if (menuhki != null && menuhki.length > 0) {
211	//for (im=0;im<menuhki.length;im++) {
212	//$(menuhki[im]).liLanding();
213	//}
214	
215	//					}
216$('.menurazdelov.menu1').liLanding();
217
218
219})
220
221//ОПРЕДЕЛЕНИЕ ПОЛОЖЕНИЯ ЛЕНДИНГА
222
223var otzivivparam = [];
224otzivivparam['koll'] = 0;otzivivparam['tek'] = 1;otzivivparam['blocki'] = [];
225function otziviblockh() {
226var blocki = $(".otzivi_viewblock .avablocks .item");
227if (blocki != null && blocki.length > 0) {
228otzivivparam['blocki'] = blocki;
229if (blocki.length < 2) {$(".otzivi_viewblock .strekli").addClass("active");}
230otzivivparam['koll'] = blocki.length;
231var seredina = Math.ceil(otzivivparam['koll'] / 2);
232prokrutkaotziv(seredina);
233}
234}
235function prokrutkaotziv(kuda) {
236if (typeof otzivivparam['koll'] !=="undefined" && otzivivparam['koll'] > 1 && typeof otzivivparam['tek'] !=="undefined" && typeof otzivivparam['blocki'] !=="undefined" && otzivivparam['blocki'].length > 0) {
237if (kuda == 'prev') {
238otzivivparam['tek'] = otzivivparam['tek'] - 1;
239} else if (kuda == 'next') {
240otzivivparam['tek'] = otzivivparam['tek'] + 1;
241} else if (kuda > 0) {
242otzivivparam['tek'] = kuda;
243}
244if (otzivivparam['tek'] > otzivivparam['koll']) {otzivivparam['tek'] = 1;} else
245if (otzivivparam['tek'] < 1) {otzivivparam['tek'] = otzivivparam['koll'];}
246$(".otzivi_viewblock .avablocks .item").removeClass("active");
247$(otzivivparam['blocki'][otzivivparam['tek'] - 1]).addClass("active");
248$(".otzivi_viewblock .opisobh").html($(otzivivparam['blocki'][otzivivparam['tek'] - 1]).find(".opis").html());
249}
250}
251
252var polzunkiparam = [];
253polzunkiparam[0] = [0,1000,' м<sup>2</sup>'];
254polzunkiparam[1] = [0,35,' м'];
255polzunkiparam[2] = [0,200,''];
256function polzunkitek() {
257if (!$(".cke_editable") || $(".cke_editable").length < 1) {
258
259if (typeof $.fn.slider !=="undefined") {
260for(ip=0;ip<3;ip++) {
261$("#calc_slide_"+(ip + 2)).slider({
262	min: polzunkiparam[ip][0],
263	max: polzunkiparam[ip][1],
264	value: polzunkiparam[ip][0],
265	range: "min",
266	stop: function(event, ui) {
267	 var tekid = getidplz(this);
268	 if (tekid > 0) {
269	 $(".plz_text_"+tekid).html(ui.value+""+polzunkiparam[(tekid - 2)][2]);
270	 }
271		$(this).parent().find("input").val(ui.value);
272    },
273    slide: function(event, ui){
274	var tekid = getidplz(this);
275	 if (tekid > 0) {
276	 $(".plz_text_"+tekid).html(ui.value+""+polzunkiparam[(tekid - 2)][2]);
277	 }
278		$(this).parent().find("input").val(ui.value);
279    },
280	 create: function( event, ui ) {
281	 var tekid = getidplz(this);
282	 if (tekid > 0) {
283	 $(this).find(".ui-state-default").append("<div class='plz_text plz_text_"+tekid+"'></div>");
284	 }
285	 }
286});
287}
288}}
289}
290
291function getidplz(slidesam) {
292var otvet = 0;
293 var tekid = $(slidesam).attr("id");
294	 if (tekid != null && tekid != 'undefined') {
295	 tekid = tekid.split("_");
296	 if (tekid.length == 3 && tekid[2] > 0) {
297	 otvet = tekid[2];
298	 }}
299return otvet;
300}
301
302function rashetlink() {
303var newlink = '/page/order_call/paramquery/rashet/';
304var pars = ['','','',''];
305for (iin=0;iin<4;iin++) {
306var tekval = $('#calc_in'+(iin + 1)).val();if (tekval == null) {tekval = '';}
307pars[iin] = tekval;
308if (iin == 0) {tekprobel = '';} else {tekprobel = '*e*';}
309newlink = newlink+''+tekprobel+''+pars[iin];
310}
311perexvatlink(newlink);
312}
313function doppolevforme(ptext) {
314if (!$(".cke_editable") || $(".cke_editable").length < 1 && ptext != '' && ptext != ' ' && ptext != '*pquery_doppoleforma*') {
315$(".ordercall").append('<div class="ndy"><div id="newssendnaz4">Раздел сайта</div><input id="newssendin4" name="newssendin4" type="text" value="'+ptext+'"></div>');
316}
317} 
318
319var polyarr = [];
320polyarr[0] = 'Тип помещения';
321polyarr[1] = 'Площадь помещения';
322polyarr[2] = 'Высота потолка';
323polyarr[3] = 'Количество людей в помещении';
324function rashetform(ptext) {
325
326if (!$(".cke_editable") || $(".cke_editable").length < 1 && ptext != '' && ptext != ' ' && ptext != '*pquery_rashet*') {
327var razdelim = ptext.split("*e*");
328var polya="";
329for (iin=0;iin<4;iin++) {
330if (typeof razdelim[iin] !=="undefined" && razdelim[iin] != '' && razdelim[iin] != ' ') {
331polya = polya+'<div id="newssendnaz'+(iin + 3)+'">'+polyarr[iin]+'</div><input id="newssendin'+(iin + 3)+'" name="newssendin'+(iin + 3)+'" type="text" value="'+razdelim[iin]+'">';
332}
333}
334$(".ordercall").append('<div class="ndy">'+polya+'</div>');
335}
336}
337
338
339var msnry;
340function mansoryblocks(icxblock,itemsel) {
341if (!$(".cke_editable") || $(".cke_editable").length < 1) {
342console.log(Masonry);
343	if (typeof Masonry !=="undefined") {
344	 msnry = new Masonry( icxblock, {
345						
346  itemSelector: itemsel
347});
348}
349}
350}
351
352var portfoliopar = [];portfoliopar['blocks'] = [];
353function portfolio() {
354if (!$(".cke_editable") || $(".cke_editable").length < 1) {
355if (portfoliopar['blocks'].length < 1) {
356var blocks = $(".workblock");
357if (blocks != null && blocks.length > 0) {
358for(ib=0;ib<blocks.length;ib++) {
359
360var blocksitem = $(blocks[ib]).find(".item");
361if (blocksitem != null && blocksitem.length > 0) {
362var teknom = portfoliopar['blocks'].length;
363var tekw = $(blocksitem[0]).width();
364var tekh = $(blocksitem[0]).width();
365if (tekw != null && tekw > 0 && tekh != null && tekh > 0) {
366portfoliopar['blocks'][teknom] = [];
367portfoliopar['blocks'][teknom]['bl'] = blocks[ib];
368portfoliopar['blocks'][teknom]['par'] = [];
369portfoliopar['blocks'][teknom]['par']['w'] = tekw;
370portfoliopar['blocks'][teknom]['par']['h'] = tekh;
371}
372}
373}
374}
375}
376if (portfoliopar['blocks'].length > 0) {
377	var razmeri = getrazmobh();
378	
379	for(ip=0;ip<portfoliopar['blocks'].length;ip++) {
380	
381var kollbvryad = Math.round(razmeri[0] / portfoliopar['blocks'][ip]['par']['w']);
382var pxobh = (kollbvryad * portfoliopar['blocks'][ip]['par']['w']);
383var razn = (razmeri[0] - pxobh) / kollbvryad; 
384
385var neww = portfoliopar['blocks'][ip]['par']['w'] + razn;
386
387var newh = (portfoliopar['blocks'][ip]['par']['w'] / neww) * portfoliopar['blocks'][ip]['par']['h'];
388$(portfoliopar['blocks'][ip]['bl']).find(".item").width(neww);
389$(portfoliopar['blocks'][ip]['bl']).find(".item").height(newh);
390}
391
392} else {setTimeout(function() { portfolio(); }, (300));}
393}
394}
395
396function phonehenerateotvet(otvets) {
397 var redirt = [];
398	  redirt[0] = 0;
399	  
400	 pokazarmess('&nbsp;','',redirt);
401if (otvets[1] == 1 || otvets[1] == '1') {
402 sodt = standartmess2('Поздравляем!','Ваш VIP код на скидку отправлен на указанный Вами Ð
402½Ð¾Ð¼ÐµÑ€, приятных покупок!');
403	  
404
405  } else  if (otvets[1] == 3 || otvets[1] == "3") {
406  if (typeof otvets[2] !=="undefined" && otvets[2] != '' && otvets[2] != ' ') {
407	  sodt = standartmess2('Ошибка!',otvets[2]);
408	  } else {
409	  sodt = standartmess2('Ошибка!','Пожалуйста подождите минуту чтобы снова послать сообщение администрации.');
410	  }
411  } else {
412	  if (typeof otvets[2] !=="undefined" && otvets[2] != '' && otvets[2] != ' ') {
413	  sodt = standartmess2('Ошибка!',otvets[2]);
414	  } else {
415	  sodt = standartmess2('Ошибка!','пожалуйста попробуйте позже или обратитесь к администратору.');
416	  }
417	  }
418 pokazarmess(sodt,'',redirt);
419}
420
421function shopsinfo(idshop) {
422if (typeof idshop =="undefined" || idshop == 0) {
423var menulist = $(".shopmenu");
424if (menulist.length > 0) {
425var tekid = $(menulist[0]).attr("id").split("_");
426if (tekid.length > 1) {
427idshop = tekid[1];
428}
429}
430}
431$(".shopmenu").removeClass("active");
432$("#shopmenu_"+idshop).addClass("active");
433
434$(".shopsam").hide();
435$("#shopblock_"+idshop).show();
436}
437
438
439
440function adreaimgs(teka) {
441	
442	var tekkartinki = $('#shopblock_'+teka+' .imgblock').html();
443	$('#imgshopblock').html(tekkartinki);
444}
445
446
447
448var kollpopitokmap = 0;
449function dopadresamap(teka,obhrazdel) {
450	if (typeof ymaps.Map !=="undefined" && typeof mapvobh !=="undefined" && typeof mapvobh.geoObjects !=="undefined") {
451		
452		var adresamass = $(".shopblocki").not('#shopblock_'+teka);
453	for(iad=0;iad<adresamass.length;iad++) {
454		var tekdanie = [];
455		var tekdaniepars = $(adresamass[iad]).find(".paramshop").html();
456		tekdaniepars = tekdaniepars.split("*end*");
457		if (typeof tekdaniepars[0] !=="undefined" && tekdaniepars[0] != '' && tekdaniepars[0] != ' ') {tekdanie['id'] = tekdaniepars[0];} else {tekdanie['id'] = '';}
458		if (typeof tekdaniepars[1] !=="undefined" && tekdaniepars[1] != '' && tekdaniepars[1] != ' ') {tekdanie['adres'] = tekdaniepars[1];} else {tekdanie['adres'] = '';}
459		if (typeof tekdaniepars[2] !=="undefined" && tekdaniepars[2] != '' && tekdaniepars[2] != ' ') {tekdanie['geo'] = tekdaniepars[2];} else {tekdanie['geo'] = '';}
460		if (typeof tekdaniepars[3] !=="undefined" && tekdaniepars[3] != '' && tekdaniepars[3] != ' ') {tekdanie['regim'] = tekdaniepars[3];} else {tekdanie['regim'] = '';}
461		tekdanie['geo'] = tekdanie['geo'].split(" ");
462		
463		 if(typeof tekdaniepars[4] !=="undefined" && tekdaniepars[4] != '' && tekdaniepars[4] != ' ') {tekdanie['nazrazdel'] = tekdaniepars[4];} else {tekdanie['nazrazdel'] = obhrazdel;}
464		
465			myPlacemark[tekdanie['id']] = new ymaps.Placemark([tekdanie['geo'][1], tekdanie['geo'][0]], {
466                content: obhrazdel,
467                balloonContent: '<strong>'+tekdanie['nazrazdel']+'</strong><br><strong>'+tekdanie['adres']+'</strong>'+tekdanie['regim']+'<br>'
468            },{
469				iconLayout: "default#image",
470iconImageHref: "/img/otmetka.png",
471iconImageSize: [35, 53],
472iconImageOffset: [-18, -53]
473});
474		mapvobh.geoObjects.add(myPlacemark[tekdanie['id']]);
475		if (typeof nugmelkbaloon !=="undefined" && nugmelkbaloon == 1) {} else {myPlacemark[tekdanie['id']].options.set({balloonPanelMaxMapArea: 0});}
476		myPlacemark[tekdanie['id']].events.add("balloonopen", function (event) {
477		//console.log(event.get('target'));
478  //openbaloon(event,tekdanie['id']);
479});
480		
481	}
482} else {
483	if (kollpopitokmap < 10) {
484  setTimeout(function() { dopadresamap(teka,obhrazdel) }, (500));
485  kollpopitokmap = kollpopitokmap + 1
486	}
487}
488	
489}
490
491
492function menuactive(menud,blockd) {
493 var heightt = $(menud+" ul").innerHeight();
494var padb = $(blockd).css("padding-bottom");
495padb = padb.split("px").join("");padb = padb - 0;
496if (typeof padb =="undefined" || padb < 1) {padb = 0;} 
497$(menud).addClass("active");
498$(blockd).css({"min-height":(heightt+padb)+"px"});
499}
500
501function playvideo(kotor) {
502		var hablonv = [];
503	hablonv['vo'] = '<iframe src="http://player.vimeo.com/video/*idvideo*?autoplay=1&amp;title=0&amp;byline=0&amp;portrait=0&amp;color=00adef" width="549" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';	
504	hablonv['you'] = '<iframe width="785" height="439" src="//www.youtube.com/embed/*idvideo*?autoplay=1&amp;rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>';
505	var parametri1 = $("#videoblock_"+kotor+" .paramvideo").html();
506	if (parametri1 != null && parametri1 != 'undefined' && parametri1 != '' && parametri1 != ' ') {
507	var parametri = parametri1.split("*v*");
508	if (parametri.length < 2) {parametri[0] ='you';parametri[1] =parametri1;}
509	if (typeof hablonv[parametri[0]] !=="undefined") {
510	videonax = hablonv[parametri[0]].replace("*idvideo*",parametri[1]);
511	
512	var sodt = '<div style="font-size:0px">'+videonax+'</div>';
513 var redirt = [];
514	  redirt[0] = 0;
515	  pokazarmess(sodt,'',redirt);
516	}
517	}
518	}
519	
520	var listactvcal = [];
521	var actvitem = [];
522	var actvitemblock = [];
523	actvitem[0] = '<li id="*id*" onclick="viboractv(*numyr*,\'*znah*\')">*val*</li>';
524	actvitemblock[0] = '<ul>*listitem*</ul>';
525	actvitem[1] = '<option id="*id*" value="*znah*">*val*</option>';
526	actvitemblock[1] = '<select class="actvs" onchange="viboractv(*numyr*,this.value);"><option  value="0">Выбрать</option>*listitem*</select>';
527	var hactv = 0;
528	var actvblocks = ['Year','Mounth','Day','Time','info'];
529	var actvActiveLevel = [];
530	function viboractv(tip,znah) {
531	$("#infoActin4").val(0);
532	if (typeof listactv !=="undefined" && listactv.length > 0) {
533	if (tip == 0 && znah == 0) {
534
535	var indexel = '';
536for(iac=0;iac<listactv.length;iac++) 
537{
538
539var tektime = new Date(timeZone(listactv[iac]['times'],3)*1000);
540var datestek = [];
541datestek[0] = tektime.getFullYear();
542if (iac == 0) {indexel = datestek[0];}
543datestek[1] = tektime.getMonth() + 1;
544datestek[2] = tektime.getDate();
545datestek[3] = getNs(tektime.getHours())+":"+getNs(tektime.getMinutes());
546
547if (typeof listactvcal[datestek[0]] =="undefined") {listactvcal[datestek[0]] = [];} 
548if (typeof listactvcal[datestek[0]][datestek[1]] =="undefined") {listactvcal[datestek[0]][datestek[1]] = [];} 
549if (typeof listactvcal[datestek[0]][datestek[1]][datestek[2]] =="undefined") {listactvcal[datestek[0]][datestek[1]][datestek[2]] = [];} 
550if (typeof listactvcal[datestek[0]][datestek[1]][datestek[2]][datestek[3]] =="undefined") {listactvcal[datestek[0]][datestek[1]][datestek[2]][datestek[3]] = [];} 
551listactvcal[datestek[0]][datestek[1]][datestek[2]][datestek[3]][listactvcal[datestek[0]][datestek[1]][datestek[2]][datestek[3]].length] = listactv[iac]['id'];
552}
553
554if (Object.keys(listactvcal).length > 0 && indexel != '' && indexel != ' ') {
555viboractv(0,1);
556viboractv(1,indexel);
557}
558
559} else {
560if (tip != 0) {
561$('.lineVibr'+actvblocks[tip - 1]+' li').removeClass("active");
562$('#actv_'+tip+'_'+replacer(":","-",znah)).addClass("active");
563if (typeof hactv !=="undefined" && hactv == 1) {
564var listoption = $('.lineVibr'+actvblocks[tip - 1]+' option');
565if (listoption != null && listoption.length > 0) {
566for(ioi=0;ioi<listoption.length;ioi++) {
567if ($(listoption[ioi]).hasClass("active")) {$('.lineVibr'+actvblocks[tip - 1]+' select').get(0).selectedIndex = ioi;}
568}
569}
570
571} 
572actvActiveLevel[tip - 1] = znah;
573if (typeof actvActiveLevel[tip] !=="undefined") {
574for(iac=tip;iac<actvActiveLevel.length;iac++){
575actvActiveLevel.splice(iac,1);
576}}
577}
578//console.log(print_r(actvActiveLevel));
579var activearray = [];
580if (tip == 1 || tip == 0) {activearray = listactvcal;} else
581if (tip == 2) {activearray = listactvcal[actvActiveLevel[0]];} else
582if (tip == 3) {activearray = listactvcal[actvActiveLevel[0]][actvActiveLevel[1]];} else
583if (tip == 4) {activearray = listactvcal[actvActiveLevel[0]][actvActiveLevel[1]][actvActiveLevel[2]];}
584if ((typeof activearray[znah] !=="undefined" && Object.keys(activearray[znah]).length > 0) || (tip == 0 && typeof activearray !=="undefined" && Object.keys(activearray).length > 0)) {
585if (tip != 4){
586var htmldoplevel = '';
587if (tip == 0){var activearrayFor = activearray;} else {
588var activearrayFor = activearray[znah];}
589//console.log(print_r(activearray));
590
591	var addkoll = 0;
592	
593for (var key in activearrayFor) {
594
595var massz = [];massz['icx'] = [];massz['zam'] = [];
596massz['icx'][0] = '*znah*';
597massz['zam'][0] = key;
598massz['icx'][1] = '*id*';
599massz['zam'][1] = 'actv_'+(tip + 1)+'_'+replacer(":","-",key);
600massz['icx'][2] = '*numyr*';
601massz['zam'][2] = (tip + 1);
602massz['icx'][3] = '*val*';
603if (tip == 1 && typeof messnaz2 !=="undefined" && typeof messnaz2[(key - 0)] !=="undefined") {massz['zam'][3] = messnaz2[(key - 0)];} else if (tip == 2) {massz['zam'][3] = getNs(key);} else {massz['zam'][3] = key;}
604
605htmldoplevel = htmldoplevel+''+replacer(massz['icx'],massz['zam'],actvitem[hactv]);
606addkoll += 1;
607	if (tip == 0 && addkoll > 1) {
608		$("."+actvblocks[tip]+"v").show();
609		console.log("."+actvblocks[tip]+"v");
610	}
611}
612
613if (htmldoplevel != '' && htmldoplevel != ' ') {
614htmldoplevel = replacer(['*numyr*','*listitem*'],[(tip + 1),htmldoplevel],actvitemblock[hactv]);
615
616$(".lineVibr"+actvblocks[tip]).html(htmldoplevel);
617if(tip != 0){$("."+actvblocks[tip]+"v").fadeIn();}
618if(tip != 0 && tip != 1){scrollobject($("."+actvblocks[tip]+"v"));}
619}
620for(iacc=(tip+1);iacc<actvblocks.length;iacc++){
621$("."+actvblocks[iacc]+"v").hide();
622}
623} else {
624$("."+actvblocks[tip]+"v").fadeIn();scrollobject($("."+actvblocks[tip]+"v"));
625$("#infoActin4").val(activearray[znah][0]);
626}
627}
628
629}
630	}
631	}
632	if (typeof actvzapisReturn !=="undefined") {
633	actvzapisReturn[0] = ['Поздравляем!','Вы успешно зарегистрировались на экскурсию, наш менеджер скоро свяжется с вами.'];
634	actvzapisReturn[1] = ['Поздравляем!','Вы успешно зарегистрировались на экскурсию.'];
635	}
636	
637	function scrollv(){
638	setTimeout(function() {scrollobject('.tovarpage .videoblock');}, (500));
639	}
640	
641	function perekluhatelitovar(idtek) {
642	var links = ['',''];
643	if (idtek > 0) {
644	var items = $("#contentblockobh .tovarlist .item");
645	if (items != null && items.length > 0) {
646	for(iit=0;iit<items.length;iit++) {
647	var tekid = $(items[iit]).attr("id");
648	if (tekid != null && tekid == 'tovar_'+idtek) {
649	if(iit > 0){links[0] = $(items[iit - 1]).find("a").attr("href");}
650	if(typeof items[iit + 1] !=="undefined"){links[1] = $(items[iit + 1]).find("a").attr("href");}
651	}
652	}
653	
654	}
655	
656	}
657
658	var newhtmlstr = '';
659	for(iitt=0;iitt<2;iitt++) {
660	if (links[iitt]!= null && links[iitt] != '' && links[iitt] != ' ') {
661	 newhtmlstr = newhtmlstr+'<a href="'+links[iitt]+'" onclick="perexvatlink(this,\'\',2,1);return false;" class="str'+(iitt + 1)+'"></a>';
662	}}
663	$(".tovarpage .strelki").html(newhtmlstr);
664	}
665	
666	
667		function ageprov() {
668		var tekage = getCookie('ageprov_visits');
669		//tekage = 0;
670if (!tekage || tekage == '' || tekage == ' ' || tekage < 1 ) {
671$(".newmessobh").addClass("alter");
672var redirt = [];
673	  redirt[0] = 0;
674	  sodt = '<div id="oldBlock-popup" class="oldBlock2"><div class="wrapper"></div><div class="overlay-popup"><div class="logo"><img src="/img/logo.png?rand=123"></div><div class="hello">'+age_vals[0]+'</div><div class="question font_big">'+age_vals[1]+'</div><ul class="buttons"><li><a href="#" onclick="ageprovclose();return false;" class="button">'+age_vals[2]+'</a></li><li><a href="http://вятскийквас.рф" class="button">'+age_vals[3]+'</a></li></ul>	</div></div>';
675	  pokazarmess(sodt,'',redirt,1);
676} else {
677setCookie('ageprov_visits',1, { expires: (7*60) });
678}
679	}
680
681	var age_vals = ['Рады видеть вас на сайте пивоваренного завода Вятич','Исполнилось ли вам 18 лет?','Да','Нет'];
682	function ageprovclose() {
683		setCookie('ageprov_visits',1, { expires: (7*60) });
684		meszakr();
685		// setTimeout(function() {
686
687		// 	if ($("#no_promo_popup").length == 0) {
688		// 	//$(".newmessobh").removeClass("alter");
689			
690		// 	var redirt = [];
691		// 	  redirt[0] = 0;
692
693		// 	  sodt = '<div id="oldBlock-popup" class="oldBlock2 promo  benguiat kvadrat"><div class="wrapper"></div><div class="overlay-popup"><div class="logo"><img src="/img/logo.png?rand=123"></div><div class="hello"><span class="big">Помоги Вятичу сделать новый сорт пива.<br><br><b>Прими участие в опросе</b></span></div><ul class="buttons"><li><a href="/news/Pomogi_Vyatichu_sdelat_novyy_sort_piva_Primi_uchastie_v_oprose/" onclick="promoclose();" target="_self" class="button">Участвовать</a></li><li><a href="#" onclick="promoclose();return false;" class="button" style="">Пропустить</a></li></ul>	</div></div>';
694		// 	  $(".newmessobh"); pokazarmess(sodt,'',redirt,1);
695
696		// 	}
697
698		// }, (500));
699	}
700
701	function promoclose() {
702		meszakr();
703		setTimeout(function() {
704
705			$(".newmessobh").removeClass("promo");
706		}, 400);
707	}
708	
709	function anketa() {
710	$(".anketa").show();
711	$(".vacant").hide();
712	}
713	
714	function actvintime(num) {
715	var menuitem = $(".actv_list_block .menu .Period li");
716	if (typeof num =="undefined" || num < 1) {num = 0;}
717	var numtime = num;
718	if (numtime > 0) {
719	$(".actv_list_block .menu .Period li").removeClass("active");
720	$(".actv_list_block .menu .Period li:eq("+(numtime - 1)+")").addClass("active");
721	}
722	if (menuitem != null && menuitem.length > 0) {
723	for (imi=0;imi<menuitem.length;imi++) {
724	if ($(menuitem[imi]).hasClass("active")) {numtime = imi + 1;}
725	}
726	if (numtime > 0) {
727	var tekdate =  new Date();
728	var dopdate =  new Date();
729	var dates = [];
730	if (numtime == 1) {dates[0] = tekdate; dopdate.setDate(dopdate.getDate() + 1);dates[1] = dopdate;} else 
731	if (numtime == 2) {tekdate.setDate(tekdate.getDate() + 1);dates[0] = tekdate; dopdate.setDate(dopdate.getDate() + 2);dates[1] = dopdate;} else 
732	if (numtime == 3) {dates[0] = tekdate; dopdate.setDate(dopdate.getDate() + 7);dates[1] = dopdate;} else 
733	if (numtime == 4) {dates[0] = tekdate; dopdate.setDate(dopdate.getDate() + 31);dates[1] = dopdate;}
734	$("#timeinp_1").val(getNs(dates[0].getUTCMonth() + 1)+"/"+getNs(dates[0].getDate())+"/"+dates[0].getUTCFullYear());
735	$("#timeinp_2").val(getNs(dates[1].getUTCMonth() + 1)+"/"+getNs(dates[1].getDate())+"/"+dates[1].getUTCFullYear());
736	getactvintime();
737	
738	}
739	}
740	}
741	function getactvintime() {
742	var times = [$("#timeinp_1").val(),$("#timeinp_2").val()];
743	var unixtime = [0,0];
744	var listid = '0';
745for(idu=0;idu<2;idu++) {
746times[idu] = times[idu].split("/");
747if (times[idu].length == 3) {
748unixtime[idu] = Math.round(new Date(times[idu][2],(times[idu][0] - 1),times[idu][1],0,0,0).getTime() / 1000);
749if (unixtime[idu] > 0){unixtime[idu] = unixtime[idu] + gettimezonedelta();unixtime[idu] = unixtime[idu] + 3;}
750}
751}
752var newval = '';
753if (unixtime[0] > 0) {
754if(unixtime[1] > 0 ){newval = unixtime[0]+'-'+unixtime[1];} else {newval = unixtime[0]+'->';}
755}
756if (newval != '' && newval != ' ') {
757n = 10000;randnax = Math.floor( Math.random() * (n+1) );
758var paramZap = {};
759paramZap["ajax"] = "1";
760paramZap["rand"] = randnax;
761paramZap["tipsave"] = 'funcRequest';
762paramZap["din1"] = '{func}activities,3,timez*param*timestart*param*'+newval+'*param*hablon*param*activities_json{/func}';
763paramZap["din2"] = 0;
764
765$.post('/saver.php',  paramZap,
766  function(data){
767  data = '*endotvet*'+data;
768var otv = parsjsonotvet(data);
769
770if (otv[1] == 0) {
771if (otv[0].length > 0) {
772for (iad=0;iad<otv[0].length;iad++) {listid = listid+'*p*'+otv[0][iad];}
773}
774}
775getactvintimeList(listid);
776
777  });
778}
779
780
781
782	}
783	var actvintimeList = [];
784	var statnaz = ['Не проверена','Одобрена','Заблокирована','Пропущена, но не проверена'];
785	function getactvintimeList(listid) {
786	if (typeof listid !=="undefined" && listid != '' && listid != ' ') {
787n = 10000;randnax = Math.floor( Math.random() * (n+1) );
788var paramZap = {};
789paramZap["ajax"] = "1";
790paramZap["rand"] = randnax;
791paramZap["tipsave"] = 'funcRequest';
792paramZap["din1"] = '{func}activitiesList,1,idz*param*ida*param*'+listid+'{/func}';
793paramZap["din2"] = 0;
794
795$.post('/saver.php',  paramZap,
796  function(data){
797  razdelimotvet = data.split("*endotvet*");
798  if (typeof razdelimotvet[1] !=="undefined" && razdelimotvet[1] != '' && razdelimotvet[1] != ' ') {
799  $(".listactvsam").html(razdelimotvet[1]);
800  var listItem = $(".listactvsam .item");
801  actvintimeList = [];
802  if (listItem != null && listItem.length > 0) {
803  for(ili=0;ili<listItem.length;ili++) {
804  var tekparam = $(listItem[ili]).find(".param").html();
805  if (tekparam != null && typeof tekparam =="string"){tekparam = tekparam.split("*par*");} else {tekparam = [0];}
806  var tekida = 0;if (typeof tekparam[1] !=="undefined"){tekparam[1] = tekparam[1] - 0;} else {tekparam[1] = 0;}
807  if (tekparam[1] > 0) {
808  tekida = tekparam[1];
809  }
810 if (typeof tekparam[6] !=="undefined" && typeof statnaz[tekparam[6]] !=="undefined"){$(listItem[ili]).find(".stat").html(statnaz[tekparam[6]]);}
811  if (tekida > 0 && typeof listactvId !=="undefined" && typeof listactvId[tekida] !=="undefined" && listactvId[tekida]>=0) {
812  actvintimeList[tekparam[0]] = tekparam;
813  var tekdate = unixtimeconverter(listactv[listactvId[tekida]]["times"],'',3);
814   $(listItem[ili]).find(".date").html(getNs(tekdate['d'])+'.'+getNs(tekdate['mm'])+'.'+tekdate['y']);
815    $(listItem[ili]).find(".time").html(getNs(tekdate['h'])+':'+getNs(tekdate['m']));
816
817  } else {
818 // $(listItem[ili]).find(".linkred").hide();
819  }
820  
821  }
822  }
823  
824  }
825  
826  });
827}
828}
829
830var editacvHablon = '<div class="redActv"> <div class="item" id="val_0"><span class="name">id:</span><div class="inp"><span class="zamena">*p_0*</span><label><input type="text" class="dan ndy" value="*p_0*"></label></div></div> <div class="item" id="val_3"><span class="name">Фамилия имя:</span><div class="inp"><label><input type="text" class="dan" value="*p_3*"></label></div></div> <div class="item" id="val_4"><span class="name">Телефон:</span><div class="inp"><label><input class="inText" id="zamena2" onchange="phonefix(this,\'#phonein\');" onkeyup="phonefix(this,\'#phonein\');"  type="text" value="*p_4*" /></label> <label><label><input type="text" class="dan ndy" id="phonein" value="*p_4*"></label></div></div> <div class="item" id="val_6"><span class="name">Кол-во:</span><div class="inp"><label><input type="text" class="dan" value="*p_8*"></label></div></div> <div class="item" id="val_1"><span class="name">Экскурсия:</span><div class="inp nobg"> <div class="Yearv"><div class="lineVibrYear"></div></div><div class="Mounthv"><div class="lineVibrMounth"></div></div><div class="Dayv"><div class="lineVibrDay"></div></div><div class="Timev"><div class="lineVibrTime"></div></div> <label>
830<input type="text" id="infoActin4" class="dan ndy" value="*p_1*"></label></div></div> <div class="item ndy" id="val_2"><span class="name">id пользователя:</span><div class="inp"><label><input type="text" class="dan" value="*p_2*"></label></div></div> <div class="item ndy" id="val_5"><span class="name">e-mail:</span><div class="inp"><label><input type="text" class="dan" value="*p_5*"></label></div></div> <div class="item" id="val_7"><span class="name">Статус:</span><div class="inp nobg"><select class="dan" ><option value="0" selected="selected">Не проверена</option><option value="1" selected="selected">Одобрена</option><option value="2">Заблокирована</option><option value="3">Пропущена, но не проверена</option></select></div></div> <div class="item ndy" id="val_8"><span class="name">ip:</span><div class="inp"><label><input type="text" class="dan" value="*p_7*"></label></div></div> <div class="butblock"> <a href="#" class="but" onclick="editactvintimeList(0,1);return false;">Сохранить</a><a href="#" class="but" onclick="editactvintimeList(0,2);return false;">Удалить</a><a href="#" onclick="meszakr();return false;" class="but">Закрыть</a> </div> <script>if (typeof $.fn.mask !=="undefined") {if(!$(".cke_editable") || $(".cke_editable").length < 1){$("#zamena2").mask("+7 (999) 999-9999");}}</script> </div>';
831	
832function editactvintimeList(kotor,kak) {
833if (typeof kak =="undefined" || kak < 1) {kak = 0;}
834if (kak == 0) {
835
836if (typeof actvintimeList[kotor] =="undefined" || actvintimeList[kotor].length < 2) {
837var tekparam = $("#newList").html();
838  if (tekparam != null && typeof tekparam =="string"){tekparam = tekparam.split("*par*");} else {tekparam = [0];}
839  actvintimeList[tekparam[0]] = tekparam;
840}
841var zameni = [];zameni['icx'] = [];zameni['zam'] = [];
842//console.log(print_r(actvintimeList));
843if (typeof actvintimeList[kotor] !=="undefined" && actvintimeList[kotor].length > 0) {
844for(ipp=0;ipp<10;ipp++) {
845zameni['icx'][zameni['icx'].length] = '*p_'+ipp+'*';
846var tekzamena = '';
847if (typeof actvintimeList[kotor][ipp] !=="undefined" && actvintimeList[kotor][ipp] != '' && actvintimeList[kotor][ipp] != ' ') {tekzamena = actvintimeList[kotor][ipp];}
848zameni['zam'][zameni['zam'].length] = tekzamena;
849}
850var redirt = [];
851	  redirt[0] = 0;
852	  sodt = editacvHablon;
853	  sodt = replacer(zameni['icx'],zameni['zam'],editacvHablon);
854	  pokazarmess(sodt,'',redirt);
855	  hactv = 1;
856if (typeof viboractv !=="undefined"){viboractv(0,0);}
857var tekida = actvintimeList[kotor][1];
858if (tekida > 0 && typeof listactvId !=="undefined" && typeof listactvId[tekida] !=="undefined" && listactvId[tekida]>=0) {
859  var tekdate = unixtimeconverter(listactv[listactvId[tekida]]["times"],'',3);
860  setTimeout(function() { viboractv(2,getNs(tekdate['mm']));
861  setTimeout(function() { viboractv(3,(tekdate['d'] - 0));
862  setTimeout(function() { viboractv(4,getNs(tekdate['h'])+':'+getNs(tekdate['m']));}, (30));
863  }, (30));
864  }, (30));
865  
866
867  }
868
869}
870} else if (kak == 1 || kak == 2) {
871
872var zameni = [];zameni['icx'] = [];zameni['zam'] = [];
873for(ipp=0;ipp<10;ipp++) {
874zameni['icx'][zameni['icx'].length] = '*p_'+ipp+'*';
875var tekzamena2 = '';
876var tekzamena = $("#val_"+ipp+" .dan").val();
877if (typeof tekzamena !=="undefined" && tekzamena != null && tekzamena != '' && tekzamena != ' ') {tekzamena2 = tekzamena;}
878zameni['zam'][zameni['zam'].length] = tekzamena2;
879}
880
881n = 10000;randnax = Math.floor( Math.random() * (n+1) );
882var paramZap = {};
883paramZap["ajax"] = "1";
884paramZap["tips"] = kak;
885paramZap["hablonsave"] = "activities_list";
886paramZap["estdopvar"] = "0";
887paramZap["stringdop"] = "n";
888paramZap["changesaveblocki"] = "0";
889paramZap["rand"] = randnax;
890paramZap["infoss"] = '*p_0**end**p_1**end**p_2**end**p_3**end**p_4**end**p_5**end**p_6**end*1*end**p_8*';
891paramZap["infoss"] = replacer(zameni['icx'],zameni['zam'],paramZap["infoss"]);
892
893$.post('/admin/saveredaktor.php',  paramZap,
894  function(data){
895  razdelimotvet = data.split("*endotvet*");
896    if (typeof razdelimotvet[1] =="undefined" || razdelimotvet[1] != '1' || razdelimotvet[1] != 1) {
897	
898	var redirt = [];
899	  redirt[0] = 0;
900	  sodt = standartmess2('Ошибка!','пожалуйста попробуйте позже или обратитесь к администратору.');
901	  pokazarmess(sodt,'',redirt);
902	} else {
903	actvintime(0);meszakr();
904	}
905  });
906}
907
908}
909
910function mobilefixsl() {
911$("#imagesliderfull").addClass("fixmobile");
912}	
913
914function imgRamka() {
915$(".jsibox").closest('a').addClass("grouped_elements");
916}
917
918function perebroskoment() {
919location.href="/razdel/Otzyvy_ob_ekskursiyakh/";
920}
921
922
923function userScriptSended(script_id, step_id, previusStep_id) {
924
925	if (typeof script_id == 'undefined' || script_id < 1) {script_id = 0;}
926	if (typeof step_id == 'undefined' || step_id < 1) {step_id = 0;}
927	if (typeof previusStep_id == 'undefined' || previusStep_id < 1) {previusStep_id = 0;}
928
929	if (typeof sctipts[script_id] != 'undefined' && typeof sctipts[script_id]['steps'][step_id] != 'undefined') {
930
931		if (typeof sctipts[script_id][previusStep_id] != 'undefined') {
932
933			if (typeof sctipts[script_id]['steps'][previusStep_id]['question'] != 'undefined' && typeof sctipts[script_id]['steps'][previusStep_id]['question']['view_type'] != 'undefined' && sctipts[script_id]['steps'][previusStep_id]['question']['view_type'] == 'window') {
934				// meszakr();
935			}
936
937		}
938
939			if (!$(".script_test_page").hasClass("inline_mode_active") && typeof sctipts[script_id]['steps'][step_id]['question'] != 'undefined' && typeof sctipts[script_id]['steps'][step_id]['question']['view_type'] != 'undefined' && sctipts[script_id]['steps'][step_id]['question']['view_type'] == 'inline') {
940				scriptInlineMode();
941			}
942
943	}
944
945
946
947	scriptLoader();
948
949
950
951}
952
953function scriptInlineMode() {
954
955	$(".script_test_page").addClass("inline_mode_active");
956	
957	meszakr();
958	scriptLoader(true);
959
960}
961
962function scriptLoader(active) {
963
964	if (typeof active == 'undefined' || active != true) {active = false;}
965
966	if (active) {
967		setTimeout(function() { 
968		
969			$(".load_mode .view_block .line_screen .content-chat .loader").remove();
970			$(".load_mode .view_block .line_screen .content-chat").append('<div class="loader"><object id="graph" name="graph" type="image/svg+xml" data="/uploads/img/test/banner.svg?rand=12345" width="" height=""></object></div>');
971			$(".script_test_page").addClass("load_mode");
972
973		}, 200);
974
975	} else {
976
977		var loader_block = $(".load_mode .view_block .line_screen .content-chat .loader");
978		
979
980		if (loader_block.length > 0) {
981			
982			$(".script_test_page").removeClass("load_mode");
983			loader_block.remove();
984			is_repeat_loader = false;
985
986		} else {
987
988			if (!is_repeat_loader) {
989				setTimeout(function() { is_repeat_loader = true;scriptLoader(false); }, 200);
990			} else {
991				is_repeat_loader = false;
992			}
993
994		}
995
996	}
997
998
999}
1000
1001var is_repeat_loader = false;
1002 
1003function userScriptSend(script_id, step_id) {
1004
1005	if (typeof script_id == 'undefined' || script_id < 1) {script_id = 0;}
1006	if (typeof step_id == 'undefined' || step_id < 1) {step_id = 0;}
1007
1008	scriptLoader(true);
1009
1010}
1011
1012
1013function sharebutton() {
1014
1015	var redirt = [];
1016	var sodt = '<div class="share_block"><div class="pluso" data-background="transparent" data-options="big,square,line,horizontal,counter,theme=04" data-services="vkontakte,odnoklassniki,facebook,twitter"></div></div>';
1017						    redirt[0] = 0;
1018						    redirt[1] =  "";
1019					  		pokazarmess(sodt,'',redirt);
1020
1021					  		setTimeout(function() {
1022					  			if (typeof pluso != 'undefined' && typeof pluso.start != 'udefined') {
1023						  			pluso.start();
1024						  		}
1025					  		}, 500);
1026					  		
1027}
1028
1029function scriptBeforePrint(scriptArr, returnFunc, params) {
1030
1031	if (typeof scriptArr['current_step']['action']['beforePrint']['params'] != 'undefined' && scriptArr['current_step']['action']['beforePrint']['params'] != null && typeof scriptArr['current_step']['action']['beforePrint']['params']['sleep'] != 'undefined') {
1032
1033		var seconds = (scriptArr['current_step']['action']['beforePrint']['params']['sleep'] - 0) * 1000;
1034
1035		if (seconds > 0) {
1036
1037			scriptLoader(true);
1038
1039			setTimeout(function() {
1040					  			
1041					  			requestFunc(returnFunc, params);
1042					  			
1043					  		}, seconds);
1044
1045		} else {
1046			requestFunc(returnFunc, params);
1047		}
1048
1049	} else {
1050		requestFunc(returnFunc, params);
1051	}
1052}
1053
1054function changeSex(step) {
1055
1056	var sex = 0;
1057
1058	if (typeof step == 'object') {
1059
1060		if (typeof step['action']['history_print']['params'] != 'undefined' && step['action']['history_print']['params'] != null && typeof step['action']['history_print']['params']['sex'] != 'undefined') {
1061			sex = (step['action']['history_print']['params']['sex'] - 0);
1062		}
1063
1064	} else if (typeof step == 'string') {
1065		sex = step - 0;
1066	}
1067
1068
1069
1070	if (!isNaN(sex) && (sex == 1 || sex == 2)) {
1071		$(".script_test_page").addClass("sex_"+sex);
1072	}
1073
1074
1075}
1076
1077function openNewForm(hide_block, slice_block, speed) {
1078	
1079	if (typeof speed == 'undefined' || (speed != 'slow' || speed != 'fast')) {
1080		speed = "normal";
1081	}
1082	
1083	$(hide_block).hide();
1084	$(slice_block).slideToggle(speed);
1085
1086}
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142var formListParams = [];
1143
1144	formListParams['timer']         = 5000;
1145	formListParams['limit']         = 40;
1146	formListParams['title_names']   = {'id': 'id', 'title': 'Название', 'ip': 'ip', 'time': 'Время', 'time_start': 'Время начала', 'time_end': 'Время окончания'};
1147	formListParams['mobile_screen'] = false;
1148
1149	formListParams['page']             = 1;
1150	formListParams['end_time_in_page'] = 0;
1151	formListParams['total_items']      = 0;
1152	formListParams['diapozone']        = [0, 0, 0];
1153	formListParams['totals_loads']     = [0, 0, 0]
1154
1155	formListParams['send_params_list'] = [];
1156		formListParams['send_params_list']['time']       = [[0, 0, 0], [0, 0, 0]];
1157		formListParams['send_params_list']['view']       = 'all';
1158		formListParams['send_params_list']['type']       = 'all';
1159		formListParams['send_params_list']['source']     = 'all';
1160		formListParams['send_params_list']['view_save']  = 'manual';
1161		formListParams['send_params_list']['view_deleted'] = 'no';
1162		formListParams['send_params_list']['view_hidden']  = 'no';
1163	
1164
1165	formListParams['sites']          = ['vyatich.ru'];
1166	formListParams['source']         = {'meha': 0};
1167	formListParams['end_id_in_page'] = [0, 0, 0];
1168	formListParams['list_select']    = [['#selects_view_select', 'view'], ['#selects_view_save_select', 'view_save'], ['#selects_view_deleted_select', 'view_deleted'], ['#selects_view_hidden_select', 'view_hidden']];
1169
1170	formListParams['action_list']    = [];
1171
1172	formListParams['titles']            = []; 
1173	formListParams['titles_query']      = []; 
1174	formListParams['titles_query_save'] = [];
1175
1176
1177	formListParams['errors_translate'] = ['Ошибка обновновления'];
1178
1179var formList_list = [];
1180
1181var formList_list_isReact = [];
1182	formList_list_isReact['list']              = [];
1183	formList_list_isReact['errors']            = [0, 0, 0];
1184	formList_list_isReact['list_deleted']      = [];
1185	formList_list_isReact['list_view_recover'] = [0, 0, 0];
1186
1187var formsListHtml = [];
1188	
1189	formsListHtml['titles_tr'] = '<div class="titles tr">*list*<div id="titles_check" class="td t_check"><input type="checkbox" onclick="updateFormsList_checked_all(this);"></div></div>';
1190	formsListHtml['titles_td'] = ' <div id="titles_*prefix*" class="td title_td t_*prefix* *hidden_class*" style="*size*"><div class="hider_block"><a href="#" onclick="hidden_tds(this);return false;">Скрыть</a></div><div class="name">*val*</div></div>';
1191
1192	formsListHtml['search_tr'] = '<div class="search tr">*list*<div id="search_but" class="td s_check"><input type="submit" onclick="updateFormsList_search(true);return false;" value="Найти"></div></div>';
1193	formsListHtml['search_td'] = ' <div id="search_*prefix*" class="td search_td s_*prefix* *hidden_class*" style="*size*">*val*</div>';
1194	formsListHtml['search_inputs'] = [];
1195
1196		formsListHtml['search_inputs'][1] = '<label><input type="text" class="*class*" id="search_val_*prefix*" onchange="updateFormsList_search(false);"  onkeyup="updateFormsList_search(false);" value="*old_val*"></label>';
1197		
1198		formsListHtml['search_inputs_types'] = [];
1199			formsListHtml['search_inputs_types']['default'] = [1, ''];
1200			formsListHtml['search_inputs_types']['id']      = [1, 'numerics'];
1201			formsListHtml['search_inputs_types']['strings_Telefon'] = [1, 'phone'];
1202			formsListHtml['search_inputs_types']['ip']      = [1, 'ip'];
1203			formsListHtml['search_inputs_types']['time']    = [1, 'date'];
1204			formsListHtml['search_inputs_types']['strings_Sms_kod'] = [1, 'numerics'];
1205
1206	formsListHtml['search_query'] = '';
1207
1208	formsListHtml['vals_tr'] = '<div class="vals tr *state* line_query_*page*" id="line_*query_num*_*id*">*list*<div id="check_*query_num*_*id*" class="td check_block"><input type="checkbox" onclick="updateFormsList_checked();"></div></div>';
1209	formsListHtml['vals_td'] = '<div id="vals_*prefix*" class="td v_*prefix* *hidden_class*">*val*</div>';
1210
1211	formsListHtml['vals_pusto'] = '<div class="no_data">К сожалению, не найдено ни одной записи, попробуйте поменять условия поиска.</div>'
1212
1213	formsListHtml['next_button'] = '<a href="#" onclick="updateFormsListNextPage();return false;" class="next_button">Загрузить еще</a>';
1214
1215	formsListHtml['total'] = '<div class="total">Загружено <span class="current">*current*</span> из <span class="all">*total*</span></div>';
1216
1217	formsListHtml['empty_arr'] = {'prefix': 'empty', 'val': ' - '}; 
1218
1219	formsListHtml['time'] = '*dd*.*mm*.*yyyy* *h*:*m*';
1220
1221	formListParams['explort'] = [];
1222		formListParams['explort']['titles']          = [];
1223		formListParams['explort']['list']            = [];
1224		formListParams['explort']['query']           = null;
1225		formListParams['explort']['file_folder']     = 'uploads/arxiv/';
1226		formListParams['explort']['total_lines']     = 0;
1227		formListParams['explort']['old_query_param'] = [];
1228
1229	formsListHtml['hidden_blocks'] = [];
1230
1231
1232
1233function hidden_tds(block) {
1234
1235	var id = ($(block).closest(".title_td").attr("id")+"").split("titles_");
1236
1237		if (id.length == 2 && id[1] != '' && id[1] != ' ') {
1238			
1239			id = id[1];
1240
1241			$(".forms_block .list .t_"+id+", .forms_block .list .v_"+id+", .forms_block .list .s_"+id).addClass("hidden");
1242			updateFormsList_addHiddenBlock(id);
1243			
1244		}
1245
1246}
1247
1248function updateFormsList_addHiddenBlock(id) {
1249
1250	formsListHtml['hidden_blocks'][ formsListHtml['hidden_blocks'].length ] = id;
1251
1252	setCookie("hidden_blocks", formsListHtml['hidden_blocks'].join(","), { expires: (365*24*60*60) });
1253	updateFormsList_formirate_hidden_list();
1254
1255}
1256
1257function updateFormsList_removeHiddenBlock(id) {
1258
1259	var new_arr = [];
1260
1261		for (var i = 0; i < formsListHtml['hidden_blocks'].length; i++) {
1262
1263			if (formsListHtml['hidden_blocks'][i] != id) {
1264				new_arr[ new_arr.length ] = formsListHtml['hidden_blocks'][i];
1265			}
1266
1267		}
1268
1269	$(".forms_block .list .t_"+id+", .forms_block .list .v_"+id+", .forms_block .list .s_"+id).removeClass("hidden");
1270
1271	formsListHtml['hidden_blocks'] = new_arr.slice();
1272
1273	setCookie("hidden_blocks", formsListHtml['hidden_blocks'].join(","), { expires: (365*24*60*60) });
1274
1275	updateFormsList_formirate_hidden_list();
1276
1277}
1278
1279function updateFormsList_formirate_hidden_list() {
1280
1281	list_hiddens = '';
1282
1283	if (formsListHtml['hidden_blocks'].length > 0) {
1284
1285		for (var i = 0; i < formsListHtml['hidden_blocks'].length; i++) {
1286
1287			if ($("#titles_"+formsListHtml['hidden_blocks'][i]).length > 0) {
1288
1289				var current_name = $("#titles_"+formsListHtml['hidden_blocks'][i]).find(".name").html();
1290				list_hiddens += '<div class="hiddens_menu"><a href="#" onclick="updateFormsList_removeHiddenBlock(\''+formsListHtml['hidden_blocks'][i]+'\');return false;">'+current_name+'</div>';
1291
1292			}
1293
1294		}
1295
1296	}
1297
1298	$(".forms_block .sort_block .view_hidden_td").remove();
1299	
1300	if (list_hiddens != '' && list_hiddens != ' ') {
1301
1302		
1303
1304		var hidden_menu = '<div class="view_hidden_td" >Скрытые столбцы: <div style="display:inline-block;margin-left:10px;">'+list_hiddens+'</div></div>';
1305
1306		$(".forms_block .sort_block .action_block").before(hidden_menu);
1307		
1308	}
1309
1310	
1311}
1312
1313function updateFormsList_init() {
1314
1315	slegkafunc[slegkafunc.length] = updateFormsList_resize;
1316	//resizeslegka();
1317
1318	var current_cockie_view_type = getCookie('view_type');
1319
1320	if (current_cockie_view_type != 'undefined' && current_cockie_view_type != '' && current_cockie_view_type != ' ' && current_cockie_view_type != 'null') {
1321		formListParams['send_params_list']['view'] = current_cockie_view_type;
1322	}
1323
1324	var current_cockie_view_deleted_type = getCookie('view_deleted_type');
1325
1326	if (current_cockie_view_deleted_type != 'undefined' && current_cockie_view_deleted_type != '' && current_cockie_view_deleted_type != ' ' && current_cockie_view_deleted_type != 'null') {
1327		formListParams['send_params_list']['view_deleted'] = current_cockie_view_deleted_type;
1328	}
1329
1330	var current_cockie_view_hidden_type = getCookie('view_hidden_type');
1331
1332	if (current_cockie_view_hidden_type != 'undefined' && current_cockie_view_hidden_type != '' && current_cockie_view_hidden_type != ' ' && current_cockie_view_hidden_type != 'null') {
1333		formListParams['send_params_list']['view_hidden'] = current_cockie_view_hidden_type;
1334	}
1335
1336	var current_cockie_hidden_blocks = getCookie('hidden_blocks');
1337
1338	if (current_cockie_hidden_blocks != 'undefined' && current_cockie_hidden_blocks != null && current_cockie_hidden_blocks != '' && current_cockie_hidden_blocks != ' ' && current_cockie_hidden_blocks != 'null') {
1339		formsListHtml['hidden_blocks'] = current_cockie_hidden_blocks.split(",");
1340	}
1341
1342	var current_cockie_view_type_save = getCookie('view_type_save');
1343
1344	if (current_cockie_view_type_save != 'undefined' && current_cockie_view_type_save != '' && current_cockie_view_type_save != ' ' && current_cockie_view_type_save != 'null') {
1345		formListParams['send_params_list']['view_save'] = current_cockie_view_type_save;
1346	}
1347
1348	var current_cockie_type_save = getCookie('type_save');
1349
1350	if (current_cockie_type_save != 'undefined' && current_cockie_type_save != '' && current_cockie_type_save != ' ' && current_cockie_type_save != 'null') {
1351		formListParams['send_params_list']['type'] = current_cockie_type_save;
1352	}
1353
1354	var current_cockie_source_save = getCookie('source_save');
1355
1356	if (current_cockie_source_save != 'undefined' && current_cockie_source_save != '' && current_cockie_source_save != ' ' && current_cockie_source_save != 'null') {
1357		formListParams['send_params_list']['source'] = current_cockie_source_save;
1358	}
1359
1360	
1361
1362	for (var i = 0; i < formListParams['list_select'].length; i++) {
1363
1364		if ($( formListParams['list_select'][i][0] ).length > 0) {
1365
1366			var num_in_select = $( formListParams['list_select'][i][0]+' option[value=' + formListParams['send_params_list'][ formListParams['list_select'][i][1] ] +']' ).index();
1367
1368			$( formListParams['list_select'][i][0] )[0].selectedIndex = num_in_select;
1369
1370		}
1371
1372	}
1373
1374	var current_date = unixtimeconverter();
1375
1376	var current_cockie_diapozone = (getCookie('diapozone')+"").split(".");
1377		if (current_cockie_diapozone.length == 3) {
1378
1379			for (var ic = 0; ic < current_cockie_diapozone.length; ic++) {
1380				formListParams['diapozone'][ic] = stringToNumeric(current_cockie_diapozone[ic]);
1381			}
1382
1383		}
1384
1385	var end_day = new Date();
1386
1387	for (var icc = 2; icc >= 0; icc--) {
1388
1389		if (formListParams['diapozone'][icc] > 0) {
1390
1391			if (icc == 0) {
1392				end_day.setDate(end_day.getDate() - formListParams['diapozone'][icc]);
1393			} else if (icc == 1) {
1394				end_day.setMonth(end_day.getMonth() - formListParams['diapozone'][icc]);
1395			} else if (icc == 2) {
1396				end_day.setYear(end_day.getFullYear() - formListParams['diapozone'][icc]);
1397			}
1398
1399		}
1400
1401	}
1402
1403	formListParams['send_params_list']['time']  = [[end_day.getDate(), (end_day.getMonth() + 1), end_day.getFullYear()], [current_date['d'], current_date['mm'], current_date['y']]];
1404	
1405	updateFormsSetDate();
1406	$("#time_input_1").trigger("change");
1407
1408	$("a.save_diapozone").removeClass("active");
1409
1410
1411
1412	updateFormsClear();
1413
1414}
1415
1416function updateFormsList_resize() {
1417
1418	var current_screen        = getrazmobh();
1419	var current_mobile_screen = false; 
1420	
1421	if (current_screen[0] <= 850) {
1422		current_mobile_screen = true;
1423	}
1424
1425	//if (formListParams['mobile_screen'] != current_mode_screen) {
1426
1427	$(".vals.tr .title_td, .vals.tr .line").remove();
1428
1429		if (current_mobile_screen) {
1430
1431			var titles = $(".titles.tr .td");
1432
1433			if (titles.length > 0) {
1434
1435				for (var i = 0; i < titles.length; i++) {
1436
1437					var current_id_split = ($(titles[i]).attr("id")+"").split("_");
1438
1439					if (current_id_split.length > 1) {
1440
1441					var current_id = '';
1442
1443						for (var ii = 1; ii < current_id_split.length; ii++) {
1444
1445							var separate = '_'; if (ii == 1) {separate = '';}
1446
1447							current_id += separate+''+current_id_split[ii];
1448
1449						}
1450
1451					$(".td.v_"+current_id).before( $(titles[i]).clone().wrap('<div>').parent().html() ).after('<div class="line"></div>');
1452
1453					}
1454				}
1455
1456			}
1457
1458		}
1459
1460		formListParams['mobile_screen'] = current_mobile_screen;
1461
1462	//}
1463
1464}
1465
1466function updateFormsList_typeSet(radiogroup) {
1467	radio_group_set(radiogroup, formListParams['send_params_list']['type']);
1468}
1469
1470function updateFormsList_sourceSet(radiogroup) {
1471	radio_group_set(radiogroup, formListParams['send_params_list']['source']);
1472}
1473
1474function updateFormsClear() {
1475
1476	$(".forms_block .list .block").html("");
1477
1478}
1479
1480function updateFormsSetDate() {
1481
1482	for (var i = 0; i < formListParams['send_params_list']['time'].length; i++) {
1483		$("#time_input_"+(i + 1)).val( numericToString(formListParams['send_params_list']['time'][i][0])+'.'+numericToString(formListParams['send_params_list']['time'][i][1])+'.'+numericToString(formListParams['send_params_list']['time'][i][2]) );
1484	}
1485
1486}
1487
1488function updateFormsSaveDiapozone() {
1489
1490
1491	var new_diapozone = [0, 0, 0];
1492
1493	for (var i = (formListParams['send_params_list']['time'][0].length - 1); i >= 0; i--) {
1494
1495		if (formListParams['send_params_list']['time'][0][i] < formListParams['send_params_list']['time'][1][i]) {
1496			new_diapozone[i] = formListParams['send_params_list']['time'][1][i] - formListParams['send_params_list']['time'][0][i];
1497		} else if (formListParams['send_params_list']['time'][0][i] > formListParams['send_params_list']['time'][1][i]) {
1498
1499			new_diapozone[i + 1] -= 1;
1500
1501			if (i == 1) {
1502				//new_diapozone[i] = 
1503			}
1504
1505		}
1506
1507	}
1508
1509	setCookie("diapozone", new_diapozone.join("."), { expires: (365*24*60*60) })
1510
1511	$("a.save_diapozone").removeClass("active");
1512
1513}
1514
1515function updateFormsList_viewTypesave() {
1516	setCookie("view_type", $(formListParams['list_select'][0][0]).val(), { expires: (365*24*60*60) })
1517}
1518
1519function updateFormsList_view_deletedTypesave() {
1520	setCookie("view_deleted_type", $(formListParams['list_select'][2][0]).val(), { expires: (365*24*60*60) })
1521}
1522
1523function updateFormsList_view_hiddenTypesave() {
1524	setCookie("view_hidden_type", $(formListParams['list_select'][3][0]).val(), { expires: (365*24*60*60) })
1525}
1526
1527function updateFormsList_viewTypeChangesave() {
1528	setCookie("view_type_save", $(formListParams['list_select'][1][0]).val(), { expires: (365*24*60*60) })
1529}
1530
1531function updateFormsList_typeSave() {
1532	setCookie("type_save", formListParams['send_params_list']['type'], { expires: (365*24*60*60) })
1533}
1534
1535function updateFormsList_sourceSave() {
1536	setCookie("source_save", formListParams['send_params_list']['source'], { expires: (365*24*60*60) })
1537}
1538
1539function updateFormsList_saveResize( event, ui ) {
1540
1541	if (typeof ui.element != 'undefined' && typeof ui.size != 'undefined' && typeof ui.size.width != 'undefined') {
1542		
1543		var current_id_column_split = ($(ui.element).attr("id")+"").split("_");
1544
1545		if (current_id_column_split.length > 1 && current_id_column_split[0] == 'titles') {
1546
1547			var current_id_column = '';
1548
1549			for (var i = 1; i < current_id_column_split.length; i++) {
1550
1551				var separate = '_'; if (i == 1) {separate = '';}
1552
1553				current_id_column += separate+''+current_id_column_split[i];
1554
1555			}
1556
1557			var full_size_titles = $(".forms_block .list .block .titles.tr").width();
1558			var current_percent = (ui.size.width / full_size_titles) * 100;
1559
1560			setCookie("column_width_"+current_id_column, current_percent, { expires: (365*24*60*60) });
1561
1562		}
1563
1564	}
1565
1566}
1567
1568
1569function updateFormsDiapozone() {
1570
1571	var new_time = [];
1572
1573	for (var i = 1; i < 3; i++) {
1574
1575		var current_date_pars  = ($("#time_input_"+i).val()+"").split(".");
1576		var current_date_today = unixtimeconverter();
1577		var current_date       = [current_date_today['d'], current_date_today['mm'], current_date_today['y']];
1578
1579		if (current_date_pars.length == 3) {
1580			current_date = current_date_pars;
1581		}
1582
1583		for (var idt = 0; idt < current_date.length; idt++) {
1584			current_date[idt] = stringToNumeric(current_date[idt]);	
1585		}
1586
1587		if (i == 2 && (current_date[2] < new_time[i - 2][2] || (current_date[2] == new_time[i - 2][2] && current_date[1] < new_time[i - 2][1]) || (current_date[2] == new_time[i - 2][2] && current_date[1] == new_time[i - 2][1] && current_date[0] < new_time[i - 2][0]))) {
1588			current_date =  new_time[i - 2];
1589		}
1590
1591		new_time[i - 1] = current_date;
1592
1593	}
1594
1595	formListParams['send_params_list']['time'] = new_time;
1596	updateFormsSetDate();
1597	updateFormsList_first_step();
1598
1599	$("a.save_diapozone").addClass("active");
1600
1601}
1602
1603function updateFormsList_first_step() {
1604
1605	for (var i = 0; i < formListParams['list_select'].length; i++) {
1606
1607		//console.log(formListParams['list_select'][i][1]+" ! "+formListParams['list_select'][i][0]+" ! "+$( formListParams['list_select'][i][0] ).val());
1608
1609		formListParams['send_params_list'][ formListParams['list_select'][i][1] ] = $( formListParams['list_select'][i][0] ).val();
1610	}
1611
1612	
1613	formListParams['page']             = 1;
1614	formListParams['end_time_in_page'] = 0;
1615	
1616	formListParams['end_id_in_page']   = [0, 0, 0];
1617	formListParams['totals_loads']     = [0, 0, 0];
1618
1619	$(".forms_block .list .block").html("");
1620	
1621	updateFormsList();
1622
1623}
1624
1625function updateFormsList() {
1626
1627	formList_list                 = [];
1628	formListParams['total_items'] = 0;
1629	$(".forms_block .list .no_data").remove();
1630
1631	updateFormsListGetList(0);
1632
1633}
1634
1635
1636
1637function updateFormsList_react() {
1638
1639	isReturnSend = [];
1640
1641
1642
1643	formList_list.sort(formsListOrderByTime);
1644
1645	updateFormsListCreateTable();
1646
1647}
1648
1649function updateFormsListIssetTitle(title, title_val, titles_array) {
1650
1651	var is_title = false;
1652	
1653	title_val = replacer(['*hint*', '*/hint*'], ['<br><div class="hint">', '</div>'], title_val+"");
1654
1655	for (var i = 0; i < titles_array.length; i++) {
1656
1657		if (titles_array[i][0] == title) {
1658			
1659			is_title = true;
1660			break;
1661
1662		}
1663		
1664	}
1665
1666	if (!is_title) {
1667		titles_array[titles_array.length] = [title, title_val];
1668	}
1669
1670	return titles_array;
1671
1672}
1673
1674function updateFormsList_isTimeVal(name, val) {
1675
1676	if (name == 'time' || name == 'time_start' || name == 'time_end') {
1677		
1678		val -= 0;
1679
1680		if (!isNaN(val) && val > 0) {
1681
1682			var current_time_arr = unixtimeconverter(val);
1683
1684			val = current_time_arr['fulltime'];
1685
1686		} else {
1687			val = 'Не указано';
1688		}
1689
1690	}
1691
1692	return val;
1693
1694}
1695
1696function updateFormsListCreateTable() {
1697
1698	var html_list   = '';
1699	var html_titles = '';
1700	var html_search = '';
1701	var unic_titles = formListParams['titles'].slice();
1702
1703	
1704	var array_items = [];
1705
1706	for (var i = 0; i < formListParams['limit']; i++) {
1707
1708		if (typeof formList_list[i] !== 'undefined') {
1709
1710			var current_line = [];
1711
1712			for (key in formList_list[i]) {
1713
1714				if (typeof formList_list[i][key] == 'object') {
1715
1716					for (key_in in formList_list[i][key]) {
1717
1718						unic_titles = updateFormsListIssetTitle(key+'_'+key_in, formList_list[i][key][key_in][0], unic_titles);
1719
1720						var current_arr = [];
1721							current_arr['prefix'] = key+'_'+key_in;
1722							current_arr['val']    = updateFormsList_isTimeVal(key+'_'+key_in, formList_list[i][key][key_in][1]);
1723							current_arr['array_id']    = i;
1724
1725						formListParams['titles_query'][key+'_'+key_in] = [key, formList_list[i][key][key_in][0]];
1726
1727						current_line[key+'_'+key_in] = current_arr;
1728
1729					}
1730
1731				} else {
1732
1733					if (typeof formListParams['title_names'][key] != 'undefined') {
1734						unic_titles = updateFormsListIssetTitle(key, formListParams['title_names'][key], unic_titles);
1735					}
1736
1737					var current_arr = [];
1738						current_arr['prefix']      = key;
1739						current_arr['val']         = updateFormsList_isTimeVal(key, formList_list[i][key]);
1740						current_arr['array_id']    = i;
1741
1742					formListParams['titles_query'][key] = key;
1743
1744					current_line[key] = current_arr;
1745
1746				}
1747
1748			}
1749
1750			array_items[array_items.length] = current_line;
1751
1752		}
1753
1754	}
1755
1756	var list_set_view = [[], [], []];
1757
1758	for (var ii = 0; ii < array_items.length; ii++) {
1759
1760			var current_item = formList_list[ array_items[ii]['id']['array_id'] ];
1761
1762			var replace_arr = []; replace_arr['icx'] = []; replace_arr['zam'] = [];
1763				replace_arr['icx'][0] = '*list*';
1764				replace_arr['zam'][0] = updateFormsListGetLine(formsListHtml['vals_td'], array_items[ii], unic_titles);
1765				replace_arr['icx'][1] = '*page*';
1766				replace_arr['zam'][1] = formListParams['page'];
1767				replace_arr['icx'][2] = '*query_num*';
1768				replace_arr['zam'][2] = current_item['query_num'];
1769				replace_arr['icx'][3] = '*id*';
1770				replace_arr['zam'][3] = current_item['id'];
1771				replace_arr['icx'][4] = '*state*';
1772					
1773					var current_state = '';
1774
1775						if ((current_item['state'] - 0) <= 0 || (current_item['deleted'] - 0) > 0) {
1776							current_state = 'view';
1777						}
1778
1779						if (typeof current_item['visible'] != 'undefined' && (current_item['visible'] - 0) > 0) {
1780							current_state += ' hiddens';
1781						}
1782
1783				replace_arr['zam'][4] = current_state;
1784
1785			html_list += replacer(replace_arr['icx'], replace_arr['zam'], formsListHtml['vals_tr']);
1786
1787			formListParams['end_time_in_page']                            = current_item['time'];
1788			formListParams['end_id_in_page'][ current_item['query_num'] ] = current_item['id'];
1789			formListParams['totals_loads'][ current_item['query_num'] ]  += 1;
1790
1791			if (formListParams['send_params_list']['view_save'] == 'auto' && (current_item['state'] - 0) == 0) {
1792				list_set_view[ current_item['query_num'] ][ list_set_view[ current_item['query_num'] ].length ] = current_item['id'];
1793			}
1794
1795	}
1796
1797
1798
1799	if (formListParams['send_params_list']['view_save'] == 'auto') {
1800
1801		var is_need_send = false;
1802
1803		for (var l = 0; l < list_set_view.length; l++) {
1804			
1805			if (list_set_view[l].length > 0) {
1806				is_need_send = true;
1807			}
1808
1809		}
1810//console.log("отправка "+is_need_send+"!");console.log(list_set_view);
1811		if (is_need_send) {
1812			updateFormsList_actionSetViewAll(list_set_view);
1813		}
1814		
1815	}
1816
1817
1818	if (unic_titles.length > 0) {
1819
1820		var current_line   = [];
1821		var current_line_s = [];
1822
1823		for (var it = 0; it < unic_titles.length; it++) {
1824
1825			var current_arr = [];
1826			var current_cockie_size = getCookie("column_width_"+unic_titles[it][0]) 
1826- 0;
1827
1828				current_arr['prefix'] = unic_titles[it][0];
1829				current_arr['val']    = unic_titles[it][1];
1830				current_arr['size']   = "";
1831
1832				if (!isNaN(current_cockie_size) && current_cockie_size > 0) {
1833					current_arr['size'] = 'max-width:inherit;width:'+current_cockie_size+"%";
1834				}
1835
1836			current_line[ unic_titles[it][0] ]   = current_arr;
1837			current_line_s[ unic_titles[it][0] ] = [];
1838
1839			for (key in current_line[ unic_titles[it][0] ]) {
1840				current_line_s[ unic_titles[it][0] ][key] = current_line[ unic_titles[it][0] ][key];
1841			}
1842
1843				var current_hablon = formsListHtml['search_inputs_types']['default'];
1844
1845					if (typeof formsListHtml['search_inputs_types'][ current_arr['prefix'] ] != 'undefined') {
1846						current_hablon = formsListHtml['search_inputs_types'][ current_arr['prefix'] ];
1847					}
1848
1849				current_line_s[unic_titles[it][0]]['class'] = current_hablon[1];
1850				current_line_s[unic_titles[it][0]]['old_val'] = "";
1851
1852				if (typeof formListParams['titles_query_save'][ unic_titles[it][0] ] != 'undefined' && formListParams['titles_query_save'][ unic_titles[it][0] ] != '' && formListParams['titles_query_save'][ unic_titles[it][0] ] != ' ') {
1853					current_line_s[unic_titles[it][0]]['old_val'] = formListParams['titles_query_save'][ unic_titles[it][0] ];
1854				}
1855
1856				var hablon_val = formsListHtml['search_inputs'][ current_hablon[0] ]+"";
1857					
1858					for (key in current_line_s[unic_titles[it][0]]) {
1859						hablon_val = replacer('*'+key+'*', current_line_s[unic_titles[it][0]][key], hablon_val);
1860					}
1861
1862				current_line_s[unic_titles[it][0]]['val'] = hablon_val;
1863
1864		}
1865
1866//console.log(unic_titles);
1867
1868		var replace_arr = []; replace_arr['icx'] = []; replace_arr['zam'] = [];
1869				replace_arr['icx'][0] = '*list*';
1870				replace_arr['zam'][0] = updateFormsListGetLine(formsListHtml['titles_td'], current_line, unic_titles);
1871				replace_arr['icx'][1] = '*page*';
1872				replace_arr['zam'][1] = formListParams['page'];
1873
1874		replace_arr['icx_s'] = []; replace_arr['zam_s'] = [];
1875				replace_arr['icx_s'][0] = '*list*';
1876				replace_arr['zam_s'][0] = updateFormsListGetLine(formsListHtml['search_td'], current_line_s, unic_titles);
1877				replace_arr['icx_s'][1] = '*page*';
1878				replace_arr['zam_s'][1] = formListParams['page'];
1879
1880		html_titles = replacer(replace_arr['icx'], replace_arr['zam'], formsListHtml['titles_tr']);
1881		html_search = replacer(replace_arr['icx_s'], replace_arr['zam_s'], formsListHtml['search_tr']);
1882
1883	}
1884
1885	if (html_titles != '' && html_titles != ' ') {
1886		addHtmlWithoutIssetInner(".forms_block .list .block", ".forms_block .list .titles.tr", html_titles, true);
1887	}
1888
1889	if (html_search != '' && html_search != ' ') {
1890		addHtmlWithoutIssetInner(".forms_block .list .titles.tr", ".forms_block .list .search.tr", html_search, false, true);
1891	}
1892
1893	addHtmlWithoutIssetInner(".forms_block .list .block", "#line_"+formListParams['page'], html_list);
1894
1895	$(".forms_block .list .next_button").remove();
1896
1897	if ((formListParams['limit'] * formListParams['page']) < formListParams['total_items']) {
1898		addHtmlWithoutIssetInner(".forms_block .page_block", ".forms_block .page_block .next_button", formsListHtml['next_button']);
1899	} else {
1900		$(".forms_block .page_block .next_button").remove();
1901	}
1902
1903	var replace_arr = []; replace_arr['icx'] = []; replace_arr['zam'] = [];
1904				replace_arr['icx'][0] = '*total*';
1905				replace_arr['zam'][0] = formListParams['total_items'];
1906				replace_arr['icx'][1] = '*current*';
1907
1908				var current_total = 0;
1909
1910					for (var itt = 0; itt < formListParams['totals_loads'].length; itt++) {
1911						current_total +=formListParams['totals_loads'][itt];
1912					}
1913
1914				replace_arr['zam'][1] = current_total;
1915
1916	html_total = replacer(replace_arr['icx'], replace_arr['zam'], formsListHtml['total']);
1917
1918	if (formListParams['total_items'] == 0 && current_total == 0) {
1919		addHtmlWithoutIssetInner(".forms_block .list .block", ".forms_block .list .no_data", formsListHtml['vals_pusto'], false, true);
1920	}
1921	
1922
1923	addHtmlWithoutIssetInner(".forms_block .page_block", ".forms_block .page_block .total", html_total, true);
1924
1925	if (unic_titles.length > formListParams['titles'].length) {
1926
1927		if (formListParams['titles'].length > 0) {
1928
1929			for (var itp = 0; itp < unic_titles.length; itp++) {
1930
1931				var isset_in_array = false;
1932
1933				for (var itpi = 0; itpi < formListParams['titles'].length; itpi++) {
1934
1935					if (unic_titles[itp][0] == formListParams['titles'][itpi][0]) {
1936
1937						isset_in_array = true;
1938						break;
1939
1940					}
1941
1942				}
1943
1944				if (!isset_in_array) {
1945					$(".vals.tr:not(.line_query_"+formListParams['page']+") .v_"+unic_titles[itp - 1][0]).after( updateFormsListGetLine(formsListHtml['vals_td'], [], [unic_titles[itp]]) );
1946				}
1947
1948			}
1949
1950		}
1951
1952		formListParams['titles'] = unic_titles.slice();
1953
1954	}
1955
1956	$(".forms_block .list").attr({"data-total": unic_titles.length});
1957
1958	jQuery('.forms_block .list .titles.tr .td').not("#titles_check").resizable(
1959		{
1960		  stop: updateFormsList_saveResize
1961		}
1962	);
1963
1964	$('.forms_block .list .block .search.tr input.numerics, .forms_block .list .block .search.tr input.numerics').attr({'onkeyup': 'upotvnew(this, true);updateFormsList_search(false);', 'onchange': 'upotvnew(this, true);updateFormsList_search(false);'});
1965	
1966	if (typeof $.fn.mask !=="undefined") {
1967
1968		$('.forms_block .list .block .search.tr input.phone').mask("+9 (999) 999-9999");
1969		$('.forms_block .list .block .search.tr input.ip').mask("999.999.999.999");
1970
1971	}
1972
1973	if (typeof $.fn.datepicker !=="undefined") { 
1974	  $( ".forms_block .list .block .search.tr input.date").datepicker($.extend({changeYear: true, changeMonth: true, dateFormat: "dd/mm/yy"}, $.datepicker.regional["ru"]));
1975	}
1976
1977
1978	updateFormsList_resize();
1979
1980	updateFormsList_formirate_hidden_list();
1981
1982}
1983
1984
1985function updateFormsList_search(send) {
1986
1987	if (typeof send == 'undefined' || send != true) {send = false;}
1988
1989	var search_str    = '';
1990	var search_inputs = $(".search_td input");
1991
1992	var redirt = [];
1993	  	redirt[0] = 0;
1994	    redirt[1] =  "";
1995	    sodt = standartmess2('Ошибка!', 'Укажите пожалуйста, хотя бы одно условие поиска.');
1996	    
1997
1998	if (search_inputs.length > 0) {
1999
2000		for (var i = 0; i < search_inputs.length; i++) {
2001
2002			var current_val         = $(search_inputs[i]).val();
2003			var current_index_split = ($(search_inputs[i]).attr("id")+"").split("search_val_");
2004			var current_index       = null;
2005			var current_val_icx     = current_val;
2006			
2007
2008
2009
2010				if ($(search_inputs[i]).hasClass("phone")) {
2011
2012					current_val = replacer(['_', '(', ')', ' ', '-'], ['', '', '', '', ''], current_val);
2013					current_val_icx = replacer('+', '', current_val);
2014
2015				} else if ($(search_inputs[i]).hasClass("numerics")) {
2016					current_val = replacer(['_', ' ', '-'], ['', '', ''], current_val);
2017				}  else if ($(search_inputs[i]).hasClass("ip")) {
2018
2019					current_val = replacer(['_', ' '], ['', ''], current_val);
2020					var is_error_val = false;
2021					var current_val_split = current_val.split(".");
2022
2023					for (var iip = 0; iip < current_val_split.length; iip++) {
2024						current_val_split[iip] -= 0;
2025					}
2026
2027					current_val = '';
2028
2029					for (var iipS = 0; iipS < 4; iipS++) {
2030
2031						if (typeof current_val_split[iipS] != 'undefined' && current_val_split[iipS] >= 0) {
2032
2033							var separate = '.'; if (iipS == 0) {separate = '';}
2034
2035							current_val += separate+''+current_val_split[iipS];
2036
2037						} else {
2038							is_error_val = true;
2039						}
2040
2041					}
2042
2043					if (is_error_val) {
2044						current_val = '';
2045					}
2046
2047
2048				} else if ($(search_inputs[i]).hasClass("date")) {
2049
2050					var current_val_split = current_val.split(".");
2051					var is_error_val = false;
2052
2053					for (var ids = 0; ids < 3; ids++) {
2054
2055						if (typeof current_val_split[ids] != 'undefined') {
2056
2057							current_val_split[ids] -= 0;
2058
2059							if (current_val_split[ids] <= 0) {
2060								is_error_val = true;
2061							}
2062
2063
2064						} else {
2065							is_error_val = true;
2066						}
2067
2068					}
2069
2070					if (!is_error_val) {
2071
2072						if (current_val_split[1] == 12) {
2073							current_val_split[1] = 0;
2074						}
2075						
2076						var current_date = new Date();
2077							current_date.setDate(current_val_split[0]);
2078							current_date.setMonth(current_val_split[1] - 1);
2079							current_date.setYear(current_val_split[2]);
2080
2081							current_val = Math.round(current_date.getTime() / 1000);
2082
2083					}
2084
2085					if (is_error_val || current_val < 1) {
2086						current_val = '';
2087					}
2088
2089				}
2090
2091			if (!$(search_inputs[i]).hasClass("date") && !$(search_inputs[i]).hasClass("phone")) {
2092				current_val_icx = current_val;
2093			}
2094
2095			if (current_index_split.length == 2 && typeof formListParams['titles_query'][ current_index_split[1] ] != 'undefined') {
2096						
2097				if (typeof formListParams['titles_query'][ current_index_split[1] ] == 'object') {
2098
2099					current_index = formListParams['titles_query'][ current_index_split[1] ][0];
2100
2101					if (current_val != '' && current_val != ' ') {
2102						current_val = formListParams['titles_query'][ current_index_split[1] ][1]+'*e*'+current_val;
2103					}
2104
2105				} else {
2106					current_index = formListParams['titles_query'][ current_index_split[1] ];
2107				}
2108
2109			}
2110
2111			if (current_val != '' && current_val != ' ') {
2112
2113				if (current_index != null && current_index != '' && current_index != ' ') {
2114
2115					var current_separate = '*search*'; if (search_str == '' || search_str == ' ') {current_separate = '';}
2116
2117					search_str += current_separate+''+current_index+'*s_v*'+current_val;
2118
2119				}
2120
2121			}
2122
2123			if (current_index != null && current_index != '' && current_index != ' ') {
2124				formListParams['titles_query_save'][current_index_split[1]] = current_val_icx;
2125			}
2126
2127		}
2128
2129		
2130		//if (search_str != null && search_str != '' && search_str != ' ') {
2131			
2132			formsListHtml['search_query'] = search_str;
2133
2134			if (send) {
2135			 	updateFormsList_first_step();
2136			}
2137
2138		//}
2139
2140
2141	}
2142
2143}
2144
2145
2146function hidden_str_views(block) {
2147
2148	var block_td = $(block).closest(".td");
2149
2150		if (block_td.length > 0) {
2151			$(block_td).find("a.view_hidden").hide();
2152			$(block_td).find(".hidden_val").addClass("view");
2153		}
2154
2155}	
2156
2157function updateFormsListGetLine(html, array, titles) {
2158
2159	var returned = '';
2160
2161	for (var i = 0; i < titles.length; i++) {
2162		
2163		var replace_arr = []; replace_arr['icx'] = []; replace_arr['zam'] = [];
2164
2165		var array_current_item = formsListHtml['empty_arr'];
2166
2167		if (typeof array[ titles[i][0] ] != 'undefined') {
2168			array_current_item = array[ titles[i][0] ];
2169		}
2170
2171		if (typeof array_current_item['val'] != 'undefined' && typeof array_current_item['array_id'] != 'undefined' && typeof array_current_item['prefix'] != 'undefined') {
2172			
2173			if (array_current_item['val'].length > 200) {
2174
2175				var new_str = array_current_item['val'].substring(0, 200)+'<br><a href="#" class="view_hidden" onclick="hidden_str_views(this);return false;">...Показать</a><div class="hidden_val">'+array_current_item['val'].substring(200, array_current_item['val'].length + 1)+'</div>';
2176
2177				array_current_item['val'] = new_str;
2178
2179			}
2180
2181		}
2182
2183		if (typeof array_current_item['prefix'] != 'undefined') {
2184
2185			if (inArray(array_current_item['prefix'], formsListHtml['hidden_blocks'], null, null, true) >= 0) {
2186				array_current_item['hidden_class'] = 'hidden';
2187			}
2188
2189		}
2190
2191		if (typeof array_current_item['hidden_class'] == 'undefined') {
2192			array_current_item['hidden_class'] = '';
2193		}
2194
2195			for (key in array_current_item) {
2196
2197				var current_num = replace_arr['icx'].length;
2198
2199				replace_arr['icx'][current_num] = '*'+key+'*';
2200
2201				if (key == 'prefix' && array_current_item[key] == 'empty') {
2202					replace_arr['zam'][current_num] = array_current_item[key]+' v_'+titles[i][0];
2203				} else {
2204					replace_arr['zam'][current_num] = array_current_item[key];
2205				}
2206
2207			}
2208
2209
2210		returned += replacer(replace_arr['icx'], replace_arr['zam'], html);
2211
2212	}
2213
2214	return returned;
2215
2216}
2217
2218
2219function updateFormsList_checked_all(all_check) {
2220
2221	var checkboxes     = ".td.check_block input[type=checkbox]";
2222	var default_checks = false;
2223
2224	if ($(all_check).prop("checked")) {
2225		default_checks = true;
2226	}
2227
2228	$(checkboxes).prop('checked', default_checks);
2229
2230	updateFormsList_checked();
2231
2232}
2233
2234function updateFormsList_checked() {
2235
2236	var list_checks = $(".td.check_block");
2237	var list_activ  = [];
2238
2239	if (list_checks.length > 0) {
2240
2241		for (var i = 0; i < list_checks.length; i++) {
2242
2243			if ($(list_checks[i]).find("input[type=checkbox]").prop("checked")) {
2244
2245				var current_ids = ($(list_checks[i]).attr("id")+"").split("_");
2246				var ids = [-1, -1];
2247
2248				for (var ii = 0; ii < 2; ii++) {
2249
2250					var num = (current_ids.length - 2) + ii;
2251					if (typeof current_ids[num] != 'undefined') {
2252						current_ids[num] -= 0;
2253
2254						if (!isNaN(current_ids[num]) && current_ids[num] >= (0 + ii)) {
2255							ids[ii] = current_ids[num];
2256						}
2257
2258					}
2259					
2260				}
2261
2262				if (ids[0] >= 0 && ids[1] >= 1) {
2263
2264					if (typeof list_activ[ids[0]] == 'undefined') {list_activ[ids[0]] = [];}
2265
2266					list_activ[ids[0]][ list_activ[ids[0]].length ] = ids[1];
2267
2268				}
2269
2270
2271			}
2272
2273		}
2274
2275	}
2276
2277	formListParams['action_list'] = list_activ;
2278
2279	if (formListParams['action_list'].length > 0) {
2280		$(".forms_block .action_block").addClass("active");
2281	} else {
2282		$(".forms_block .action_block").removeClass("active");
2283	}
2284
2285}
2286
2287function updateFormsListNextPage() {
2288	
2289	$(".forms_block .list .block .next_button").addClass("active");
2290
2291	formListParams['page'] += 1;
2292
2293	updateFormsList();
2294
2295}
2296
2297
2298function formsListOrderByTime(a,b) {
2299  
2300  if (a['time'] < b['time']) {
2301  	return 1;
2302  } else if (a['time'] > b['time']) {
2303    return -1;
2304  }
2305
2306  return 0;
2307
2308}
2309
2310
2311function updateFormsList_action(action) {
2312
2313	var is_apply = true;
2314
2315	if (action == 'delete') {
2316
2317		is_apply = confirm("Вы уверенны, что хотите удалить выбранные заявки?");
2318
2319	}
2320
2321	if (is_apply) {
2322
2323		formList_list_isReact['list']   = [];
2324		formList_list_isReact['errors'] = [0, 0, 0];
2325
2326		if (action == 'export') {
2327
2328			formListParams['explort']['old_query_param'] = [];
2329			updateFormsListExportActive = true;
2330			updateFormsList_exportCreate();
2331
2332		} else {
2333			updateFormsListGetList(0, action);
2334		}
2335
2336	}
2337
2338}
2339
2340
2341function updateFormsList_exportCreate() {
2342
2343	if (updateFormsListExportActive) {
2344
2345			var redirt = [];
2346		  	redirt[0] = 0;
2347		    redirt[1] =  "";
2348
2349		    sodt = standartmess2('Пожалуйста, подождите', '<div class="export_block">Готовиться список на выгрузку...<div class="loader_block"></div></div>');
2350		    pokazarmess(sodt, '', redirt, 0, 0, 1, updateFormsListExportCanselled);
2351
2352		var is_action_list = false;
2353
2354		for (var i = 0; i < formListParams['action_list'].length; i++) {
2355
2356			if (isArray(formListParams['action_list'][i]) && formListParams['action_list'][i].length > 0) {
2357				
2358				is_action_list = true;
2359				break;
2360
2361			}
2362
2363		}
2364
2365		if (is_action_list) {
2366			updateFormsList_exportSelectList();
2367		} else {
2368			updateFormsList_exportAllList();
2369		}
2370	
2371	}
2372
2373}
2374
2375
2376
2377
2378function updateFormsList_exportSaveFile(line, total, current, list_select_titles, file) {
2379
2380	if (updateFormsListExportActive) {
2381
2382		if (typeof line != 'undefined') {
2383
2384			line -= 0;
2385
2386			if (isNaN(line) || line < 1) {
2387				line = 1;
2388			}
2389
2390		} else {
2391			line = 1;
2392		}
2393
2394		if (typeof total == 'undefined' || total < 1) {total = 0;}
2395		if (typeof current == 'undefined' || current < 1) {current = 0;}
2396		if (typeof file == 'undefined' || file == '' || file == ' ') {file = null;}
2397		if (typeof list_select_titles != 'object' || list_select_titles.length < 1) {list_select_titles = [];}
2398
2399		var redirt = [];
2400			redirt[0] = 0;
2401			redirt[1] =  "";
2402
2403		var list_export = [];
2404		var list_blocks = $(".forms_block .export_list .lines_td");
2405
2406		if (list_blocks.length > 0 && list_select_titles.length > 0) {
2407
2408			for (var i = 0; i < list_blocks.length; i++) {
2409
2410				var current_num = list_export.length;
2411				list_export[current_num] = {};
2412
2413				for (var iv = 0; iv < list_select_titles.length; iv++) {
2414
2415					list_export[current_num][ list_select_titles[iv][0] ] = replacer(['"'], ["'"], $(list_blocks[i]).find(".td.v_"+list_select_titles[iv][0]).text());
2416
2417				}
2418
2419			}
2420
2421		}
2422
2423		var sodt = standartmess2('Пожалуйста, подождите', '<div class="export_block">Записи экспортируются...<div class="loader_block"></div><div class="total_block">Готово: <span class="current">'+current+'</span> из <span class="total">'+total+'</span></div><div class="file_block"></div></div>');
2424		pokazarmess(sodt, '', redirt, 0, 0, 1, updateFormsListExportCanselled);
2425
2426		sodt = standartmess2('Ошибка!', 'Произошла неизвестная ошибка, пожалуйста попробуйте позже или обратитесь к разработчику.');
2427
2428		if (list_export.length > 0) {
2429
2430			n = 10000;randnax = Math.floor( Math.random() * (n+1) );
2431						var paramZap = {};
2432						paramZap["ajax"] = "1";
2433						paramZap["rand"] = randnax;
2434						paramZap["tipsave"] = 'ExportScriptUser';
2435						paramZap["din1"] = file;
2436						paramZap["din2"] = JSON.stringify(list_export);
2437						paramZap["din3"] = JSON.stringify(list_select_titles);
2438						paramZap["return"] = 'json';
2439
2440						$.post('//'+formListParams['sites'][0]+'/saver.php',  paramZap,
2441						  
2442						  function(data){
2443						  
2444						  	pars = parsjsonotvet(data);
2445
2446						  		if (pars[1] == 0 && typeof pars[0]['file'] != 'undefined' && pars[0]['file'] != '' && pars[0]['file'] != ' ') {
2447							 		
2448							 		current = current + list_export.length;
2449
2450							 		$(".textnewmess .export_block .total_block .current").html();
2451
2452								 	setTimeout(function() {  formListParams['explort']['query']((line + 1), list_select_titles, pars[0]['file'], current, total); }, (500));
2453
2454								 } else {
2455
2456								 	if (typeof pars[0]['is_error'] != 'undefined' && pars[0]['is_error'] != '' && pars[0]['is_error'] != ' ') {
2457
2458								 		var error_str = 'Попытка экспорта пустого списка';
2459
2460								 		if (pars[0]['is_error'] == '2') {
2461								 			error_str = 'Ошибка записи файлв';
2462								 		}
2463
2464								 		sodt = standartmess2('Ошибка!', +', пожалуйста, обратитесь к разработчику.');
2465
2466								 	}
2467
2468									pokazarmess(sodt, '', redirt, 0, 0, 1, updateFormsListExportCanselled);
2469
2470								 }
2471
2472						});
2473
2474		} else {
2475			pokazarmess(sodt, '', redirt, 0, 0, 1, updateFormsListExportCanselled);
2476		}
2477	
2478	}
2479	
2480
2481}
2482
2483function updateFormsList_exportSucces(current_load, total_load, file) {
2484
2485	if (updateFormsListExportActive) {
2486
2487		var redirt = [];
2488			redirt[0] = 0;
2489			redirt[1] =  "";
2490
2491		var file_link = 'http://vyatich.ru/uploads/arxiv/'+file;
2492
2493			var sodt = standartmess2('Поздравляем!', '<div class="export_block">Записи успешно экспортированы.<div class="total_block">Готово: <span class="current">'+current_load+'</span> из <span class="total">'+total_load+'</span></div><div class="file_block">Скачать готовый файл по ссылке: <a href="'+file_link+'" target="_blank">'+file_link+'</a></div></div>');
2494			pokazarmess(sodt, '', redirt, 0, 0, 1, updateFormsListExportCanselled);
2495
2496	}
2497
2498}
2499
2500function updateFormsList_exportSelectedFormirate(line, list_select_titles, file, current_load, total_load) {
2501
2502	if (updateFormsListExportActive) {
2503
2504		if (typeof total_load == 'undefined' || total_load < 1) {total_load = 0;}
2505		if (typeof current_load == 'undefined' || current_load < 1) {current_load = 0;}
2506
2507		if (typeof line != 'undefined') {
2508
2509			line -= 0;
2510
2511			if (isNaN(line) || line < 1) {
2512				line = 1;
2513			}
2514
2515		} else {
2516			line = 1;
2517		}
2518
2519		var total = 0;
2520
2521		if (typeof list_select_titles != 'object' || list_select_titles.length < 1) {list_select_titles = [];}
2522		if (typeof file == 'undefined' || file == '' || file == ' ') {file = null;}
2523
2524		if (line > 1) {
2525			updateFormsList_exportSucces(current_load, total_load, file);
2526		} else {
2527
2528			$(".forms_block .export_list").html("");
2529
2530			for (var i = 0; i < formListParams['action_list'].length; i++) {
2531
2532				if (isArray(formListParams['action_list'][i]) && formListParams['action_list'][i].length > 0) {
2533					
2534					for (var il = 0; il < formListParams['action_list'][i].length; il++) {
2535
2536						$(".forms_block .export_list").append( '<div class="lines_td '+i+'_'+formListParams['action_list'][i][il]+'">'+$("#line_"+i+"_"+formListParams['action_list'][i][il]).html()+'</div>' );
2537
2538						total++;
2539
2540					}
2541
2542				}
2543
2544			}
2545
2546			setTimeout(function() { updateFormsList_exportSaveFile(1, total, 0, list_select_titles, file); }, (500));
2547
2548		}
2549
2550	}
2551
2552}
2553
2554function updateFormsList_exportAllFormirate(line, list_select_titles, file, current_load, total_load) {
2555
2556	if (updateFormsListExportActive) {
2557
2558		if (typeof total_load == 'undefined' || total_load < 1) {total_load = 0;}
2559		if (typeof current_load == 'undefined' || current_load < 1) {current_load = 0;}
2560
2561		if (typeof line != 'undefined') {
2562
2563			line -= 0;
2564
2565			if (isNaN(line) || line < 1) {
2566				line = 1;
2567			}
2568
2569		} else {
2570			line = 1;
2571		}
2572
2573		var total = 0;
2574
2575		if (typeof list_select_titles != 'object' || list_select_titles.length < 1) {list_select_titles = [];}
2576		if (typeof file == 'undefined' || file == '' || file == ' ') {file = null;}
2577
2578		if (formListParams['explort']['total_lines'] > 0 && line > formListParams['explort']['total_lines']) {
2579
2580			for (key in formListParams['explort']['old_query_param']) {
2581
2582				if (isArray(formListParams['explort']['old_query_param'][key])) {
2583					formListParams[key] = formListParams['explort']['old_query_param'][key].slice();
2584				} else {
2585					formListParams[key] = formListParams['explort']['old_query_param'][key];
2586				}
2587
2588			}
2589
2590			updateFormsList_exportSucces(current_load, total_load, file);
2591
2592		} else {
2593
2594
2595			$(".forms_block .export_list").html("");
2596
2597			formListParams['explort']['file_current']          = file;
2598			formListParams['explort']['total_current_export']  = current_load;
2599
2600			if (line == 1) {
2601				formListParams['page'] = 1;
2602				formListParams['explort']['select_titles']         = list_select_titles;
2603
2604				formListParams['end_time_in_page'] = 0;
2605				
2606				formListParams['end_id_in_page']   = [0, 0, 0];
2607				formListParams['totals_loads']     = [0, 0, 0];
2608
2609				var redirt = [];
2610					redirt[0] = 0;
2611					redirt[1] =  "";
2612				var sodt = standartmess2('Пожалуйста, подождите', '<div class="export_block">Записи экспортируются...<div class="loader_block"></div><div class="total_block">Готово: <span class="current">'+current_load+'</span> из <span class="total">'+formListParams['explort']['total_export']+'</span></div><div class="file_block"></div></div>');
2613				
2614				pokazarmess(sodt, '', redirt, 0, 0, 1, updateFormsListExportCanselled);
2615
2616
2617			} else {
2618				formListParams['page'] += 1;
2619			}
2620
2621			formListParams['explort']['current_lines'] = formListParams['page'];
2622
2623			updateFormsListExportAll(list_select_titles);
2624
2625		}
2626
2627	}
2628
2629}
2630
2631
2632function updateFormsListExportAll(list_select_titles) {
2633
2634	if (updateFormsListExportActive) {
2635
2636		formList_list_isReact['list']  = [];
2637		formList_list_isReact['total'] = 0;
2638		formListParams['total_items']  = 0;
2639
2640
2641		updateFormsListGetList(0, 'getExportLines');
2642
2643	}
2644
2645}
2646
2647function updateFormsList_action_react_getExportLines() {
2648
2649	if (updateFormsListExportActive) {
2650
2651		isReturnSend = [];
2652
2653		formList_list_isReact['list'].sort(formsListOrderByTime);
2654
2655		
2656		
2657		updateFormsListCreateTableExportAll(formList_list_isReact['list']);
2658
2659	}
2660
2661}
2662
2663function updateFormsListCreateTableExportAll(formList_list) {
2664
2665	if (updateFormsListExportActive) {
2666
2667		var html_list   = '';
2668
2669		var array_items = [];
2670
2671		for (var i = 0; i < formListParams['limit']; i++) {
2672
2673			if (typeof formList_list[i] !== 'undefined') {
2674
2675				var current_line = [];
2676
2677				for (key in formList_list[i]) {
2678
2679					if (typeof formList_list[i][key] == 'object') {
2680
2681						for (key_in in formList_list[i][key]) {
2682
2683							var current_arr = [];
2684								current_arr['prefix'] = key+'_'+key_in;
2685								current_arr['val']    = updateFormsList_isTimeVal(key+'_'+key_in, formList_list[i][key][key_in][1]);
2686								current_arr['array_id']    = i;
2687
2688							current_line[key+'_'+key_in] = current_arr;
2689
2690						}
2691
2692					} else {
2693
2694						var current_arr = [];
2695							current_arr['prefix']      = key;
2696							current_arr['val']         = updateFormsList_isTimeVal(key, formList_list[i][key]);
2697							current_arr['array_id']    = i;
2698
2699						current_line[key] = current_arr;
2700
2701					}
2702
2703				}
2704
2705				array_items[array_items.length] = current_line;
2706
2707			}
2708
2709		}
2710
2711		var list_set_view = [[], [], []];
2712
2713		var current_loads = formListParams['explort']['total_current_export'];
2714
2715		for (var ii = 0; ii < array_items.length; ii++) {
2716
2717				var current_item = formList_list[ array_items[ii]['id']['array_id'] ];
2718
2719				html_list += '<div class="lines_td ">'+updateFormsListGetLine(formsListHtml['vals_td'], array_items[ii], formListParams['explort']['titles_list'])+'</div>';
2720
2721				formListParams['end_time_in_page']                            = current_item['time'];
2722				formListParams['end_id_in_page'][ current_item['query_num'] ] = current_item['id'];
2723				formListParams['totals_loads'][ current_item['query_num'] ]  += 1;
2724
2725				//current_loads += 1;
2726
2727		}
2728
2729		$(".forms_block .export_list").html(html_list);
2730
2731		setTimeout(function() { updateFormsList_exportSaveFile(formListParams['explort']['current_lines'], formListParams['explort']['total_export'], current_loads, formListParams['explort']['select_titles'], formListParams['explort']['file_current']); }, (500));
2732
2733	}
2734
2735}
2736
2737function updateFormsList_exportAllList() {
2738
2739	if (updateFormsListExportActive) {
2740
2741		formList_list_isReact['list']  = [];
2742		formList_list_isReact['total'] = 0;
2743
2744		formListParams['explort']['old_query_param']['page']             = formListParams['page'];
2745				formListParams['explort']['old_query_param']['end_time_in_page'] = formListParams['end_time_in_page'];
2746				formListParams['explort']['old_query_param']['end_id_in_page']   = formListParams['end_id_in_page'];
2747				formListParams['explort']['old_query_param']['totals_loads']     = formListParams['totals_loads'].slice();
2748				formListParams['explort']['old_query_param']['total_items']      = formListParams['total_items'];
2749
2750				formListParams['page']             = 1;
2751				formListParams['end_time_in_page'] = 0;
2752				
2753				formListParams['end_id_in_page']   = [0, 0, 0];
2754				formListParams['totals_loads']     = [0, 0, 0];
2755
2756		updateFormsListGetList(0, 'getTitleExport');
2757
2758	}
2759
2760}
2761
2762function updateFormsList_action_react_getTitleExport() {
2763
2764	if (updateFormsListExportActive) {
2765
2766		var unic_titles = [];
2767		
2768		for (var i = 0; i < formList_list_isReact['list'].length; i++) {
2769
2770			if (isArray( formList_list_isReact['list'][i] ) || typeof formList_list_isReact['list'][i] == 'object') {
2771
2772				for (key in formList_list_isReact['list'][i]) {
2773
2774					if (key != 'query_num') {
2775						unic_titles = updateFormsListIssetTitle('strings_'+key, formList_list_isReact['list'][i][key][0], unic_titles);
2776					}
2777
2778				}
2779
2780			} else {
2781
2782				if (typeof formListParams['title_names'][ formList_list_isReact['list'][i] ] != 'undefined') {
2783					unic_titles = updateFormsListIssetTitle(formList_list_isReact['list'][i], formListParams['title_names'][ formList_list_isReact['list'][i] ], unic_titles);
2784				}
2785
2786			}
2787
2788		}
2789
2790		formListParams['explort']['titles'] = [];
2791		formListParams['explort']['query']  = updateFormsList_exportAllFormirate;
2792		formListParams['explort']['titles_list'] = unic_titles;
2793
2794		formListParams['explort']['total_lines']  = Math.ceil(formList_list_isReact['total'] / formListParams['limit']);
2795		formListParams['explort']['total_export'] = formList_list_isReact['total'];
2796
2797		
2798
2799				
2800
2801		updateFormsList_exportSelectVals(unic_titles);
2802
2803	}
2804	
2805
2806}
2807
2808function updateFormsList_exportSelectList() {
2809
2810	if (updateFormsListExportActive) {
2811
2812		formListParams['explort']['titles'] = [];
2813
2814		formListParams['explort']['query']  = updateFormsList_exportSelectedFormirate;
2815
2816		var vals_title_list = [];
2817		var vals_title_td   = $(".titles.tr .td").not(".t_check");
2818
2819		if (vals_title_td.length > 0) {
2820
2821			for (var i = 0; i < vals_title_td.length; i++) {
2822
2823				var current_name     = $(vals_title_td[i]).find(".name").html();
2824
2825					var _name_pieces = current_name.split("<br><div");
2826
2827						if (_name_pieces.length > 1) {
2828							current_name = _name_pieces[0];
2829						}
2830
2831				var current_id_split = ($(vals_title_td[i]).attr("id")+"").split("titles_");
2832				var current_id       = null;
2833
2834					if (current_id_split.length == 2 && current_id_split[1] != null && current_id_split != '' && current_id_split != ' ' && current_id_split != 'undefined' && current_id_split != 'null') {
2835						current_id = current_id_split[1];
2836					}
2837
2838				if (current_id != null) {
2839					vals_title_list[ vals_title_list.length ] = [current_id, current_name];
2840				}
2841
2842			}
2843		
2844		}
2845
2846		formListParams['explort']['titles_list'] = vals_title_list;
2847		
2848		updateFormsList_exportSelectVals(vals_title_list);
2849
2850	}
2851
2852}
2853
2854function updateFormsList_exportSelectVals(titles) {
2855
2856	if (updateFormsListExportActive) {
2857
2858		var redirt = [];
2859		  	redirt[0] = 0;
2860		    redirt[1] =  "";
2861
2862		if (typeof titles != 'undefined' && isArray(titles) && titles.length > 0) {
2863			
2864			var radio_group_html = '<div class="radio_group" onchange="formListParams[\'explort\'][\'titles\']=radio_group_get(this);">';
2865							
2866			for (var ig = -1; ig < titles.length; ig++) {
2867
2868				if (ig == -1) {current_check_params = [', true', ' checked="checked"', 'all', 'Все'];} else {var current_check_params = ['', '', titles[ig][0], titles[ig][1]];}
2869				
2870				radio_group_html += '<div class="radio"><input type="checkbox" value="'+current_check_params[2]+'" onclick="radio_group_click(this'+current_check_params[0]+');"'+current_check_params[1]+'> <label>'+current_check_params[3]+'</label></div>';
2871			
2872			}
2873
2874			radio_group_html += '</div>';
2875			radio_group_html += '<script>if (typeof radio_group_init != "undefined"){radio_group_init(".textnewmess");}</script>';
2876
2877			sodt = standartmess2('Выберите поля для экспорта', '<div class="export_block"><div class="vals_checks"><span class="title">Поля:</span>'+radio_group_html+'<br><br><a href="#" onclick="updateFormsList_exportStart();return false;">Выгрузить</a></div>');
2878			pokazarmess(sodt, '', redirt, 0, 0, 1, updateFormsListExportCanselled);
2879
2880		} else {
2881
2882			sodt = standartmess2('Ошибка!', '<div class="export_block">Ни одна запись не соответствует заданным параметрам, пожалуйста, измените параметры поиска.</div>');
2883			pokazarmess(sodt, '', redirt, 0, 0, 1, updateFormsListExportCanselled);
2884
2885		}
2886
2887	}
2888
2889}
2890
2891function updateFormsList_exportStart() {
2892
2893	if (updateFormsListExportActive) {
2894
2895		var list_titles = [];
2896
2897	if (typeof formListParams['explort']['titles'] == 'object' && formListParams['explort']['titles'].length == 0) {
2898		formListParams['explort']['titles'] = 'all';
2899	}
2900
2901		if (typeof formListParams['explort']['query'] == 'function') {
2902
2903			if (formListParams['explort']['titles'] == 'all') {
2904
2905				var checks = $(".newmessobh .newmessmess .textnewmess .radio_group .radio input[type=checkbox]");
2906
2907				if (checks.length > 1) {
2908
2909					for (var i = 1; i < checks.length; i++) {
2910						list_titles[ list_titles.length ] = $(checks[i]).val();
2911					}
2912
2913				}
2914
2915			} else {
2916
2917				list_titles = formListParams['explort']['titles'].split(",");
2918
2919			}
2920
2921			for (var il = 0; il < list_titles.length; il++) {
2922
2923				var current_val = $('.newmessobh .newmessmess .textnewmess .radio_group .radio input[value="'+list_titles[il]+'"]').parent().find("label").html();
2924
2925				list_titles[il] = [list_titles[il], current_val];
2926
2927			}
2928
2929			formListParams['explort']['query'](1, list_titles);
2930
2931		}
2932
2933	}
2934
2935}
2936
2937updateFormsListExportActive = false;
2938
2939function updateFormsListExportCanselled() {
2940
2941	updateFormsListExportActive = false;
2942
2943	if (typeof formListParams['explort']['old_query_param'] != 'undefined') {
2944
2945		for (key in formListParams['explort']['old_query_param']) {
2946
2947				if (isArray(formListParams['explort']['old_query_param'][key])) {
2948						formListParams[key] = formListParams['explort']['old_query_param'][key].slice();
2949				} else {
2950						formListParams[key] = formListParams['explort']['old_query_param'][key];
2951				}
2952
2953		}
2954
2955	}
2956
2957
2958}
2959
2960
2961function updateFormsList_action_react_setView() {
2962	updateFormsList_updateState('view');
2963}
2964
2965function updateFormsList_action_react_unsetView() {
2966	updateFormsList_updateState('new');
2967}
2968
2969function updateFormsList_action_react_delete() {
2970	
2971	updateFormsList_updateState('delete');
2972	
2973	formList_list_isReact['list_deleted'] = formList_list_isReact['list_deleted'].concat(formList_list_isReact['list']);
2974	$(".forms_block .action_block .unDelete").addClass("active");
2975
2976}
2977
2978function updateFormsList_action_react_unDelete() {
2979	
2980	is_error = updateFormsList_updateState('unDelete');
2981
2982	formListParams['action_list'] = formList_list_isReact['list_deleted_recover'];
2983
2984	if (!is_error) {
2985
2986		$(".forms_block .action_block .unDelete").removeClass("active");
2987		formList_list_isReact['list_deleted'] = [];
2988
2989	}
2990
2991}
2992
2993function updateFormsList_actionUndelete() {
2994	
2995	formList_list_isReact['list_deleted_recover'] = formListParams['action_list'];
2996	formListParams['action_list']                 = [[0], [0], [0]];
2997
2998	for (var i = 0; i < formList_list_isReact['list_deleted'].length; i++) {
2999
3000		if (typeof formList_list_isReact['list_deleted'][i]['query_num'] != 'undefined' && formList_list_isReact['list_deleted'][i]['query_num'] >= 0) {
3001
3002			var query_num = formList_list_isReact['list_deleted'][i]['query_num'];
3003
3004			formListParams['action_list'][ query_num ][ formListParams['action_list'][ query_num ].length ] = formList_list_isReact['list_deleted'][i]['id'];
3005
3006		}
3007
3008	}
3009
3010	updateFormsList_action('unDelete');
3011
3012}
3013
3014function updateFormsList_actionSetViewAll(list) {
3015	
3016	formList_list_isReact['list_view_recover'] = formListParams['action_list'];
3017	formListParams['action_list']              = list;
3018
3019	updateFormsList_action('setViewAll');
3020
3021}
3022
3023
3024function updateFormsList_action_react_setViewAll() {
3025
3026	formListParams['action_list'] = formList_list_isReact['list_view_recover'];
3027	formList_list_isReact['list_view_recover'] = [0, 0, 0];
3028
3029}
3030
3031function updateFormsList_updateState(state) {
3032
3033	if (typeof formList_list_isReact['list'] != 'undefined' && formList_list_isReact['list'].length > 0) {
3034
3035		for (var i = 0; i < formList_list_isReact['list'].length; i++) {
3036
3037			var del_states = 'new view';
3038
3039				if (state == 'delete' || state == 'unDelete') {
3040					del_states = 'delete unDelete';
3041				}
3042
3043			$("#line_"+formList_list_isReact['list'][i]['query_num']+"_"+formList_list_isReact['list'][i]['id']).removeClass(del_states).addClass(state);
3044
3045		}
3046
3047	}
3048
3049	var error_html = '';
3050	var is_error   = false;
3051
3052	for (var i = 0; i < formList_list_isReact['errors'].length; i++) {
3053
3054		if (typeof formListParams['sites'][i] != 'undefined' && formList_list_isReact['errors'][i] > 0) {
3055			
3056			var val_error = 'Неизвестная ошибка';
3057
3058			if (typeof formListParams['errors_translate'][ formList_list_isReact['errors'][i] - 1 ] != 'undefined') {
3059				val_error= formListParams['errors_translate'][ formList_list_isReact['errors'][i] - 1 ];
3060			}
3061
3062			error_html += 'Сайт ('+formListParams['sites'][i]+'), ошибка: "'+val_error+'"<br>';
3063			is_error    = true;
3064
3065		}
3066		
3067
3068	}
3069
3070	error_html += '<br><b>Пожалуйста, обратитесь к разработчику!</b>';
3071
3072	if (is_error) {
3073
3074		var redirt = [];
3075	  	redirt[0] = 0;
3076	    redirt[1] =  "";
3077	    sodt = standartmess2('Возникли следующие ошибки:', error_html);
3078	    pokazarmess(sodt, '', redirt);
3079
3080	}
3081
3082	return is_error;
3083
3084}
3085
3086
3087
3088
3089function updateFormsListCheckTimer(numTimer, type) {
3090
3091	if (typeof isReturnSend[numTimer] != 'undefined' && isReturnSend[numTimer] == false) {
3092
3093		isReturnSend[numTimer] = true;
3094		updateFormsListGetList(numTimer + 1, type);
3095
3096	}
3097
3098}
3099
3100var isReturnSend = [];
3101
3102function updateFormsListGetList(numSite, type) {
3103
3104	isReturnSend[numSite] = false;
3105	if (typeof type == 'undefined') {type = 'get';}
3106	
3107	var list_source = [];
3108	
3109	if (typeof formListParams['send_params_list']['source'] !== 'undefined') {
3110
3111		if (formListParams['send_params_list']['source'] !== 'all' && formListParams['send_params_list']['source'] != '' && formListParams['send_params_list']['source'] != ' ') {
3112			
3113			var current_list_source = formListParams['send_params_list']['source'].split(",");
3114
3115			for (var source in current_list_source) {
3116
3117				if (typeof formListParams['source'][ current_list_source[source] ] !== 'undefined') {
3118					list_source[ formListParams['source'][ current_list_source[source] ] ] = true;
3119				}
3120
3121			}
3122			
3123		}
3124
3125	}
3126
3127
3128
3129	if (formListParams['sites'].length > numSite) {
3130
3131		if (list_source.length == 0 || (typeof list_source[numSite] != 'undefined')) {
3132
3133			if (type != 'getExportLines') {
3134				$(".forms_block .list").addClass("active");
3135			}
3136
3137			n = 10000;randnax = Math.floor( Math.random() * (n+1) );
3138						var paramZap = {};
3139						paramZap["ajax"] = "1";
3140						paramZap["rand"] = randnax;
3141						paramZap["tipsave"] = type+'ScriptUser';
3142						paramZap["din1"] = formListParams['limit'];
3143						paramZap["din2"] = formListParams['page'];
3144						paramZap["din3"] = formListParams['end_time_in_page'];
3145						paramZap["din4"] = formListParams['end_id_in_page'][numSite];
3146
3147						var list_active_ids = '0';
3148
3149						if (typeof formListParams['action_list'][numSite] !== 'undefined' && isArray(formListParams['action_list'][numSite])) {
3150							list_active_ids = formListParams['action_list'][numSite].join(",");
3151						}
3152
3153						paramZap["din5"] = list_active_ids;
3154						paramZap["din6"] = formsListHtml['search_query'];
3155						
3156
3157						var start_num = 7;
3158
3159						paramZap["start_user_params"] = start_num;
3160
3161						for (key in formListParams['send_params_list']) {
3162
3163							if (key != 'source') {
3164
3165								if (isArray(formListParams['send_params_list'][key])) {
3166
3167									if (isArray(formListParams['send_params_list'][key][0])) {
3168
3169										for (var i = 0; i < formListParams['send_params_list'][key].length; i++) {
3170											
3171											paramZap["din"+start_num] = formListParams['send_params_list'][key][i].join(",");
3172
3173											if ((i + 1) < formListParams['send_params_list'][key].length) {
3174												start_num++;
3175											}
3176											
3177										}
3178
3179									} else {
3180										paramZap["din"+start_num] = formListParams['send_params_list'][key].join(",");
3181									}
3182																
3183								} else {
3184									paramZap["din"+start_num] = formListParams['send_params_list'][key];
3185								}
3186								
3187								start_num++;
3188
3189							}
3190
3191						}
3192
3193						paramZap["return"] = 'json';
3194
3195						$.post('//'+formListParams['sites'][numSite]+'/saver.php',  paramZap,
3196						  function(data){
3197						  	
3198						  	if (typeof isReturnSend[numSite] != 'undefined' && isReturnSend[numSite] == false) {
3199						  
3200							  	pars = parsjsonotvet(data);
3201
3202							  	if (type == 'get') {
3203
3204							  		if (pars[1] == 0 && typeof pars[0]['total'] != 'undefined' && pars[0]['list'].length > 0) {
3205								 	
3206									 	for (var ia = 0; ia < pars[0]['list'].length; ia++) {
3207									 		pars[0]['list'][ia]['query_num'] = numSite;
3208									 	}
3209
3210									 	formList_list = formList_list.concat(pars[0]['list']);
3211									 	
3212									 	formListParams['total_items'] += (pars[0]['total'] - 0) + formListParams['totals_loads'][numSite];
3213
3214									 }
3215
3216									
3217									
3218
3219							  	} else {
3220
3221							  		if (pars[1] == 0 && typeof pars[0]['list'] != 'undefined') {
3222
3223							  			if (pars[0]['list'].length > 0) {
3224							  				
3225							  				for (var ia = 0; ia < pars[0]['list'].length; ia++) {
3226										 		pars[0]['list'][ia]['query_num'] = numSite;
3227										 	}
3228
3229							  				formList_list_isReact['list'] = formList_list_isReact['list'].concat(pars[0]['list']);
3230
3231							  			}
3232
3233							  			if (typeof formList_list_isReact['total'] == 'undefined') {
3234							  				formList_list_isReact['total'] = 0;
3235							  			}
3236
3237							  			if (typeof pars[0]['total'] != 'undefined') {
3238							  				formList_list_isReact['total'] += (pars[0]['total'] - 0);
3239							  			}
3240							  			
3241
3242							  		}
3243
3244							  		if (typeof pars[0]['is_error'] != 'undefined' && pars[0]['is_error'] != '' && pars[0]['is_error'] != ' ') {
3245
3246							  			pars[0]['is_error'] -= 0;
3247
3248							  			if (!isNaN(pars[0]['is_error'])) {
3249							  				formList_list_isReact['errors'][numSite] = pars[0]['is_error'] - 0;
3250							  			}
3251							  			
3252							  		}
3253
3254							  	}
3255
3256							  	isReturnSend[numSite] = true;
3257								updateFormsListGetList(numSite + 1, type);
3258
3259							}
3260
3261							 
3262
3263						});	
3264
3265			setTimeout("updateFormsListCheckTimer("+numSite+", '"+type+"');", (formListParams['timer']));
3266
3267		} else {
3268			
3269			isReturnSend[numSite] = true;
3270			updateFormsListGetList(numSite + 1, type);
3271
3272		}
3273
3274	} else {
3275
3276		if (type == 'get') {
3277			updateFormsList_react();
3278		} else {
3279
3280			var react = 'updateFormsList_action_react_'+type;
3281
3282			if (typeof window[react] == 'function') {
3283				window[react]();
3284
3285			}
3286
3287		}
3288
3289		$(".forms_block .list").removeClass("active");
3290		
3291
3292		
3293
3294	}
3295
3296	
3297
3298}
3299
3300
3301
3302	

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.