PageSourceSearch

http://www.ztn.com.pl/var/js/onload.js

js ztn.com.pl collected 2026-10-02 23:05:21 UTC 71,407 bytes, 2,349 lines download raw bytes

1var cc = 1;
2
3function number_format( number, decimals, dec_point, thousands_sep ) {
4    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
5    var d = dec_point == undefined ? "," : dec_point;
6    var t = thousands_sep == undefined ? "." : thousands_sep, s = n < 0 ? "-" : "";
7    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
8    
9    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
10}
11
12function formatFileSize(filesize) {
13	if (filesize >= 1073741824) {
14	     filesize = number_format(filesize / 1073741824, 2, '.', '') + ' Gb';
15	} else { 
16		if (filesize >= 1048576) {
17     		filesize = number_format(filesize / 1048576, 2, '.', '') + ' Mb';
18   	} else { 
19			if (filesize >= 1024) {
20    		filesize = number_format(filesize / 1024, 0) + ' Kb';
21  		} else {
22    		filesize = number_format(filesize, 0) + ' bytes';
23			};
24 		};
25	};
26  return filesize;
27};
28
29function statusBarSet(tresc) {
30    if(tresc == '') tresc = 'DABEW - System Zarządzania Produkcją';
31    document.getElementById("statusBar").innerHTML=tresc; 
32}
33
34function deleteOrderItem(id, order_id) {
35
36	$.ajax({
37		type: "post",
38		url: "/lite.php5?module=Katalog&action=delete_order_item&oid="+id,
39		cache: false,
40		async: true,
41		timeout: 100000,
42		beforeSend: function(){
43///            $("#oitr"+id).empty();
44		},
45		success: function(code){
46            getOrderTotal(order_id);
47            $("#oitr"+id).slideUp();
48            $("#oistrdet"+id).slideUp();
49		},
50		error: function(){
51			$("#oitr"+id).hide();
52			$("#oitr"+id).empty();
53            $("#oitr"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
54            $("#oitr"+id).fadeIn("slow");
55		}
56	});
57}
58
59function addLastFile(id) {
60
61	$.ajax({
62		type: "post",
63		url: "/lite.php5?module=Katalog&action=addLastFile&id="+id,
64		cache: false,
65		async: true,
66		timeout: 100000,
67		beforeSend: function(){
68		},
69		success: function(code){
70
71		},
72		error: function(){
73
74		}
75	});
76}
77
78
79function wyczyscLf() {
80
81}
82function ukryjListy(id) {
83    $("#oistrdet"+id).slideUp();
84}
85
86function deleteOrder(id) {
87
88	$.ajax({
89		type: "post",
90		url: "/lite.php5?module=Katalog&action=delete_order&order_id="+id,
91		cache: false,
92		async: true,
93		timeout: 100000,
94		beforeSend: function(){
95///            $("#oitr"+id).empty();
96		},
97		success: function(code){
98            $("#liorder"+id).slideUp();
99            alert("Zamówienie zostało pomyślnie usunięte z systemu.");
100		},
101		error: function(){
102			$("#liorder"+id).hide();
103			$("#liorder"+id).empty();
104            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
105            $("#liorder"+id).fadeIn("slow");
106		}
107	});
108}
109
110function deleteUser(id, rel) {
111
112	$.ajax({
113		type: "post",
114		url: "/lite.php5?module=Katalog&action=delete_user&user_id="+ id +"&rel_id="+rel,
115		cache: false,
116		async: true,
117		timeout: 100000,
118		beforeSend: function(){
119///            $("#oitr"+id).empty();
120		},
121		success: function(code){
122            $("#liorder"+id).slideUp();
123            alert("Użytkownik został pomyślnie usunięty z systemu.");
124		},
125		error: function(){
126			$("#liorder"+id).hide();
127			$("#liorder"+id).empty();
128            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
129            $("#liorder"+id).fadeIn("slow");
130		}
131	});
132}
133
134function deleteClient(id, rel) {
135
136	$.ajax({
137		type: "post",
138		url: "/lite.php5?module=Katalog&action=delete_client&client_id="+ id +"&rel_id="+rel,
139		cache: false,
140		async: true,
141		timeout: 100000,
142		beforeSend: function(){
143///            $("#oitr"+id).empty();
144		},
145		success: function(code){
146            $("#liorder"+id).slideUp();
147            alert("Klient został pomyślnie usunięty z systemu.");
148		},
149		error: function(){
150			$("#liorder"+id).hide();
151			$("#liorder"+id).empty();
152            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
153            $("#liorder"+id).fadeIn("slow");
154		}
155	});
156}
157
158function deleteNews(id) {
159
160	$.ajax({
161		type: "post",
162		url: "/lite.php5?module=Katalog&action=delete_news&news_id="+id,
163		cache: false,
164		async: true,
165		timeout: 100000,
166		beforeSend: function(){
167///            $("#oitr"+id).empty();
168		},
169		success: function(code){
170            $("#liorder"+id).slideUp();
171            alert("Powiadomienie zostało pomyślnie usunięte z systemu.");
172		},
173		error: function(){
174			$("#liorder"+id).hide();
175			$("#liorder"+id).empty();
176            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
177            $("#liorder"+id).fadeIn("slow");
178		}
179	});
180}
181
182function readNews(id) {
183	$.ajax({
184		type: "post",
185		url: "/lite.php5?module=Katalog&action=read_news&news_id="+id,
186		cache: false,
187		async: true,
188		timeout: 100000,
189		beforeSend: function(){
190		},
191		success: function(code){
192            alert("Powiadomienie zostało oznaczone jako przeczytane.");
193            $("#rn"+id).remove();
194            $("#read"+id).remove();
195		},
196		error: function(){
197		}
198	});
199}
200
201function readOrder(id) {
202	$.ajax({
203		type: "post",
204		url: "/lite.php5?module=Katalog&action=read_order&order_id="+id,
205		cache: false,
206		async: true,
207		timeout: 100000,
208		beforeSend: function(){
209		},
210		success: function(code){
211            alert("Potwierdzono zapoznanie się ze zmianami w etapach produkcyjnych zlecenia.");
212            $("#rn"+id).remove();
213            $("#read"+id).remove();
214		},
215		error: function(){
216		}
217	});
218}
219
220function deleteSubcontractor(id, rel) {
221
222	$.ajax({
223		type: "post",
224		url: "/lite.php5?module=Katalog&action=delete_subcontractor&subcontractor_id="+ id +"&rel_id="+rel,
225		cache: false,
226		async: true,
227		timeout: 100000,
228		beforeSend: function(){
229///            $("#oitr"+id).empty();
230		},
231		success: function(code){
232            $("#liorder"+id).slideUp();
233            alert("Podwykonawca został pomyślnie usunięty z systemu.");
234		},
235		error: function(){
236			$("#liorder"+id).hide();
237			$("#liorder"+id).empty();
238            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
239            $("#liorder"+id).fadeIn("slow");
240		}
241	});
242}
243
244function banUser(id, ban) {
245
246	$.ajax({
247		type: "post",
248		url: "/lite.php5?module=Katalog&action=ban_user&user_id="+ id +"&ban="+ban,
249		cache: false,
250		async: true,
251		timeout: 100000,
252		beforeSend: function(){
253///            $("#oitr"+id).empty();
254		},
255		success: function(code){
256            //$("#liorder"+id).slideUp();
257            alert("Prawa dostępu do Systemu dla wybranego użytkownika zostały zmienione.");
258            $("#banbutton"+id).attr("disabled","disabled");
259            if(ban == 1) $("#banbutton"+id).html('Dostęp zablokowany');
260            else if(ban == 0) $("#banbutton"+id).html('Dostęp odblokowany');
261		},
262		error: function(){
263			$("#liorder"+id).hide();
264			$("#liorder"+id).empty();
265            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
266            $("#liorder"+id).fadeIn("slow");
267		}
268	});
269}
270
271function banClient(id, ban) {
272
273	$.ajax({
274		type: "post",
275		url: "/lite.php5?module=Katalog&action=ban_client&client_id="+ id +"&ban="+ban,
276		cache: false,
277		async: true,
278		timeout: 100000,
279		beforeSend: function(){
280		},
281		success: function(code){
282            alert("Prawa dostępu do Systemu dla wybranego klienta zostały zmienione.");
283            $("#banbutton"+id).attr("disabled","disabled");
284            if(ban == 1) $("#banbutton"+id).html('Dostęp zablokowany');
285            else if(ban == 0) $("#banbutton"+id).html('Dostęp odblokowany');
286		},
287		error: function(){
288			$("#liorder"+id).hide();
289			$("#liorder"+id).empty();
290            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
291            $("#liorder"+id).fadeIn("slow");
292		}
293	});
294}
295
296function deleteList(id) {
297
298	$.ajax({
299		type: "post",
300		url: "/lite.php5?module=Katalog&action=delete_list&list_id="+id,
301		cache: false,
302		async: true,
303		timeout: 100000,
304		beforeSend: function(){
305///            $("#oitr"+id).empty();
306		},
307		success: function(code){
308            $("#liorder"+id).slideUp();
309		},
310		error: function(){
311			$("#liorder"+id).hide();
312			$("#liorder"+id).empty();
313            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
314            $("#liorder"+id).fadeIn("slow");
315		}
316	});
317}
318
319function deleteComp(id) {
320
321	$.ajax({
322		type: "post",
323		url: "/lite.php5?module=Katalog&action=delete_comp&comp_id="+id,
324		cache: false,
325		async: true,
326		timeout: 100000,
327		beforeSend: function(){
328///            $("#oitr"+id).empty();
329		},
330		success: function(code){
331            $("#liorder"+id).slideUp();
332		},
333		error: function(){
334			$("#liorder"+id).hide();
335			$("#liorder"+id).empty();
336            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
337            $("#liorder"+id).fadeIn("slow");
338		}
339	});
340}
341
342function setListActive(id) {
343
344	$.ajax({
345		type: "post",
346		url: "/lite.php5?module=Katalog&action=set_list_active&list_id="+id,
347		cache: false,
348		async: true,
349		timeout: 100000,
350		beforeSend: function(){
351///            $("#oitr"+id).empty();
352		},
353		success: function(code){
354            if(code == "ok")
355            {
356             alert("Lista została ustawiona jako aktywna");
357             $("#listac"+id).fadeOut();  
358            }
359            else alert("Wystąpił błąd");
360		},
361		error: function(){
362			$("#liorder"+id).hide();
363			$("#liorder"+id).empty();
364            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
365            $("#liorder"+id).fadeIn("slow");
366		}
367	});
368}
369
370function deleteFromList(iter, oid, iid, id, list) {
371
372	$.ajax({
373		type: "post",
374		url: "/lite.php5?module=Katalog&action=delete_from_list&list_id="+ list +"&id="+ iid +"&oid="+ oid +"&item_id="+id,
375		cache: false,
376		async: true,
377		timeout: 100000,
378		beforeSend: function(){
379///            $("#oitr"+id).empty();
380		},
381		success: function(code){
382            $("#oitr"+iter).slideUp();
383		},
384		error: function(){
385			$("#oitr"+iter).hide();
386			$("#oitr"+iter).empty();
387            $("#oitr"+iter).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
388            $("#oitr"+iter).fadeIn("slow");
389		}
390	});
391}
392
393function addItemToList(id, amount) {
394
395	$.ajax({
396		type: "post",
397		url: "/lite.php5?module=Katalog&action=add_item_to_list&item_id="+ id +"&amount="+amount,
398		cache: false,
399		async: true,
400		timeout: 100000,
401		beforeSend: function(){
402///            $("#oitr"+id).empty();
403		},
404		success: function(code){
405		    if(code != "nok")
406            {
407                $("#liorder"+id).slideUp();
408                alert("Produkt został pomyślnie przypisany do listy wysyłkowej, ilość: "+amount);
409                $("#list"+id).html('<font style="size: 8px; font-weight: bold">Lista: '+ code +'</font>');
410            }
411            else
412            {
413                alert("Musisz wybrać listę, aby móc dodawać do niej produkty.");
414            }
415		},
416		error: function(){
417			$("#liorder"+id).hide();
418			$("#liorder"+id).empty();
419            $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
420            $("#liorder"+id).fadeIn("slow");
421		}
422	});
423}
424
425function deleteFile(id) {
426
427	$.ajax({
428		type: "post",
429		url: "/lite.php5?module=Katalog&action=delete_file&file_id="+id,
430		cache: false,
431		async: true,
432		timeout: 100000,
433		beforeSend: function(){
434///            $("#oitr"+id).empty();
435		},
436		success: function(code){
437            $("#lifile"+id).slideUp();
438		},
439		error: function(){
440			$("#lifile"+id).hide();
441			$("#lifile"+id).empty();
442            $("#lifile"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
443            $("#lifile"+id).fadeIn("slow");
444		}
445	});
446}
447
448function deleteComment(id) {
449
450	$.ajax({
451		type: "post",
452		url: "/lite.php5?module=Katalog&action=delete_comment&comment_id="+id,
453		cache: false,
454		async: true,
455		timeout: 100000,
456		beforeSend: function(){
457///            $("#oitr"+id).empty();
458		},
459		success: function(code){
460            $("#commentdiv"+id).slideUp();
461		},
462		error: function(){
463			$("#commentdiv"+id).hide();
464			$("#commentdiv"+id).empty();
465            $("#commentdiv"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
466            $("#commentdiv"+id).fadeIn("slow");
467		}
468	});
469}
470
471function deleteCommentOrder(id) {
472
473	$.ajax({
474		type: "post",
475		url: "/lite.php5?module=Katalog&action=delete_comment_order&comment_id="+id,
476		cache: false,
477		async: true,
478		timeout: 100000,
479		beforeSend: function(){
480///            $("#oitr"+id).empty();
481		},
482		success: function(code){
483            $("#commentdiv"+id).slideUp();
484		},
485		error: function(){
486			$("#commentdiv"+id).hide();
487			$("#commentdiv"+id).empty();
488            $("#commentdiv"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
489            $("#commentdiv"+id).fadeIn("slow");
490		}
491	});
492}
493
494function setDateSentReal(id, iid) {
495    re = /^\d{4}-\d{2}-\d{2}$/; 
496    if(document.getElementById(id).value == '' || !document.getElementById(id).value.match(re)) 
497    {
498        alert("Nieprawidłowy format daty wysyłki!");
499    }
500    else
501    {
502    	$.ajax({
503    		type: "post",
504    		url: "/lite.php5?module=Katalog&action=set_date_ship_real&date=" + document.getElementById(id).value + "&order_id="+iid,
505    		cache: false,
506    		async: true,
507    		timeout: 100000,
508    		beforeSend: function(){
509    ///            $("#oitr"+id).empty();
510    		},
511    		success: function(code){
512    		  $("#buttdate"+iid).html("Zapisano");
513              $("#buttdate"+iid).attr("disabled","disabled");
514              $("#dateship"+iid).attr("disabled","disabled");
515    		},
516    		error: function(){
517    			$("#buttdate"+id).hide();
518    			$("#liorder"+id).empty();
519                $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
520                $("#liorder"+id).fadeIn("slow");
521    		}
522    	});
523    }
524}
525
526function setDateSentListReal(id, iid) {
527    re = /^\d{4}-\d{2}-\d{2}$/; 
528    if(document.getElementById(id).value == '' || !document.getElementById(id).value.match(re)) 
529    {
530        alert("Nieprawidłowy format daty wysyłki!");
531    }
532    else
533    {
534        if(confirm("Czy jesteś pewien, że chcesz ustawić datę wysyłki (" + document.getElementById(id).value + ") produktów z wybranej listy?"))
535        {
536        	$.ajax({
537        		type: "post",
538        		url: "/lite.php5?module=Katalog&action=set_date_ship_list_real&date=" + document.getElementById(id).value + "&list_id="+iid,
539        		cache: false,
540        		async: true,
541        		timeout: 100000,
542        		beforeSend: function(){
543        ///            $("#oitr"+id).empty();
544        		},
545        		success: function(code){
546        		  $("#buttdate"+iid).html("Zapisano");
547                  $("#buttdate"+iid).attr("disabled","disabled");
548                  $("#dateship"+iid).attr("disabled","disabled");
549        		},
550        		error: function(){
551        			$("#buttdate"+id).hide();
552        			$("#liorder"+id).empty();
553                    $("#liorder"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
554                    $("#liorder"+id).fadeIn("slow");
555        		}
556        	});
557        }
558    }
559}
560
561function deleteItem(id) {
562
563	$.ajax({
564		type: "post",
565		url: "/lite.php5?module=Katalog&action=delete_item&item_id="+id,
566		cache: false,
567		async: true,
568		timeout: 100000,
569		beforeSend: function(){
570///            $("#oitr"+id).empty();
571		},
572		success: function(code){
573            $("#liitem"+id).slideUp();
574		},
575		error: function(){
576			$("#liitem"+id).hide();
577			$("#liitem"+id).empty();
578            $("#liitem"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
579            $("#liitem"+id).fadeIn("slow");
580		}
581	});
582}
583
584function getOrderTotal(id) {
585
586	$.ajax({
587		type: "post",
588		url: "/lite.php5?module=Katalog&action=get_order_total&order_id="+id,
589		cache: false,
590		async: true,
591		timeout: 100000,
592		success: function(code){
593            $("#orderprize"+id).html(code);
594		}
595	});
596}
597
598
599function formOrderItemsEdit(id, oid) {
600
601	$.ajax({
602		type: "post",
603		url: "/lite.php5?module=Katalog&action=add_order_item_form&order_id="+oid+"&edit=true&oid="+id,
604		cache: false,
605		async: true,
606		timeout: 100000,
607		beforeSend: function(){
608
609		},
610		success: function(code){
611            $("#oiadd").hide();
612            $("#oiadd").html(code);
613            $("#oiadd").slideDown();
614            formOrderItemsAdd(oid);
615		},
616		error: function(){
617
618		}
619	});
620}
621
622
623
624
625function getOrderItems(id) {
626
627
628    if($.trim($("#ois"+id).text()) == "") 
629    {
630    	$.ajax({
631    		type: "post",
632    		url: "/lite.php5?module=Katalog&action=order_items&order_id="+id,
633    		cache: false,
634    		async: true,
635    		timeout: 100000,
636    		beforeSend: function(){
637                $("#ois"+id).empty();
638    		},
639    		success: function(code){
640                $("#ois"+id).html(code);
641                
642                $("#ois"+id).slideDown(500);
643                $(".oitrdetcl").slideUp();
644    		},
645    		error: function(){
646    			$("#ois"+id).hide();
647    			$("#ois"+id).empty();
648                $("#ois"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
649                $("#ois"+id).fadeIn("slow");
650    		}
651    	});
652    }
653    $("#ois"+id).slideToggle(500);
654    $(".oitrdetcl").slideUp();
655}
656
657function getOrderComments(id) {
658
659
660    if($.trim($("#oiss"+id).text()) == "") 
661    {
662    	$.ajax({
663    		type: "post",
664    		url: "/lite.php5?module=Katalog&action=order_comments&order_id="+id,
665    		cache: false,
666    		async: true,
667    		timeout: 100000,
668    		beforeSend: function(){
669                $("#oiss"+id).empty();
670    		},
671    		success: function(code){
672                $("#oiss"+id).html(code);
673                
674                $("#oiss"+id).slideDown(500);
675    		},
676    		error: function(){
677    			$("#oiss"+id).hide();
678    			$("#oiss"+id).empty();
679                $("#oiss"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
680                $("#oiss"+id).fadeIn("slow");
681    		}
682    	});
683    }
684    $("#pli"+id).remove();
685}
686
687function getAllLogs(id) {
688
689    	$.ajax({
690    		type: "post",
691    		url: "/lite.php5?module=Katalog&action=get_user_logs&user_id="+id,
692    		cache: false,
693    		async: true,
694    		timeout: 100000,
695    		beforeSend: function(){
696                //$("#loguser"+id).empty();
697    		},
698    		success: function(code){
699                $("#loguser"+id).append(code);
700                $("#logdel"+id).remove();
701    		},
702    		error: function(){
703    			$("loguser"+id).hide();
704    			$("loguser"+id).empty();
705                $("loguser"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
706                $("loguser"+id).fadeIn("slow");
707    		}
708    	});
709}
710
711function getAllUsersLogs(start) {
712        var startt = (start+20);
713    	$.ajax({
714    		type: "post",
715    		url: "/lite.php5?module=Katalog&action=get_all_logs&n="+start,
716    		cache: false,
717    		async: true,
718    		timeout: 100000,
719    		beforeSend: function(){
720                //$("#loguser"+id).empty();
721    		},
722    		success: function(code){
723                $("#loguser").append(code);
724                $("#logdeldiv").empty();
725                if(code != "") $("#logdeldiv").html('<a id="logdel" href="#" onclick="javascript:getAllUsersLogs('+ startt +');" style="color: #CF0000; text-decoration: none"><small><strong style="color: #CF0000">Pokaż więcej</strong></small></a>');
726    		},
727    		error: function(){
728    			$("loguser").hide();
729    			$("loguser").empty();
730                $("loguser").html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
731                $("loguser").fadeIn("slow");
732    		}
733    	});
734}
735
736function getAllLogins(id) {
737    	$.ajax({
738    		type: "post",
739    		url: "/lite.php5?module=Katalog&action=get_user_logins&user_id="+id,
740    		cache: false,
741    		async: true,
742    		timeout: 100000,
743    		beforeSend: function(){
744                //$("#loguser"+id).empty();
745    		},
746    		success: function(code){
747                $("#loginuser"+id).append(code);
748                $("#logindel"+id).remove();
749    		},
750    		error: function(){
751    			$("loginuser"+id).hide();
752    			$("loginuser"+id).empty();
753                $("loginuser"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
754                $("loginuser"+id).fadeIn("slow");
755    		}
756    	});
757}
758
759function getOrderItemsManage(id) {
760
761	$.ajax({
762		type: "post",
763		url: "/lite.php5?module=Katalog&action=order_items&manage=true&order_id="+id,
764		cache: false,
765		async: true,
766		timeout: 100000,
767		beforeSend: function(){
768            $("#oicont"+id).empty();
769		},
770		success: function(code){
771            $("#oicont").html(code);
772            $("#oicont").slideDown();
773            $(".oitrdetcl").slideUp();
774		},
775		error: function(){
776			$("#oicont").hide();
777			$("#oicont").empty();
778            $("#oicont").html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
779            $("#oicont").fadeIn("slow");
780		}
781	});
782}
783
784function getItemOrders(id) {
785
786    if($.trim($("#ois"+id).text()) == "") 
787    {
788    	$.ajax({
789    		type: "post",
790    		url: "/lite.php5?module=Katalog&action=item_orders&item_id="+id,
791    		cache: false,
792    		async: true,
793    		timeout: 100000,
794    		beforeSend: function(){
795                $("#ois"+id).empty();
796    		},
797    		success: function(code){
798                $("#ois"+id).html(code);
799                $("#ois"+id).slideDown(500);
800    		},
801    		error: function(){
802    			$("#ois"+id).hide();
803    			$("#ois"+id).empty();
804                $("#ois"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
805                $("#ois"+id).fadeIn("slow");
806    		}
807    	});
808    }
809    $("#ois"+id).slideToggle(500);
810}
811
812function loadPage(url) {
813    url=url.replace('#','');
814	$.ajax({
815		type: "post",
816		url: "/lite.php5?module=Katalog&action="+url,
817		cache: false,
818		async: true,
819		timeout: 100000,
820		beforeSend: function(){
821		    $("#loadBar").show();
822            $("#cont").empty();
823		},
824		success: function(code){
825            $("#cont").html(code);
826            if(url.indexOf("items_manage&") > 0) $(".oitrdetcl").slideUp();
827            $("#cont").fadeIn("slow");
828            $("#loadBar").hide();
829		},
830		error: function(){
831			$("#c
831ont").hide();
832			$("#cont").empty();
833            $("#cont").html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
834            $("#cont").fadeIn("slow");
835		}
836	});
837}
838
839function editFileForm(id) {
840	$.ajax({
841		type: "post",
842		url: "/lite.php5?module=Katalog&action=file_edit_form&file_id="+id,
843		cache: false,
844		async: true,
845		timeout: 100000,
846		beforeSend: function(){
847            $("#contf"+id).empty();
848		},
849		success: function(code){
850            $("#contf"+id).html(code);
851            $("#contf"+id).fadeIn("slow");
852		},
853		error: function(){
854			$("#contf"+id).hide();
855			$("#contf"+id).empty();
856            $("#contf"+id).html('<h1>Wystąpił problem z pobieraniem strony...</h1>');
857            $("#contf"+id).fadeIn("slow");
858		}
859	});
860}
861
862function SP_News(typ)
863{    	
864    if(typ == "news")
865    {
866    	$(".message_list .message_body").hide();
867    	$(".message_list li:gt(19)").hide();
868    	$(".show_all_message").live('click', function() {
869    		$(this).hide()
870    		$(".show_recent_only").show()
871    		$(".message_list li:gt(19)").slideDown()
872    		return false;
873    	});
874    	$(".show_recent_only").live('click', function() {
875    		$(this).hide()
876    		$(".show_all_message").show()
877    		$(".message_list li:gt(19)").slideUp()
878    		return false;
879    	});  
880    }
881    if(typ == "items")
882    {
883    	$(".message_list .message_body").hide();
884    	$(".message_list li:gt(16)").hide();
885    	$(".show_all_message").live('click', function() {
886    		$(this).hide()
887    		$(".show_recent_only").show()
888    		$(".message_list li:gt(16)").slideDown()
889    		return false;
890    	});
891    	$(".show_recent_only").live('click', function() {
892    		$(this).hide()
893    		$(".show_all_message").show()
894    		$(".message_list li:gt(16)").slideUp()
895    		return false;
896    	});  
897    }
898    else if(typ == "orders")
899    {
900    	$(".message_list .message_body").hide();
901    	$(".message_list li:gt(9)").hide();
902    	$(".show_all_message").live('click', function() {
903    		$(this).hide()
904    		$(".show_recent_only").show()
905    		$(".message_list li:gt(9)").slideDown()
906    		return false;
907    	});
908    	$(".show_recent_only").live('click', function() {
909    		$(this).hide()
910    		$(".show_all_message").show()
911    		$(".message_list li:gt(9)").slideUp()
912    		return false;
913    	});  
914    }
915    else if(typ == "files")
916    {
917    	$(".message_list .message_body").hide();
918    }
919    
920    else if(typ == "lists")
921    {
922    	$(".message_list .message_body").hide();
923    }
924    
925    else if(typ == "clients")
926    {
927    	$(".message_list .message_body").hide();
928    }
929    
930    else if(typ == "users")
931    {
932    	$(".message_list .message_body").hide();
933    }
934
935    	$(".message_head").click(function(){
936    		$(this).next(".message_body").slideToggle(500)
937    		return false;
938    	});
939    	$(".collpase_all_message").live('click', function() {
940    		$(".message_body").slideDown(500)
941    		return false;
942    	});
943}
944
945function formOrderAdd(edit)
946{
947    jQuery.validator.messages.required = "";
948
949    $(document).ready(function(){
950    	validator = $("#addOrderForm").validate({
951           onkeyup: false,
952
953    		rules: {
954    			order_symbol_dabew: {
955    				required: true,
956    				minlength: 3,
957                    remote: "/lite.php5?&module=Katalog&action=check_symbol_exists&edit="+edit
958    			},
959    			order_symbol_client: {
960    				required: true,
961    				minlength: 3,
962                    remote: "/lite.php5?&module=Katalog&action=check_symbol_exists&edit="+edit
963    			},
964    			order_client_id: {
965    				required: true,
966    				minlength: 1
967    			},
968    			order_time_sent: {
969    				required: true,
970    				minlength: 10,
971                    maxlength: 10
972    			},
973    			order_time_ship: {
974    				required: true,
975    				minlength: 10,
976                    maxlength: 10
977    			},
978    			order_carer: {
979    				required: true,
980    				minlength: 3
981    			},
982    			order_country: {
983    				required: true,
984    				minlength: 3
985    			},
986    			order_city: {
987    				required: true,
988    				minlength: 3
989    			}
990    		},
991    		messages: {
992    			order_symbol_dabew: {
993    				required: "<br />Pole nie może być puste<br /><br />",
994    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />",
995                    remote: jQuery.format("<br />Symbol {0} został użyty w innym zamówieniu<br /><br />")
996    			},
997    			order_symbol_client: {
998    				required: "<br />Pole nie może być puste<br /><br />",
999    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />",
1000                    remote: jQuery.format("<br />Symbol {0} został użyty w innym zamówieniu<br /><br />")
1001    			},
1002    			order_client_id: {
1003    				required: "<br />Pole nie może być puste<br /><br />",
1004    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
1005    			},
1006    			order_time_sent: {
1007    				required: "<br />Pole nie może być puste<br /><br />",
1008    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
1009    			},
1010    			order_time_ship: {
1011    				required: "<br />Pole nie może być puste<br /><br />",
1012    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
1013    			},
1014    			order_carer: {
1015    				required: "<br />Pole nie może być puste<br /><br />",
1016    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
1017    			},
1018    			order_country: {
1019    				required: "<br />Pole nie może być puste<br /><br />",
1020    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
1021    			},
1022    			order_city: {
1023    				required: "<br />Pole nie może być puste<br /><br />",
1024    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
1025    			}
1026    		},
1027    		submitHandler: function(form) {
1028    			$.ajax({
1029    			        type: "post",
1030    					data: $("#addOrderForm * ").serialize(),
1031    					url: "/lite.php5?module=Katalog&action=order_add_done", 
1032                        cache: false,
1033    					async: true,
1034    					timeout: 100000,
1035    					beforeSend: function(html){
1036    						$("#addOrderForm * ").attr("disabled","disabled");
1037    					},
1038    					success: function(code){
1039                                $("#form_div").fadeOut("slow");
1040                                $("#form_div").html(code);
1041                                //$("#form_div").html("Zamówienie zostało pomyślnie dodane! Tutaj nastąpi przekierowanie do wyboru elementów 
1041składowych zamówienia. Kliknij w link 'Zamówienia' w górnym menu, aby zobaczyć zamówienia, w tym nowododane.");
1042                                $("#form_div").fadeIn("slow");
1043    					},
1044    					error: function(){
1045    							$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1046    							$("#contact-response").fadeIn("slow");
1047    							$("#contact-form * ").attr("disabled","");
1048    							$("#sub").val("Zapisz");
1049    					}
1050    				});
1051    		}
1052    	});
1053    	$("#reset").click(function() {
1054    			validator.resetForm();
1055    			$("#contact-response").hide("slow");
1056    			$("#contact-response").empty();
1057    	});
1058    });
1059   	$("#order_carer").autocomplete("lite.php5", {
1060    	width: 300,
1061    	selectFirst: false,
1062        extraParams: {
1063            module: "Katalog",
1064            action: "order_carer_search"
1065    	},
1066        mustMatch: false
1067	});
1068   	$("#order_country").autocomplete("lite.php5", {
1069    	width: 300,
1070    	selectFirst: false,
1071        extraParams: {
1072            module: "Katalog",
1073            action: "order_dest_country_search"
1074    	},
1075        mustMatch: false
1076	});
1077   	$("#order_city").autocomplete("lite.php5", {
1078    	width: 300,
1079    	selectFirst: false,
1080        extraParams: {
1081            module: "Katalog",
1082            action: "order_dest_city_search"
1083    	},
1084        mustMatch: false
1085	});
1086    
1087}
1088function sleep(milliseconds) {
1089var start = new Date().getTime();
1090while ((new Date().getTime() - start) < milliseconds){
1091// Do nothing
1092}
1093}
1094function formOrderSearch()
1095{
1096    $(document).ready(function(){
1097    	validator = $("#ordersToolBarForm").validate({
1098    		rules: {
1099    		},
1100    		messages: {
1101    		},
1102    		submitHandler: function(form) {
1103    			$.ajax({
1104    			      type: "POST",
1105    					data: $("#ordersToolBarForm * ").serialize(),
1106    					url: "/lite.php5?module=Katalog&action=orderReload", 
1107                        cache: false,
1108    					async: true,
1109    					timeout: 100000,
1110    					beforeSend: function(html){
1111    						$("#ordersToolBarForm * ").attr("disabled","disabled");
1112                            $("#os_sb").html('<img src="/img/loading.gif" />');
1113    						//$("#contact-response").html("Proszę czekać...");
1114                            //$("#contact-response").fadeIn("slow");
1115    					},
1116    					success: function(code){
1117                                $("#ordersToolBarForm * ").attr("disabled","");
1118                                $("#cont").fadeOut("fast");
1119                                sleep(100);
1120                                $("#cont").empty();
1121                                sleep(100);
1122                                $("#cont").html(code);
1123                                $("#cont").fadeIn("slow");
1124                                $("#os_sb").html('<input style="height: 20px" type="submit" value="Szukaj" />');
1125    					},
1126    					error: function(){
1127    					        alert('Błąd.');
1128    							//$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1129    							//$("#contact-response").fadeIn("slow");
1130    							//$("#contact-form * ").attr("disabled","");
1131    							//$("#sub").val("Zapisz");
1132                                $("#os_sb").html('<input style="height: 20px" type="submit" value="Szukaj" />');
1133    					}
1134    				});
1135    		}
1136    	});
1137    });
1138}
1139function formItemSearch()
1140{
1141    $(document).ready(function(){
1142    	validator = $("#ordersToolBarForm").validate({
1143    		rules: {
1144    		},
1145    		messages: {
1146    		},
1147    		submitHandler: function(form) {
1148    			$.ajax({
1149    			      type: "POST",
1150    					data: $("#ordersToolBarForm * ").serialize(),
1151    					url: "/lite.php5?module=Katalog&action=itemReload", 
1152                        cache: false,
1153    					async: true,
1154    					timeout: 100000,
1155    					beforeSend: function(html){
1156    						$("#ordersToolBarForm * ").attr("disabled","disabled");
1157                            $("#os_sb").html('<img src="/img/loading.gif" />');
1158    						//$("#contact-response").html("Proszę czekać...");
1159                            //$("#contact-response").fadeIn("slow");
1160    					},
1161    					success: function(code){
1162                                $("#ordersToolBarForm * ").attr("disabled","");
1163                                $("#cont").fadeOut("fast");
1164                                sleep(100);
1165                                $("#cont").empty();
1166                                sleep(100);
1167                                $("#cont").html(code);
1168                                $("#cont").fadeIn("slow");
1169                                $("#os_sb").html('<input style="height: 20px" type="submit" value="Szukaj" />');
1170    					},
1171    					error: function(){
1172    					        alert('Błąd.');
1173    							//$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1174    							//$("#contact-response").fadeIn("slow");
1175    							//$("#contact-form * ").attr("disabled","");
1176    							//$("#sub").val("Zapisz");
1177                                $("#os_sb").html('<input style="height: 20px" type="submit" value="Szukaj" />');
1178    					}
1179    				});
1180    		}
1181    	});
1182    });
1183}
1184
1185function formListSearch()
1186{
1187    $(document).ready(function(){
1188    	validator = $("#ordersToolBarForm").validate({
1189    		rules: {
1190    		},
1191    		messages: {
1192    		},
1193    		submitHandler: function(form) {
1194    			$.ajax({
1195    			      type: "POST",
1196    					data: $("#ordersToolBarForm * ").serialize(),
1197    					url: "/lite.php5?module=Katalog&action=listReload", 
1198                        cache: false,
1199    					async: true,
1200    					timeout: 100000,
1201    					beforeSend: function(html){
1202    						$("#ordersToolBarForm * ").attr("disabled","disabled");
1203                            $("#os_sb").html('<img src="/img/loading.gif" />');
1204    						//$("#contact-response").html("Proszę czekać...");
1205                            //$("#contact-response").fadeIn("slow");
1206    					},
1207    					success: function(code){
1208                                $("#ordersToolBarForm * ").attr("disabled","");
1209                                $("#cont").fadeOut("fast");
1210                                sleep(100);
1211                                $("#cont").empty();
1212                                sleep(100);
1213                                $("#cont").html(code);
1214                                $("#cont").fadeIn("slow");
1215                                $("#os_sb").html('<input style="height: 20px" type="submit" value="Szukaj" />');
1216    					},
1217    					error: function(){
1218    					        alert('Błąd.');
1219                                $("#os_sb").html('<input style="height: 20px" type="submit" value="Szukaj" />');
1220    					}
1221    				});
1222    		}
1223    	});
1224    });
1225}
1226
1227function formFilesSearch()
1228{
1229    $(document).ready(function(){
1230    	validator = $("#filesToolBarForm").validate({
1231    		rules: {
1232    		},
1233    		messages: {
1234    		},
1235    		submitHandler: function(form) {
1236    			$.ajax({
1237    			      type: "POST",
1238    					data: $("#filesToolBarForm * ").serialize(),
1239    					url: "/lite.php5?module=Katalog&action=filesReload", 
1240                        cache: false,
1241    					async: true,
1242    					timeout: 100000,
1243    					beforeSend: function(html){
1244    						$("#filesToolBarForm * ").attr("disabled","disabled");
1245                            $("#os_sb").html('<img src="/img/loading.gif" />');
1246    						//$("#contact-response").html("Proszę czekać...");
1247                            //$("#contact-response").fadeIn("slow");
1248    					},
1249    					success: function(code){
1250                                $("#filesToolBarForm * ").attr("disabled","");
1251                                $("#cont").fadeOut("fast");
1252                                sleep(100);
1253                                $("#cont").empty();
1254                                sleep(100);
1255                                $("#cont").html(code);
1256                                $("#cont").fadeIn("slow");
1257                                $("#os_sb").html('<input style="height: 20px" type="submit" value="Szukaj" />');
1258    					},
1259    					error: function(){
1260    					        alert('Błąd.');
1261    							//$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1262    							//$("#contact-response").fadeIn("slow");
1263    							//$("#contact-form * ").attr("disabled","");
1264    							//$("#sub").val("Zapisz");
1265                                $("#os_sb").html('<input style="height: 20px" type="submit" value="Szukaj" />');
1266    					}
1267    				});
1268    		}
1269    	});
1270    });
1271}
1272function hideTBC()
1273{
1274    $("#toolBarCont").empty();
1275    $("#toolBarCont").height(0);
1276    $("#toolBarCont").attr("style", "");
1277    $("#cont").height(609);
1278}
1279function formItemAdd()
1280{
1281    $(document).ready(function(){
1282    	validator = $("#addItemForm").validate({
1283    		rules: {
1284    			item_symbol: {
1285    				required: true,
1286    				minlength: 1
1287    			},
1288    			item_name_dabew: {
1289    				required: true,
1290    				minlength: 1
1291    			},
1292    			item_name_client: {
1293    				required: true,
1294    				minlength: 1
1295    			},
1296    			item_color: {
1297    				required: true,
1298    				minlength: 1
1299    			},
1300    			item_amount: {
1301    				required: true,
1302    				minlength: 1
1303    			},
1304    			item_prize: {
1305    				required: true,
1306    				minlength: 1
1307    			},
1308    			item_weight: {
1309    				required: true,
1310    				minlength: 1
1311    			},
1312    			item_symbol: {
1313    				required: true,
1314    				minlength: 1
1315    			}
1316    		},
1317    		submitHandler: function(form) {
1318    			$.ajax({
1319    			      type: "post",
1320    					data: $("#addItemForm * ").serialize(),
1321    					url: "/lite.php5?module=Katalog&action=item_add_done", 
1322                        cache: false,
1323    					async: true,
1324    					timeout: 100000,
1325    					beforeSend: function(html){
1326                                $("#addItemForm * ").attr("disabled","disabled");
1327    					},
1328    					success: function(code){
1329                                $("#form_diva").fadeOut("slow");
1330                                $("#form_diva").html('Produkt został pomyślnie zapisany! Kliknij <a href="/produkty.html"><strong>tutaj</strong></a>, aby powrócić do listy produktów.');
1331                                $("#form_diva").fadeIn("slow");
1332    					},
1333    					error: function(){
1334    							$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1335    							$("#contact-response").fadeIn("slow");
1336    							$("#contact-form * ").attr("disabled","");
1337    							$("#sub").val("Zapisz");
1338    					}
1339    				});
1340    		}
1341    	});
1342    	$("#reset").click(function() {
1343    			validator.resetForm();
1344    			$("#contact-response").hide("slow");
1345    			$("#contact-response").empty();
1346    	});
1347    });
1348
1349	   
1350	function formatItem(row) {
1351		return row[0] + " (<i>" + row[1] + "</i>)";
1352	}
1353	function formatResult(row) {
1354		return row[0].replace(/(<.+?>)/gi, '');
1355	}
1356   	$("#item_symbol").autocomplete("lite.php5", {
1357    	width: 300,
1358    	selectFirst: false,
1359        extraParams: {
1360            module: "Katalog",
1361            action: "item_symbol_search"
1362    	},
1363        
1364		formatItem: formatItem,
1365		formatResult: formatResult
1366	});
1367   	$("#item_color").autocomplete("lite.php5", {
1368    	width: 300,
1369    	selectFirst: false,
1370        extraParams: {
1371            module: "Katalog",
1372            action: "item_color_search"
1373    	}
1374	});
1375}
1376
1377
1378
1379function formCompAdd(edit, simple)
1380{
1381    $(document).ready(function(){
1382    	validator = $("#addCompForm").validate({
1383    		rules: {
1384    			comp_name: {
1385    				required: true,
1386    				minlength: 1,
1387                    remote: "/lite.php5?&module=Katalog&action=check_comp_name_exists&edit="+edit
1388    			},
1389    			comp_symbol: {
1390    				required: true,
1391    				minlength: 1,
1392                    remote: "/lite.php5?&module=Katalog&action=check_comp_symbol_exists&edit="+edit
1393    			}
1394    		},
1395    		submitHandler: function(form) {
1396    			$.ajax({
1397    			      type: "post",
1398    					data: $("#addCompForm * ").serialize(),
1399    					url: "/lite.php5?module=Katalog&action=comp_add_done", 
1400                        cache: false,
1401    					async: true,
1402    					timeout: 100000,
1403    					beforeSend: function(html){
1404    						$("#addCompForm * ").attr("disabled","disabled");
1405    					},
1406    					success: function(code){
1407                                $("#form_div").fadeOut("slow");
1408                                if(simple == 1)
1409                                {
1410                                    addCompSec();
1411                                    $("#comp_name"+cc).val($("#comp_name").val());
1412                                    $("#comp_symbol"+cc).val($("#comp_symbol").val());
1413                                    $("#comp_color"+cc).val($("#comp_color").val());  
1414                            		$('#mask2').hide();
1415                            		$('.window2').hide();
1416                                    $(':text, :password, :file', '#addCompForm').val('');  
1417
1418                                    $(':input', '#addCompForm').removeAttr('checked').removeAttr('selected');
1419
1420                                    $("#addCompForm * ").attr("disabled","");
1421                                }
1422                                else
1423                                $("#form_div").html('Komponent został pomyślnie zapisany! Kliknij <a href="/komponenty.html"><strong>tutaj</strong></a>, aby powrócić do wykazu komponentów.');
1424                                
1425                                $("#form_div").fadeIn("slow");
1426    					},
1427    					error: function(){
1428    							$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1429    							$("#contact-response").fadeIn("slow");
1430    							$("#contact-form * ").attr("disabled","");
1431    							$("#sub").val("Zapisz");
1432    					}
1433    				});
1434    		}
1435    	});
1436    	$("#reset").click(function() {
1437    			validator.resetForm();
1438    			$("#contact-response").hide("slow");
1439    			$("#contact-response").empty();
1440    	});
1441    });
1442
1443	   
1444   	$("#comp_color").autocomplete("lite.php5", {
1445    	width: 300,
1446    	selectFirst: false,
1447        extraParams: {
1448            module: "Katalog",
1449            action: "comp_color_search"
1450    	}
1451	});
1452       
1453	function formatItem(row) {
1454		return row[0] + " (<i>" + row[1] + "</i>)";
1455	}
1456	function formatResult(row) {
1457		return row[0].replace(/(<.+?>)/gi, '');
1458	}
1459}
1460
1461
1462
1463function formCurrs()
1464{
1465    $(document).ready(function(){
1466    	validator = $("#currsForm").validate({
1467    		rules: {
1468    			curr2: {
1469    				required: true,
1470    				minlength: 1
1471    			},
1472    			curr3: {
1473    				required: true,
1474    				minlength: 1
1475    			},
1476    			curr4: {
1477    				required: true,
1478    				minlength: 1
1479    			}
1480    		},
1481    		submitHandler: function(form) {
1482    			$.ajax({
1483    			      type: "post",
1484    					data: $("#currsForm * ").serialize(),
1485    					url: "/lite.php5?module=Katalog&action=set_currs", 
1486                        cache: false,
1487    					async: true,
1488    					timeout: 100000,
1489    					beforeSend: function(html){
1490    						$("#currsForm * ").attr("disabled","disabled");
1491    					},
1492    					success: function(code){
1493                            alert("Kursy walut zostały uaktualnione!");
1494                            $("#currsForm * ").attr("disabled","");
1495    					},
1496    					error: function(){
1497//
1498    					}
1499    				});
1500    		}
1501    	});
1502    });
1503
1504}
1505
1506
1507
1508function formFileEdit(id)
1509{
1510    $(document).ready(function(){
1511    	validator = $("#editFileForm"+id).validate({
1512    		rules: {
1513    			file_name: {
1514    				required: false,
1515    				minlength: 3
1516    			}
1517    		},
1518    		messages: {
1519    			file_name: {
1520    				required: "<br />Pole nie może być puste<br /><br />",
1521    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
1522    			}
1523    		},
1524    		submitHandler: function(form) {
1525    			$.ajax({
1526    			      type: "post",
1527    					data: $("#editFileForm"+ id +" * ").serialize(),
1528    					url: "/lite.php5?module=Katalog&action=edit_file_done", 
1529                        cache: false,
1530    					async: true,
1531    					timeout: 100000,
1532    					beforeSend: function(html){
1533    						$("#editFileForm"+ id +" * ").attr("disabled","di
1533sabled");
1534    					},
1535    					success: function(code){
1536                                $("#form_div"+id).fadeOut("slow");
1537                                $("#form_div"+id).html('Dane pliku zostały pomyślnie zapisane!');
1538                                $("#form_div"+id).fadeIn("slow");
1539    					},
1540    					error: function(){
1541    							$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1542    							$("#contact-response").fadeIn("slow");
1543    							$("#contact-form * ").attr("disabled","");
1544    							$("#sub").val("Zapisz");
1545    					}
1546    				});
1547    		}
1548    	});
1549    });
1550}
1551
1552
1553function formListAdd()
1554{
1555    $(document).ready(function(){
1556    	validator = $("#addListForm").validate({
1557    		rules: {
1558    			item_symbol: {
1559    				required: false,
1560    				minlength: 1
1561    			}
1562    		},
1563    		messages: {
1564    			item_symbol: {
1565    				required: "<br />Pole nie może być puste<br /><br />",
1566    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
1567    			}
1568    		},
1569    		submitHandler: function(form) {
1570    			$.ajax({
1571    			      type: "post",
1572    					data: $("#addListForm * ").serialize(),
1573    					url: "/lite.php5?module=Katalog&action=list_add_done", 
1574                        cache: false,
1575    					async: true,
1576    					timeout: 100000,
1577    					beforeSend: function(html){
1578    						$("#addListForm * ").attr("disabled","disabled");
1579    						//$("#contact-response").html("Proszę czekać...");
1580                            //$("#contact-response").fadeIn("slow");
1581    					},
1582    					success: function(code){
1583                                $("#form_div").fadeOut("slow");
1584                                //$("#form_div").html(code);
1585                                $("#form_div").html('Lista została pomyślnie zapisana! Kliknij <a href="/listy.html"><strong>tutaj</strong></a>, aby powrócić do wykazu list wysyłkowych.');
1586                                $("#form_div").fadeIn("slow");
1587    					},
1588    					error: function(){
1589    							$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1590    							$("#contact-response").fadeIn("slow");
1591    							$("#contact-form * ").attr("disabled","");
1592    							$("#sub").val("Zapisz");
1593    					}
1594    				});
1595    		}
1596    	});
1597    	$("#reset").click(function() {
1598    			validator.resetForm();
1599    			$("#contact-response").hide("slow");
1600    			$("#contact-response").empty();
1601    	});
1602    });
1603}
1604
1605function formUserAdd(id)
1606{
1607    $(document).ready(function(){
1608    	validator = $("#addUserForm").validate({
1609    	   onkeyup: false,
1610    		rules: {
1611    			user_name: {
1612    				required: true,
1613                    minlength: 5,
1614    				remote: "/lite.php5?&module=Katalog&action=check_user_name&user_id="+id
1615    			},
1616    			user_email: {
1617    				required: true,
1618    				email:true,
1619                    remote: "/lite.php5?&module=Katalog&action=check_user_email&user_id="+id
1620    			},
1621    			user_pass1: {
1622    				minlength: 5
1623    			},
1624                user_pass2: {
1625                    equalTo: "#user_pass1",
1626                    minlength: 5
1627                }
1628    		},
1629    		messages: {
1630    			user_name: {
1631                    remote: jQuery.format("<br \/>{0} istnieje już w bazie danych Systemu<br \/><br \/>")
1632    			},
1633    			user_email: {
1634                    remote: jQuery.format("<br \/>{0} istnieje już w bazie danych Systemu<br \/><br \/>")
1635    			},
1636    			user_pass2: {
1637    				required: "<br />Pole nie może być puste<br /><br />",
1638    				minlength: "<br />Hasło musi składać się z co najmniej pięciu znaków<br /><br />"
1639    			},
1640    			user_pass1: {
1641    				required: "<br />Pole nie może być puste<br /><br />",
1642    				minlength: "<br />Hasło musi składać się z co najmniej pięciu znaków<br /><br />"
1643    			}
1644    		},
1645    		submitHandler: function(form) {
1646    			$.ajax({
1647    			      type: "post",
1648    					data: $("#addUserForm * ").serialize(),
1649    					url: "/lite.php5?module=Katalog&action=user_add_done", 
1650                        cache: false,
1651    					async: true,
1652    					timeout: 100000,
1653    					beforeSend: function(html){
1654    						$("#addUserForm * ").attr("disabled","disabled");
1655    						//$("#contact-response").html("Proszę czekać...");
1656                            //$("#contact-response").fadeIn("slow");
1657    					},
1658    					success: function(code){
1659                                $("#form_div").fadeOut("slow");
1660                                $("#form_div").html(code);
1661                                $("#form_div").html('Użytkownik został pomyślnie zapisany! Kliknij <a href="/uzytkownicy.html"><strong>tutaj</strong></a>, aby powrócić do listy użytkowników.');
1662                                $("#form_div").fadeIn("slow");
1663    					},
1664    					error: function(){
1665    							$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1666    							$("#contact-response").fadeIn("slow");
1667    							$("#contact-form * ").attr("disabled","");
1668    							$("#sub").val("Zapisz");
1669    					}
1670    				});
1671    		}
1672    	});
1673    	$("#reset").click(function() {
1674    			validator.resetForm();
1675    			$("#contact-response").hide("slow");
1676    			$("#contact-response").empty();
1677    	});
1678    });
1679}
1680
1681function commentAdd(id)
1682{
1683    if(typeof id == 'undefined') {
1684        id = 0;
1685    }
1686
1687    $(document).ready(function(){
1688    	validator = $("#addCommentForm").validate({
1689    	   onkeyup: false,
1690    		rules: {
1691    			comment_name: {
1692    				required: true,
1693                    minlength: 3,
1694                    maxlength: 30
1695    			},
1696    			comment_email: {
1697    				required: true,
1698                    email: true
1699    			},
1700    			comment_text: {
1701    				required: true,
1702                    minlength: 10,
1703                    maxlength: 10000
1704    			}
1705    		},
1706    		messages: {
1707    			comment_name: {
1708    				required: "<br />Musisz podać nazwę użytkownika",
1709    				minlength: "<br />Nazwa użytkownika musi składać się z co najmniej trzech znaków",
1710                    minlength: "<br />Nazwa użytkownika musi składać się z nie więcej niż 30 znaków"
1711    			},
1712    			comment_email: {
1713    				email: "<br />Nieprawidłowy format adresu e-mail",
1714                    required: "<br />Musisz podać adres e-mail"
1715    			},
1716    			comment_text: {
1717    				required: "<br />Pole nie może być puste",
1718    				minlength: "<br />Treść komentarza musi być dłuższa niż 10 znaków",
1719                    maxlength: "<br />Treść komentarza nie może być dłuższa niż 1000 znaków"
1720    			}
1721    		},
1722    		submitHandler: function(form) {
1723    			$.ajax({
1724    			      type: "post",
1725    					data: $("#addCommentForm * ").serialize(),
1726    					url: "/lite.php5?module=Katalog&action=comment_add&lite=lite", 
1727                        cache: false,
1728    					async: true,
1729    					timeout: 100000,
1730    					beforeSend: function(html){
1731    						$("#addCommentForm * ").attr("disabled","disabled");
1732    					},
1733    					success: function(code){
1734    					        $("#comtekst1").slideUp();
1735                                $("#comtekst2").slideUp();
1736                                $("#commdiv").slideUp();
1737                                $("#komentarze").prepend(code);
1738                                document.location="#listakomentarzy";
1739    					},
1740    					error: function(){
1741    							alert("Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.");
1742    					}
1743    				});
1744    		}
1745    	});
1746    	$("#reset").click(function() {
1747    			validator.resetForm();
1748    			//$("#contact-response").hide("slow");
1749    			//$("#contact-response").empty();
1750    	});
1751    });
1752}
1753
1754function formCommentAdd(id, n)
1755{
1756    $(document).ready(function(){
1757    	validator = $("#addCommentForm"+id).validate({
1758    	   onkeyup: false,
1759    		rules: {
1760    			comment_text: {
1761    				required: true,
1762                    minlength: 5,
1763    			}
1764    		},
1765    		submitHandler: function(form) {
1766    			$.ajax({
1767    			      type: "post",
1768    					data: $("#addCommentForm"+ id +" * ").serialize(),
1769    					url: "/lite.php5?module=Katalog&action=comment_add_done&news_id="+ id +"&n="+n, 
1770                        cache: false,
1771    					async: true,
1772    					timeout: 100000,
1773    					beforeSend: function(html){
1774    					//	$("#addCommentForm"+ id +" * ").attr("disabled","disabled");
1775    					},
1776    					success: function(code){
1777                                $("#coms"+id).fadeOut("slow");
1778                                if(n == 0) $("#coms"+id).html(code);
1779                                else $("#coms"+id).prepend(code);
1780                                $("#coms"+id).fadeIn("slow");
1781                                $(".comtext").val('Powiadomienie zostało pomyślnie dodane.');
1782    					},
1783    					error: function(){
1784                                alert("Błąd");
1785    					}
1786    				});
1787    		}
1788    	});
1789    	$("#reset").click(function() {
1790    			validator.resetForm();
1791    			$("#contact-response").hide("slow");
1792    			$("#contact-response").empty();
1793    	});
1794    });
1795}
1796
1797function formCommentAddOrder(id, n)
1798{
1799    $(document).ready(function(){
1800    	validator = $("#addCommentForm"+id).validate({
1801    	   onkeyup: false,
1802    		rules: {
1803    			comment_text: {
1804    				required: true,
1805                    minlength: 5,
1806    			}
1807    		},
1808    		submitHandler: function(form) {
1809    			$.ajax({
1810    			      type: "post",
1811    					data: $("#addCommentForm"+ id +" * ").serialize(),
1812    					url: "/lite.php5?module=Katalog&action=comment_add_done_order&order_id="+ id +"&n="+n, 
1813                        cache: false,
1814    					async: true,
1815    					timeout: 100000,
1816    					beforeSend: function(html){
1817    					//	$("#addCommentForm"+ id +" * ").attr("disabled","disabled");
1818    					},
1819    					success: function(code){
1820                                $("#coms"+id).fadeOut("slow");
1821                                if(n == 0) $("#coms"+id).html(code);
1822                                else $("#coms"+id).prepend(code);
1823                                $("#coms"+id).fadeIn("slow");
1824                                $(".comtext").val('Informacja o zmianie etapu produkcyjnego elementu została pomyślnie dodana.');
1825    					},
1826    					error: function(){
1827                                alert("Błąd");
1828    					}
1829    				});
1830    		}
1831    	});
1832    	$("#reset").click(function() {
1833    			validator.resetForm();
1834    			$("#contact-response").hide("slow");
1835    			$("#contact-response").empty();
1836    	});
1837    });
1838}
1839
1840function formNewsAdd()
1841{
1842    $(document).ready(function(){
1843    	validator = $("#addNewsForm").validate({
1844    	   onkeyup: false,
1845    		rules: {
1846    			news_title: {
1847    				required: true,
1848                    minlength: 5
1849    			},
1850    			news_text: {
1851    				required: true,
1852                    minlength: 5
1853    			}
1854    		},
1855    		submitHandler: function(form) {
1856    			$.ajax({
1857    			      type: "post",
1858    					data: $("#addNewsForm * ").serialize(),
1859    					url: "/lite.php5?module=Katalog&action=news_add_done", 
1860                        cache: false,
1861    					async: true,
1862    					timeout: 100000,
1863    					beforeSend: function(html){
1864    						$("#addNewsForm * ").attr("disabled","disabled");
1865    					},
1866    					success: function(code){
1867                                $("#form_div").fadeOut("slow");
1868                                $("#form_div").html(code);
1869                                $("#form_div").html('Powiadomienie zostało pomyślnie zapisane! Kliknij <a href="/tablica.html"><strong>tutaj</strong></a>, aby powrócić do listy powiadomień.');
1870                                $("#form_div").fadeIn("slow");
1871    					},
1872    					error: function(){
1873    							$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1874    							$("#contact-response").fadeIn("slow");
1875    							$("#contact-form * ").attr("disabled","");
1876    							$("#sub").val("Zapisz");
1877    					}
1878    				});
1879    		}
1880    	});
1881    	$("#reset").click(function() {
1882    			validator.resetForm();
1883    			$("#contact-response").hide("slow");
1884    			$("#contact-response").empty();
1885    	});
1886    });
1887}
1888
1889function formSubcontractorAdd(id)
1890{
1891    if(typeof id == 'undefined') {
1892        id = 0;
1893    }
1894
1895    $(document).ready(function(){
1896    	validator = $("#addSubcontractorForm").validate({
1897    	   onkeyup: false,
1898    		rules: {
1899    			subcontractor_name: {
1900    				required: true,
1901                    minlength: 2,
1902    				remote: "/lite.php5?&module=Katalog&action=check_subcontractor_name&subcontractor_id="+id
1903    			},
1904    			subcontractor_email: {
1905    				required: true,
1906    				email:true,
1907                    remote: "/lite.php5?&module=Katalog&action=check_subcontractor_email&subcontractor_id="+id
1908    			},
1909    			subcontractor_address: {
1910    				required: true,
1911                    minlength: 5
1912    			}
1913    		},
1914    		messages: {
1915    			subcontractor_name: {
1916                    remote: jQuery.format("<br \/>{0} istnieje już w bazie danych Systemu<br \/><br \/>")
1917    			},
1918    			subcontractor_email: {
1919                    remote: jQuery.format("<br \/>{0} istnieje już w bazie danych Systemu<br \/><br \/>")
1920    			}
1921    		},
1922    		submitHandler: function(form) {
1923    			$.ajax({
1924    			      type: "post",
1925    					data: $("#addSubcontractorForm * ").serialize(),
1926    					url: "/lite.php5?module=Katalog&action=subcontractor_add_done", 
1927                        cache: false,
1928    					async: true,
1929    					timeout: 100000,
1930    					beforeSend: function(html){
1931    						$("#addSubcontractorForm * ").attr("disabled","disabled");
1932    					},
1933    					success: function(code){
1934                                $("#form_div").fadeOut("slow");
1935                                $("#form_div").html(code);
1936                                $("#form_div").html('Podwykonawca został pomyślnie zapisany! Kliknij <a href="/podwykonawcy.html"><strong>tutaj</strong></a>, aby powrócić do listy podwykonawców.');
1937                                $("#form_div").fadeIn("slow");
1938    					},
1939    					error: function(){
1940    							$("#contact-response").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
1941    							$("#contact-response").fadeIn("slow");
1942    							$("#contact-form * ").attr("disabled","");
1943    							$("#sub").val("Zapisz");
1944    					}
1945    				});
1946    		}
1947    	});
1948    	$("#reset").click(function() {
1949    			validator.resetForm();
1950    			$("#contact-response").hide("slow");
1951    			$("#contact-response").empty();
1952    	});
1953    });
1954}
1955
1956function fileAutocomplete()
1957{
1958    function formatItem(row) {
1959		return row[0] + " (<i>." + row[1] + "</i>)";
1960	}
1961	function formatResult(row) {
1962		return row[0].replace(/(<.+?>)/gi, '');
1963	}
1964   	$(".file_auto, .file_auto valid").autocomplete("lite.php5", {
1965    	width: 300,
1966    	selectFirst: false,
1967        extraParams: {
1968            module: "Katalog",
1969            action: "files_search"
1970    	},
1971        mustMatch: true,
1972		formatItem: formatItem,
1973		formatResult: formatResult
1974	});
1975}
1976
1977    function addCompSec()
1978    {
1979
1980        cc = cc + 1;
1981
1982        $('#komponenty').append('<p class="komp_form" id="komp_form'+ cc +'" style="line-height: 1.6; border-bottom: 1px solid #6F6F6F; padding-bottom: 5px">' +
1983        '<small>Nazwa\/symbol: <br \/><input onclick="javascript:compAutocomplete(\''+ cc +'\');" class="comp_auto" autocomplete="off" id="comp_name'+ cc +'" name="comp_name['+ cc +']" size="45" type="text" \/>' +
1984        '<br \/>' +
1985        'Symbol:<br \/><input id="comp_symbol'+ cc +'" name="comp_symbol['+ cc +']" size="45" type="text" readonly="readonly"\/>' +
1986        '<br \/>' +
1987        'Kolor:<br \/><input id="comp_color'+ cc +'" name="comp_color['+ cc +']" size="45" type="text" readonly="readonly"\/>' +
1988        '<br \/>' +
1989        'Ilość:<br \/><input id="comp_amount'+ cc +'" name="comp_amount['+ cc +']" size="45" type="text" \/>' +
1990        '<\/small>' +
1991        '<br \/>' +
1992        '<span><a style="font-size:10px; text-decoration: none; color: #000000" href="#" class="plusik" onclick="addCompSec();">[+]<\/a> <a href="#" onclick="javascript:compRemove(\''+ cc +'\');" style="font-size:10px; text-decoration: none; color: #000000">[-]<\/a><\/span><\/p>' +
1993        '<\/div>');
1994    }
1995
1996
1997function compAutocomplete(co)
1998{
1999    if($("#comp_name"+co).val() == "")
2000    {
2001        $("#comp_color"+co).val("");
2002        $("#comp_symbol"+co).val("");    
2003    }
2004    
2005   	$("#comp_name"+co).autocomplete("/lite.php5", {
2006    	width: 300,
2007    	selectFirst: false,
2008        extraParams: {
2009            module: "Katalog",
2010            action: "comp_search"
2011    	},
2012        mustMatch: true,
2013		formatItem: function(row)
2014        {
2015            return row[0] + " (" + row[1] + ")";
2016    	},
2017		formatResult: function(row)
2018        {
2019            $("#comp_color"+co).val(row[2]);
2020            $("#comp_symbol"+co).val(row[1]);
2021            return row[0].replace(/(<.+?>)/gi, '');
2022    	}
2023	});
2024}
2025
2026function removeComp(co)
2027{
2028    $("#komp_form"+co).remove();
2029}
2030
2031function formOrderItemsAdd(id)
2032{
2033    $(document).ready(function(){
2034    	validator = $("#addOrderItemsForm").validate({
2035    		rules: {
2036    			item_symbol: {
2037    				required: true,
2038    				minlength: 1
2039    			},
2040                item_name_dabew: {
2041    				required: true,
2042    				minlength: 1
2043    			},
2044                item_name_client: {
2045    				required: true,
2046    				minlength: 1
2047    			},
2048                item_color: {
2049    				required: true,
2050    				minlength: 1
2051    			},
2052                item_amount: {
2053    				required: true,
2054    				minlength: 1
2055    			},
2056                item_prize: {
2057    				required: true,
2058    				minlength: 1
2059    			},
2060                item_weight: {
2061    				required: true,
2062    				minlength: 1
2063    			},
2064                item_dest: {
2065    				required: true,
2066    				minlength: 1
2067    			},
2068                item_date_ship: {
2069    				required: true,
2070    				minlength: 1
2071    			}
2072    		},
2073    		submitHandler: function(form) {
2074    			$.ajax({
2075    			      type: "post",
2076    					data: $("#addOrderItemsForm * ").serialize(),
2077    					url: "/lite.php5?module=Katalog&action=item_order_add_done&order_id="+id, 
2078                        cache: false,
2079    					async: true,
2080    					timeout: 100000,
2081    					beforeSend: function(html){
2082    						$("#addOrderItemsForm * ").attr("disabled","disabled");
2083    						//$("#contact-response").html("Proszę czekać...");
2084                            //$("#contact-response").fadeIn("slow");
2085    					},
2086    					success: function(code){
2087                                $("#oiadd").fadeOut("slow");
2088                                $("#oiadd").html(code);
2089                                $("#oiadd").html("<br /><b>Zmiany do zamówienia zostały pomyślnie wprowadzone.</b>");
2090                                $("#oiadd").fadeIn("slow");
2091                                $("#orderItemsForm * ").attr("disabled","");
2092                                getOrderItemsManage(id);
2093                                $(".oitrdetcl").slideUp();
2094    					},
2095    					error: function(){
2096    							$("#oiadd").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
2097    							$("#oiadd").fadeIn("slow");
2098    							$("#addOrderItemsForm * ").attr("disabled","");
2099    					}
2100    				});
2101    		}
2102    	});
2103
2104    });
2105   	$("#item_dest").autocomplete("lite.php5", {
2106    	width: 300,
2107    	selectFirst: false,
2108        extraParams: {
2109            module: "Katalog",
2110            action: "item_dest_search"
2111    	}
2112	});
2113   	$("#item_color").autocomplete("lite.php5", {
2114    	width: 300,
2115    	selectFirst: false,
2116        extraParams: {
2117            module: "Katalog",
2118            action: "itemv_color_search"
2119    	}
2120	});
2121    
2122	function formatItem(row) {
2123		return row[0] + " (<strong>id: " + row[1] + "</strong>)";
2124	}
2125	function formatResult(row) {
2126		return row[0].replace(/(<.+?>)/gi, '');
2127	}
2128    
2129	$("#files").autocomplete('lite.php5', {
2130		width: 300,
2131        extraParams: {
2132            module: "Katalog",
2133            action: "files_search"
2134    	},
2135		multiple: true,
2136		matchContains: true,
2137		formatItem: formatItem,
2138		formatResult: formatResult
2139	});
2140	$("#files").result(function(event, data, formatted) {
2141		var hidden = $(this).parent().next().find(">:input");
2142		hidden.val( (hidden.val() ? hidden.val() + ";" : hidden.val()) + data[1]);
2143	});
2144}
2145
2146function itemToOrderAddCancel()
2147{
2148    $("#orderItemsForm * ").attr("disabled","");
2149    $("#oiadd").hide();
2150}
2151
2152function formOrderItems(id)
2153{
2154    $(document).ready(function(){
2155    	validator = $("#orderItemsForm").validate({
2156    		rules: {
2157    			item_symbol: {
2158    				required: true
2159    				//minlength: 2
2160    			}
2161    		},
2162    		messages: {
2163    			item_symbol: {
2164    				required: "<br />Pole nie może być puste<br /><br />",
2165    				minlength: "<br />Wprowadzona wartość musi zawierać min. 3 znaki<br /><br />"
2166    			}
2167    		},
2168    		submitHandler: function(form) {
2169    			$.ajax({
2170    			      type: "post",
2171    					data: $("#orderItemsForm * ").serialize(),
2172    					url: "/lite.php5?module=Katalog&action=add_order_item_form&order_id="+id, 
2173                        cache: false,
2174    					async: true,
2175    					timeout: 100000,
2176    					beforeSend: function(html){
2177    						$("#orderItemsForm * ").attr("disabled","disabled");
2178
2179    					},
2180    					success: function(code){
2181                                $("#oiadd").hide();
2182                                $("#oiadd").html(code);
2183                                $("#oiadd").slideDown();
2184                                formOrderItemsAdd(id);
2185                                $(".oitrdetcl").slideUp();
2186                                
2187    					},
2188    					error: function(){
2189    							$("#oiadd").html('<div class="error3">Przepraszamy, ale wystąpił problem z połączeniem. Odczekaj chwilę, do kolejnej próby.</div>');
2190    							$("#oiadd").fadeIn("slow");
2191    							$("#orderItemsForm * ").attr("disabled","");
2192    					}
2193    				});
2194    		}
2195    	});
2196    	$("#reset").click(function() {
2197    			validator.resetForm();
2198    			$("#contact-response").hide("slow");
2199    			$("#contact-response").empty();
2200    	});
2201    });
2202
2203	function formatItem(row) {
2204		return row[0] + " (<i>" + row[1] + "</i>)";
2205	}
2206	function formatResult(row) {
2207		return row[0].replace(/(<.+?>)/gi, '');
2208	}
2209   	$("#item_symbol").autocomplete("lite.php5", {
2210    	width: 300,
2211    	selectFirst: false,
2212        extraParams: {
2213            module: "Katalog",
2214            action: "item_symbol_search"
2215    	},
2216        
2217		formatItem: formatItem,
2218		formatResult: formatResult,
2219        mustMatch: true
2220	});
2221}
2222
2223
2224function loginForm()
2225{
2226    $(document).ready(function(){
2227    	validator = $("#loginForm").validate({
2228    		rules: {
2229    			login_email: {
2230    				required: true,
2231                    email: true
2232    			},
2233                login_pass: {
2234    				required: true,
2235    			}
2236    		},
2237    		submitHandler: function(form) {
2238    			$.ajax({
2239    			      type: "post",
2240    					data: $("#loginForm * ").serialize(),
2241    					url: "/lite.php5?module=Katalog&action=login", 
2242                        cache: false,
2243    					async: true,
2244    					timeout: 100000,
2245    					beforeSend: function(html){
2246    						$("#logintr").slideUp();
2247                            //wait(1000);
2248    					},
2249    					success: function(code){
2250    					        if(code == 1)
2251                                {
2252                                    $("#logintd").html("Błędny adres e-mail lub hasło");
2253                                }
2254    					        if(code == 2)
2255                                {
2256                                    $("#logintd").html("Zostałeś pomyślnie zalogowany");
2257                                }
2258                                $("#logintr").slideDown();
2259    					        if(code == 2)
2260                                {
2261                                    setTimeout("document.location='/tablica.html';",3000);
2262                                    $("#logintd").html("Zostałeś pomyślnie zalogowany, proszę czekać...");
2263                                }
2264    					},
2265    					error: function(){
2266                                alert("Przepraszamy, ale wystąpił błąd połączenia");
2267    					}
2268    				});
2269    		}
2270    	});
2271
2272    });
2273}
2274
2275function photoDelete(id) {
2276    if(confirm("Czy na pewno chcesz usunąć to zdjęcie?"))
2277    {
2278	$.ajax({
2279		type: "post",
2280		url: "/lite.php5?module=Admin&action=photoDeleteFinish&lite=lite&photo_id="+id,
2281		cache: false,
2282		async: true,
2283		timeout: 100000,
2284		beforeSend: function(){
2285///            $("#oitr"+id).empty();
2286		},
2287		success: function(code){
2288		  if(code == "ok") $("#photorow_"+id).slideUp();
2289          alert("Zdjęcie zostało pomyślnie usunięte.");
2290		},
2291		error: function(){
2292			alert('<h1>Wystąpił problem z pobieraniem strony...</h1>');
2293		}
2294	});
2295    }
2296}
2297
2298function deleteComment(id) {
2299    if(confirm("Czy na pewno chcesz usunąć ten komentarz?"))
2300    {
2301	$.ajax({
2302		type: "post",
2303		url: "/lite.php5?module=Katalog&action=deleteComment&lite=lite&comment_id="+id,
2304		cache: false,
2305		async: true,
2306		timeout: 100000,
2307		beforeSend: function(){
2308///            $("#oitr"+id).empty();
2309		},
2310		success: function(code){
2311		  $("#komentarz"+id).slideUp();
2312          alert("Komentarz został pomyślnie usunięty.");
2313		},
2314		error: function(){
2315			alert('<h1>Wystąpił problem z pobieraniem strony...</h1>');
2316		}
2317	});
2318    }
2319}
2320
2321function photoEdit(id)
2322{
2323    			$.ajax({
2324    			      type: "post",
2325    					data: $("#photoform * ").serialize(),
2326    					url: "/lite.php5?module=Admin&lite=lite&action=photoEditFinish&photo_id="+id, 
2327                        cache: false,
2328    					async: true,
2329    					timeout: 100000,
2330    					beforeSend: function(html){
2331    						//$("#logintr").slideUp();
2332                            //wait(1000);
2333    					},
2334    					success: function(code){
2335    					        if(code == "ok")
2336                                {
2337                                    alert("Zdjęcie zostało pomyślnie edytowane!");
2338                                }
2339    					        if(code == 2)
2340                                {
2341                                    alert("Wystąpił błąd podczas edycji zdjęcia.");
2342                                }
2343    					},
2344    					error: function(){
2345                                alert("Przepraszamy, ale wystąpił błąd połączenia.");
2346    					}
2347    				});
2348
2349}

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.