PageSourceSearch

https://www.tnt.it/tracking/_assets/javascript/index.js?v=21719

js tnt.it collected 2026-10-03 19:08:35 UTC 72,895 bytes, 2,181 lines download raw bytes

1var spinner;
2var errorDialog;
3var errorDialogPdm;
4var fedexDialog;
5var clickTrace = 0;
6
7function populateLDVArray(array){
8	var type = $('input[name=wt]:checked').val();
9	var t = (type == 1)?('lettera'):('mittente');
10	
11	$.each(array, function(i, el){
12		dataLayer.push({"event":"tracking", "info":t, 'additionalInfo':el});
13	});
14}
15
16
17$(document).ready(function(){
18    $('#numberText').keypress(function(e){
19      if(e.keyCode==13) $('#submitButton').click();
20    });
21    
22    $('input#codCli').numeric({
23		negative:false
24	});
25    
26});
27
28function textModeSwitchOnClick() {
29	if ($('#numberTextDiv').is(':visible')) {
30		$('#numberTextDiv').hide();
31		$('#numberTextAreaDiv').show();
32		$('#textModeSwitch').html('Effettua il tracking di una singola spedizione');
33	} else {
34		$('#numberTextAreaDiv').hide();
35		$('#numberTextDiv').show();
36		$('#textModeSwitch').html('Effettua il tracking di più spedizioni');
37	}
38	toggleAccountNo();
39	setInputFieldsRequired();
40	fixIE8();
41	return false;
42}
43
44function submitButtonOnClick() {
45	if (!checkTrackingFormFields()) {
46		$('form[name=trackingForm] input[name=pageNo]').val('');
47		clickTrace = 0;
48		return submitData();
49	}
50	return false;
51}
52
53function cancelButtonOnClick() {
54
55	$('form[name=trackingForm] input[name=startDate]').val('');
56	$('form[name=trackingForm] input[name=endDate]').val('');
57	$('form[name=trackingForm] input[name=receiverName]').val('');
58	$('form[name=trackingForm] input[name=receiverTown]').val('');	
59	$('form[name=trackingForm] input[name=receiverZIP]').val('');
60	return true;
61}
62
63function estraiOra(dateTime) {
64	if (!(dateTime && dateTime.indexOf(",") >= 0)) return '';
65	var arr = dateTime.split(',');
66	var ora = $.trim(arr[1]);
67	return ora;
68}
69
70function checkTrackingFormFields() {
71	$('form[name=trackingForm] input.is-error, form[name=trackingForm] textarea.is-error').removeClass("is-error");
72	var fieldsToCheck = $('form[name=trackingForm]').find('.required');
73	var emptyFields = false;
74	var errors = false;
75	
76	for (var i=0; i<fieldsToCheck.length; i++){
77		if($.trim($(fieldsToCheck[i]).val())=='' || $(fieldsToCheck[i]).hasClass('placeholder')){
78			$(fieldsToCheck[i]).addClass('is-error');
79			emptyFields = true;
80			errors = true;
81		}
82	}
83	
84	if($('input[name=receiverName]').val() && $('input[name=receiverName]').val().length < 2){
85		$('input[name=receiverName]').addClass('is-error');
86		$('div#errorDialog').dialog( "option", "title", "Errore");
87		$('div#errorDialog').html('Il nome del destinatario deve essere di almeno due caratteri');
88		$('div#errorDialog').dialog('open');
89		errors = true;
90	}
91		
92	
93	if(typeof $('input[name=receiverName]').val() != 'undefined')
94	{
95		if($.trim($('input[name=receiverTown]').val()) == '' && $.trim($('input[name=receiverZIP]').val()) == '')
96		{
97			$('input[name=receiverTown]').addClass('is-error');
98			$('input[name=receiverZIP]').addClass('is-error');
99			emptyFields = true;
100			errors = true;			
101		}
102	}
103	
104	if (emptyFields){
105		$('div#errorDialog').dialog( "option", "title", "Errore");
106		$('div#errorDialog').html('Inserire i dati mancanti!');
107		$('div#errorDialog').dialog('open');
108	}
109	
110	return errors;
111}
112
113function submitData() {
114	$('#resultPanel').slideUp(400, fixIE8);
115	$('#noResultPanel').slideUp(400, fixIE8);
116	
117	spinner.dialog('open');
118
119	if ($('#numberTextDiv').is(':visible')) {
120		consigNos = $('#numberText').val();
121	} else {
122		consigNos = $('#numberTextArea').val();
123	}																																																																																																																																																				
124	
125	if(!consigNos||consigNos==""||consigNos=="undefined") {
126		consigNos = $('#numberText').val();
127	}
128	$('input[name=consigNos]').val(consigNos);
129	
130	$('[placeholder]').each(function() {
131		var input = $(this);
132		if (input.val() == input.attr('placeholder')) {
133			input.val('');
134		}
135	});
136
137	$.ajax({
138		url: $('form#trackingForm').attr('action'),
139		type: $('form#trackingForm').attr('method'),
140		data: $('form#trackingForm').serialize(),
141		dataType: 'text',
142		complete: function(jqXHR, textStatus){
143			spinner.dialog('close');
144		},
145		success: function(xml){
146			$('div#stillNotFound').css('display','none');
147			var xmlDoc = $.parseXML(xml);
148			buildResults($(xmlDoc));
149			
150		},
151		error: function(jqXHR, textStatus, errorThrown) {
152			$('div#errorDialog').dialog( "option", "title", "Errore");
153			$('div#errorDialog').html('Si &egrave; verificato un errore.').dialog('open');
154
155		}
156	});
157	$('[placeholder]').blur();
158	
159	return false;
160}
161
162function toggleAccountNo() {
163	if($('input#refnr').is(':checked')) {
164		$('#accountNo').show();
165		$('#numberText').attr('placeholder', 'Riferimento/i mittente separati da virgola');
166		$('#numberTextArea').attr('placeholder', 'Riferimento mittente');
167	} else {
168		$('#accountNo').hide();
169		$('#numberText').attr('placeholder', 'Lettera/e di vetture separate da virgola');
170		$('#numberTextArea').attr('placeholder', 'Lettera di vettura');
171	}
172	setInputFieldsRequired();
173	fixPlaceholder();
174    fixIE8();
175}
176
177function setInputFieldsRequired() {
178	if($('input[name=wt][value=2]').is(':checked')) {
179		$('#codCli').addClass('required');
180	} else {
181		$('#codCli').removeClass('required');
182	}
183	if ($('#numberTextDiv').is(':visible')) {
184		$('#numberText').addClass('required');
185		$('#numberTextArea').removeClass('required');
186	} else {
187		$('#numberText').removeClass('required');
188		$('#numberTextArea').addClass('required');
189	}
190}
191
192function btnTrackOnClick() {
193	  var isValid = true;
194	  $('.error').each(function(){$(this).removeClass('is-error')});
195	  
196	  if($.trim($('#companyName').val()) =='')
197	  {
198	  	isValid = false;
199		$('#companyName').addClass('is-error');
200	  }
201	  if($.trim($('#contactName').val()) =='')
202	  {
203	  	isValid = false;
204		$('#contactName').addClass('is-error');
205	  }
206	  if($.trim($('#contactphone').val()) =='')
207	  {
208	  	isValid = false;
209		$('#contactphone').addClass('is-error');
210	  }
211	  if($.trim($('#contactfax').val()) =='' && $.trim($('#emailAddress').val()) =='')
212	  {
213	  	isValid = false;
214		$('#contactfax').addClass('is-error');
215		$('#emailAddress').addClass('is-error');
216	  }
217
218		
219		if(!isValid)
220		{
221			message = "I campi evidenziati sono obbligatori";
222			$('div#errorDialog').dialog( "option", "title", "Errore");
223    		$('div#errorDialog').html(message);
224    		$('div#errorDialog').dialog('open');
225			return false;
226		}
227
228		return submitPODData();
229
230  }
231
232function btnPODRequestOnClick(conNo, consignmentType) {
233	var url = "https://www.tnt.it/SendMail/SendMessage.do?template=ricevuta_firmata&_1000lettera_di_vettura=" +
234		conNo +
235		"&_0900tipo_spedizione=" + consignmentType;
236	
237	location.href = url; 
238	
239	return false;
240}
241
242function openChat(chatUrl,Digest,ConNo, extraCommand, chatMessage) {
243	if (chatMessage && chatMessage != ''){
244		alert(chatMessage);
245	} else {
246			var chaturl = chatUrl + '?conno=' + ConNo + extraCommand + '&digest=' + escape(Digest);
247			
248			$("#chatta").attr("src", chaturl);
249			
250			$("#chattadiv").dialog({
251				title:'Spedizione ' + ConNo,
252				modal: false, 
253				resizable: true,
254				width:890,
255				height:550,
256				modal:true,
257				closeText: '',
258				autoOpen:false,
259				dialogClass: 'errorDialog',
260				close: function(ev, ui)
261				{
262					$(this).dialog("destroy");						
263				}
264			});
265			$("#chattadiv").dialog("open");
266	}
267}
268
269function buildResults(xml){
270	//$('#resultContainer div.resultElement').remove();
271	$('#resultContainer').html("");
272	$('div#noResultPanel').attr("style","display:none");
273	
274	$('#codCli').val('');
275	var fedex = false;
276	if (xml.find('ResultSet > RuntimeError').length > 0) {
277		var errCode = xml.find('ResultSet > RuntimeError > Code').text();
278		// fedex shipment
279		if (errCode == '40000') {
280			fedex = true;
281			$('a#fedexLink').attr('href', xml.find('ResultSet > RuntimeError > Message').text());
282			$('div#fedexDialog').dialog('open');
283		}
284		if (errCode == '00015') {
285			var list = "";
286			var count = '0';
287			xml.find('ConNo').each(function() {
288				list = list + $(this).text() + ',';
289				count++;
290			});
291			list = list.substring(0,list.length-1);
292			list = list.replace(',',' & ');
293			
294			var txt = "";
295			
296			if(count > 1) {
297				txt = "s "+list;
298			}
299			else {
300				txt = " "+list;
301			}
302			
303			//$('h3#shipmentsNotFound').html("Nessun risultato per lettera di vettura "+txt+".");
304			$('a#crsDiv').html("riferimento mittente"+txt+" ");		
305			$('div#noResultPanel').attr("style","display:block");
306		}
307		if(errCode == '04802' || errCode == '04803') {
308			var errMessage = xml.find('ResultSet > RuntimeError > Message').text();
309			
310			$('div#errorDialog').dialog( "option", "title", "Attenzione");
311			$('div#errorDialog').html(errMessage).dialog('open');
312		}
313		$('div#resultsCountToolbar').attr("style","display:none");
314	}
315	if (!fedex){
316		if($('input[name=trType]').val() == 'detailedTracking')
317			dataLayer.push({'event':'DetailedTracking','info': 'Spedizione trovata'});
318		
319		var temp = xml.find('FormParameters > ConsigNos').text();
320		temp = temp.split(',');
321		var lessthenten = 0;
322		for(var i=0; i<temp.length; i++) {
323			if(temp[i].length < 10) {
324				lessthenten++;
325			}
326		}	
327		
328		var countInErrore = 0;
329		var countTotali = 0;
330		var countSearched = 0;
331		var countParziale = 0;
332		var notFound = 0;
333		var connoList = "";
334		var clist = new Array();
335		
336		xml.find('Consignment').each(function() {
337			countTotali++;
338			connoList = connoList + $(this).find('ConNo').text() + ','; 
339			clist.push($(this).find('ConNo').text());			
340		});
341		xml.find('SearchCriteria > ConNo').each(function() {
342			console.log
343			countSearched++;
344			testing = $(this).text();
345			
346			if(connoList.indexOf(testing)<0) {
347				notFound++;
348			}
349		});
350		
351		$('div#resultCountText').text('Trovati '+countTotali+' risultati');
352	
353		var ordclist = clist.sort();
354		var checkDupLdv = 'false';
355		
356		populateLDVArray(clist);
357		
358		for(var i=0;i<ordclist.length-1;i++) {
359			if(ordclist[i]==ordclist[i+1]) {
360				checkDupLdv = 'true';
361			}
362		}
363		if(checkDupLdv == 'true') {
364			$('div#duplicatesLdvDiv').attr('style','display:block');
365		}
366		
367		connoList = connoList.substring(0,connoList.length-1);
368		var cll = 'javascript:openDialog("'+connoList+'")';
369		$('a#temp').attr('href',cll);
370		
371		xml.find('Consignment').each(function() {
372			var status = '';
373			var consignmentType = ($(this).attr('type') == 'D')?('nazionale'):('internazionale');
374			var consType = $(this).attr('type');
375			var awb = $(this).find('FedExAWB').text();
376			var ldvNew = $(this).find('HeldInDepotDetails > HID1ReplacingDoc').text();
377			var trackingGroup = $(this).find('TrackingGroup').text();
378			var trackingColor = $(this).find('TrackingColor').text();
379			
380	var isHeldInDepot = $(this).find('StatusDetails').first().find('StatusGroup').text() == 'GS' && $(this).find('StatusDetails').first().find('StatusCode').text() == '31';
381			
382			if(isHeldInDepot)
383				trackingColor = 'Y';
384			
385			if(trackingColor.length > 1) {
386				trackingColor = trackingColor[0];
387			}
388			if(trackingGroup.length > 3) {
389				trackingGroup = trackingGroup[0] + trackingGroup[1] + trackingGroup[2];
390			}
391			
392			countParziale++;
393			conNo = $(this).find('ConNo').text();
394			conNo = conNo ? conNo : '';
395			
396			sndTown = $(this).find('SendTown').text();
397			sndProvince = $(this).find('SendProvince').text();
398			sndCountry = $(this).find('SendCountry').text();
399			sndTown = sndTown ? sndTown : '';
400			sndProvince = sndProvince ? sndProvince : '';
401			sndCountry = sndCountry ? sndCountry : '';
402			
403			statusGroup = $(this).find('StatusDetails > StatusGroup').first().text();
404			statusCode = $(this).find('StatusDetails > StatusCode').first().text();
405			statusDescr = $(this).find('StatusDetails > StatusDescription').first().text();	
406			statusDepot = $(this).find('StatusDetails > Depot').first().text();
407			depotId = $(this).find('StatusDetails > Depot').first().attr('id');
408			
409			dopDetails = $(this).find('DOPDetails').text();
410			dopDetails = dopDetails ? dopDetails : '';
411			
412			var senderComplete; 
413			if($(this).attr('type') == 'D') {
414				if(sndProvince!='') {
415					senderComplete = sndTown +" ("+sndProvince+"), IT";
416				}
417				else {
418					senderComplete = sndTown +", IT";
419				}			
420			}
421			else {
422				if(sndCountry!='') {
423					if(sndProvince!='') {
424						senderComplete = sndTown +" ("+sndProvince+"), "+sndCountry;
425					}
426					else {
427						senderComplete = sndTown +", "+sndCountry;
428					}
429				}
430				else {
431					if(sndProvince!='') {
432						senderComplete = sndTown +" ("+sndProvince+")";
433					}
434					else {
435						senderComplete = sndTown;
436					};
437				}
438			}
439			
440			if(senderComplete.toString().length > 30) {
441				var senderComplete1 = senderComplete.toString().substring(0,30) + '<br/>';
442				var senderComplete2 = senderComplete.toString().substring(30);
443				senderComplete = senderComplete1 + senderComplete2;					
444			}
445			
446			var destinationComplete; 
447			
448			consignmentDate = $(this).find('ConsignmentDate').text();
449			consignmentDate = consignmentDate ? consignmentDate : '';
450			senderRef = $(this).find('SenderRef').text();
451			senderRef = senderRef ? senderRef : '';
452			var sendRefStyle = (senderRef == '')?'display:none':'';
453			var serviceType = $(this).find('ConsignmentDetails > ServiceType').text();
454			serviceType = serviceType ? serviceType.toUpperCase() : '';
455			
456			var accNo = $(this).find('SenderDetails > SendAccNo').text();
457			accNo = accNo ? accNo : '';
458			
459			
460			
461			collectionName = $(this).find('CollectionName').text();
462			collectionName = collectionName ? collectionName : '';
463			collectionName = $.trim(collectionName ? collectionName : '');
464			var deliveryDate = $(this).find('DeliveryDate').text();
465			var deliveryTime = estraiOra(deliveryDate);
466			var dueDate = $(this).find('DueDate').text();
467			
468			statusTmp = $(this).find('StatusDetails > StatusDescription').first().text();
469			statusTmp = statusTmp ? statusTmp : '';
470			if (statusTmp.length > 100) {
471				status = jQuery.trim(statusTmp).substring(0, 25)
472			    .split(" ").slice(0, -1).join(" ") + "...";
473			} else {
474				status = statusTmp;
475			}
476			
477			destinationDepot = $(this).find('ReceiverDetails > DestinationDepot').text();
478			destinationDepotId = $(this).find('ReceiverDetails > DestinationDepot').attr("id");
479			
480			var dopAddressComplete = "";
481			
482			if(dopDetails != '') {
483				destinationTown = $(this).find('DOPDetails > DOPTown').text();
484				destinationProvince = $(this).find('DOPDetails > DOPProvince').text();
485				dopAddressComplete = $(this).find('DOPDetails > DOPName').text()+" - "+ $(this).find('DOPDetails > DOPAddress').text() +', '+ $(this).find('DOPDetails > DOPPostcode').text() + " "+ destinationTown+" ("+destinationProvince+")";
486			} 
487			else {
488				destinationTown = $(this).find('ReceiverDetails > RcvTown').text();
489				destinationProvince = $(this).find('ReceiverDetails > RcvProvince').text();
490				dopAddressComplete = statusDepot;
491			}	
492			destinationCountry = $(this).find('ReceiverDetails > RcvCountry').text();
493			
494			destinationTown = destinationTown ? destinationTown : '';
495			destinationProvince = destinationProvince ? destinationProvince : '';
496			destinationCountry = destinationCountry ? destinationCountry : '';
497			
498			if(destinationCountry!='') {
499				if(destinationProvince!='') {
500					destinationComplete = destinationTown+" ("+destinationProvince+"), "+destinationCountry;
501				}
502				else {
503					destinationComplete = destinationTown+", "+destinationCountry;
504				}
505			}
506			else {
507				if(destinationProvince!='') {
508					destinationComplete = destinationTown+" ("+destinationProvince+")";
509				}
510				else {
511					destinationComplete = destinationTown;
512				}
513			}
514			
515			if(destinationComplete.toString().length > 30) {
516				var destinationComplete1 = destinationComplete.toString().substring(0,30) + '<br/>';
517				var destinationComplete2 = destinationComplete.toString().substring(30);
518				destinationComplete = destinationComplete1 + destinationComplete2;					
519			}
520			
521			var webChat = $(this).find('SSApproach > WebChat').text();
522			
523			
524			colorChat = trackingColor;
525
526			var lineClass = "";	
527			var dotClass1 = ""; var dotClass2 = ""; var dotClass3 = ""; var dotClass4 = "";  
528			var labelClass = ""; var iconClass = ""; 
529			
530			var status0,status1,status2,status3,status4 = "";
531							
532			//costruisco il container principale
533			var shipmentProgress = $('<div/>'); 
534			$(shipmentProgress).attr('id','shipmentProgress');
535			$(shipmentProgress).attr('class','track-search-result ng-scope consignment-status menu--accordion box--white box-border box-push');
536			
537			//costruisco il pannello delle info sul percorso	
538			var signatoryStyle = "display:none";
539			var labelConsegna = "";
540			var labelDataConsegna = "";
541			var dataConsegnaMessage = "";
542			
543			if(trackingGroup == 'CON' && collectionName != '') { 
544				signatoryStyle = "display:block"; 
545			}
546			
547			if(trackingGroup != 'CON') { 
548				labelConsegna = "Prevista consegna a"; 
549				labelDataConsegna = "Data prevista consegna";
550				
551				var today = new Date();
552				today.setHours(0,0,0,0);
553				
554				var dueDateSplit = dueDate.split('/');			
555				var dueDateApp = new Date(parseInt(dueDateSplit[2]),parseInt(dueDateSplit[1]) - 1,parseInt(dueDateSplit[0])
555);
556				
557				if(dueDate != "" && dueDateApp >= today) {
558					if(serviceType=="EXPRESS"||serviceType=="EXPRESS (DOCS)"||serviceType=="EXPRESS (NON DOCS)"||serviceType=="ECONOMY EXPRESS"||serviceType=="ECONOMY EXPRESS (NON DOCS)") {
559						dataConsegnaMessage = dueDate + ", entro 19:00";
560					}			  
561					if(serviceType=="9:00 EXPRESS (DOCS)"||serviceType=="9:00 EXPRESS (NON DOCS)") {
562						dataConsegnaMessage = dueDate + ", entro 9:00";
563					}
564					if(serviceType=="10:00 EXPRESS"||serviceType=="10:00 EXPRESS (DOCS)"||serviceType=="10:00 EXPRESS (NON DOCS)") {
565						dataConsegnaMessage = dueDate + ", entro 10:00";
566					}
567					if(serviceType=="12:00 EXPRESS"||serviceType=="12:00 EXPRESS (DOCS)"||serviceType=="12:00 EXPRESS (NON DOCS)"||serviceType=="12:00 ECONOMY EXPRESS") {
568						dataConsegnaMessage = dueDate + ", entro 12:00";
569					}
570				}
571				else {
572					dataConsegnaMessage = "In aggiornamento";
573				}
574			}
575			else {
576				labelConsegna = "Consegnata a"
577				labelDataConsegna = "Data consegna";
578				dataConsegnaMessage = deliveryDate;
579			}
580			
581			var shipmentTravel = document.createElement('consignment-status-route');
582			$(shipmentTravel).addClass('ng-isolate-scope');
583			$(shipmentTravel).append(
584				$('<div/>')
585				.attr('name','shipmentTravel')
586				.addClass('layout roster consignment-status__route')
587				.append(
588					$('<div/>')
589					.addClass('consignment-status__route--from layout__item layout__item--vertical-stretch 1/1 phone-plus-1/2')
590					.append($('<span/>')
591						.addClass('consignment-status__label consignment-status__route-label ng-binding')
592						.text("Da")									
593					)
594					.append($('<span/>')
595						.addClass('consignment-status__route-place')
596						.html(senderComplete)								
597					)
598					.append($('<span/>')
599						.addClass('consignment-status__route-time')
600						.text(consignmentDate)								
601					)							
602				)
603				.append(
604					$('<div/>')
605					.addClass('consignment-status__route--to layout__item layout__item--vertical-stretch 1/1 phone-plus-1/2')
606					.append($('<span/>')
607						.addClass('consignment-status__label consignment-status__route-label ng-binding')
608						.text(labelConsegna)									
609					)
610					.append($('<span/>')
611						.addClass('consignment-status__route-place')
612						.html(destinationComplete)								
613					)
614					.append($('<span/>')
615						.addClass('consignment-status__label consignment-status__route-label ng-binding')
616						.text(labelDataConsegna)									
617					)
618					.append($('<span/>')
619						.addClass('consignment-status__route-time')
620						.text(dataConsegnaMessage)								
621					)
622					.append($('<span/>')
623						.attr('id','infoSignatory'+countParziale)
624						.attr('style',signatoryStyle)
625						.addClass('consignment-status__route-label')
626						.text('Ha ritirato: ')
627						.append($('<h3/>')
628								.text(collectionName)
629						)
630					)
631				)						
632			);
633
634			//fine pannello percorso
635			//costruisco la progress bar con breadcrumbs
636			if(colorChat == 'Y') {
637				lineClass = "progressbre__line--passive-warn"; 
638				dotClass1 = dotClass2 = dotClass3 = dotClass4 = "progressbre__dot-warn";
639				labelClass = "progressbre__label-warn";
640			}
641			else {
642				if(colorChat == 'R') {
643					lineClass = "progressbre__line--passive-error";
644					dotClass1 = dotClass2 = dotClass3 = dotClass4 = "progressbre__dot-error";
645					labelClass = "progressbre__label-error";
646					
647				}
648				else {
649					lineClass = "progressbre__line--passive";
650					dotClass1 = dotClass2 = dotClass3 = dotClass4 = "progressbre__dot";
651					labelClass = "progressbre__label";
652				}			
653			}
654
655
656	if(ldvNew == ''){			
657			if(trackingGroup != 'RIT' && statusCode != "0" && statusCode != "1") {
658				status0 = "progressbre__item--complete";
659			}
660			if(trackingGroup == 'PAR') {				
661				status1 = "progressbre__item--current"; 
662				dotClass1 = dotClass1 + " icon__character-check";
663			}
664			if(trackingGroup == 'TRA') {
665				status1 = "progressbre__item--complete"; 
666				status2 = "progressbre__item--current";
667				dotClass1 = dotClass1 + " icon__character-check";
668				dotClass2 = dotClass2 + " icon__character-check";
669			}
670			if(trackingGroup == 'ICO') {
671				status1 = status2 = "progressbre__item--complete"; 
672				status3 = "progressbre__item--current";
673				dotClass1 = dotClass1 + " icon__character-check";
674				dotClass2 = dotClass2 + " icon__character-check";
675				dotClass3 = dotClass3 + " icon__character-check";
676			}
677			if(trackingGroup == 'CON') {
678				status1 = status2 = status3 = "progressbre__item--complete"; 
679				status4 = "progressbre__item--current";
680				dotClass1 = dotClass1 + " icon__character-check";
681				dotClass2 = dotClass2 + " icon__character-check";
682				dotClass3 = dotClass3 + " icon__character-check";
683				dotClass4 = dotClass4 + " icon__character-check";
684			}
685	}
686
687			
688			var shipmentProgressBar = document.createElement('consignment-status-indicator');
689			$(shipmentProgressBar).addClass('ng-isolate-scope');
690			$(shipmentProgressBar).append(
691				$('<div/>')
692				.attr('name','shipmentProgressBar')
693				.addClass('consignment-status__indicator consignment-status__indicator--step-5')
694				.append(
695					$('<ul/>')
696					.addClass('progressbre__list list-inline')
697					.append($('<li/>')
698						.addClass('progressbre__item')
699						.addClass(status0)	
700						.append($('<span/>')
701								.text("RITIRATA")
702								.addClass(labelClass)
703						)
704						.append($('<span/>')
705							.addClass("progressbre__line")
706							.append($('<span/>').addClass("progressbre__line--complete"))
707							.append($('<span/>').addClass("progressbre__line--bg"))
708							.append($('<span/>').addClass(lineClass))
709						)
710						.append($('<span/>')
711							.addClass(dotClass1))
712					)
713					.append($('<li/>')
714						.addClass('progressbre__item')
715						.addClass(status1)
716						.append($('<span/>')
717							.text("IN PARTENZA")
718							.addClass(labelClass)
719						)
720						.append($('<span/>')
721							.addClass("progressbre__line")
722							.append($('<span/>')
723									.addClass("progressbre__line--complete")
724							)
725							.append($('<span/>')
726									.addClass("progressbre__line--bg")
727							)
728							.append($('<span/>')
729									.addClass(lineClass)
730							)
731						)
732						.append($('<span/>')
733							.addClass(dotClass1)
734						)
735					)
736					.append($('<li/>')
737						.addClass('progressbre__item')
738						.addClass(status2)
739						.append($('<span/>')
740							.text("IN TRANSITO")
741							.addClass(labelClass)
742						)
743						.append($('<span/>')
744							.addClass("progressbre__line")
745							.append($('<span/>')
746									.addClass("progressbre__line--complete")
747							)
748							.append($('<span/>')
749									.addClass("progressbre__line--bg")
750							)
751							.append($('<span/>')
752									.addClass(lineClass)
753							)
754						)
755						.append($('<span/>')
756							.addClass(dotClass2)
757						)
758					)
759					.append($('<li/>')
760						.addClass('progressbre__item')
761						.addClass(status3)
762						.append($('<span/>')
763							.text("IN CONSEGNA")
764							.addClass(labelClass)
765						)
766						.append($('<span/>')
767							.addClass("progressbre__line")
768							.append($('<span/>')
769									.addClass("progressbre__line--complete")
770							)
771							.append($('<span/>')
772									.addClass("progressbre__line--bg")
773							)
774							.append($('<span/>')
775									.addClass(lineClass)
776							)
777						)
778						.append($('<span/>')
779							.addClass(dotClass3)
780						)
781					)
782					.append($('<li/>')
783						.addClass('progressbre__item')
784						.addClass(status4)
785						.append($('<span/>')
786							.text("CONSEGNATA")
787							.addClass(labelClass)
788						)
789						.append($('<span/>')
790							.addClass("progressbre__line")
791							.append($('<span/>')
792									.addClass("progressbre__line--complete")
793							)
794							.append($('<span/>')
795									.addClass("progressbre__line--bg")
796							)
797							.append($('<span/>')
798									.addClass(lineClass)
799							)
800						)
801						.append($('<span/>')
802							.addClass(dotClass4)
803						)
804					)
805				)
806			);
807			//fine progress bar		
808			
809			// Se spedizione annullata presenta numero Lettera di Vettura sostitutiva
810			var replacingDocument = document.createElement('consignment-replacing-document');
811			if(ldvNew != ''){
812				$(replacingDocument).append(
813					$('<div/>').append(
814						$('<span/>').addClass('consignment-status__label consignment-status__info-label').text('Emessa nuova Lettera di Vettura')
815					)
816					.append(
817						$('<a/>').attr({
818							href: 'getTrack.html?wt=1&consigNos=' + ldvNew,
819							target: '_blank'
820							}
821						).text(ldvNew)
822					)
823				);
824			}
825			// Fine spedizione annullata
826			
827			
828			//costruisco il pannello delle informazioni aggiuntive per fermi deposito
829			var fermoDeposito = $('<div/>');
830			if(statusCode == '20' || statusCode == '40') {				
831				var url = "https://www.tnt.it/dovesiamo/dovesiamo.do?searchOption=Depot&context=result&depotID="+depotId;
832				
833				if(statusCode != '20'){
834					url = "https://www.tnt.it/contents/trova-tnt.html";	
835				}
836//				if(trackingGroup != 'RIT') {
837//					status0 = "progressbre__item--complete";
838//				}
839				if(trackingGroup != 'RIT') {
840					status0 ='';
841				}
842
843				$(fermoDeposito).attr('name','fermoDepositoDiv');
844				$(fermoDeposito).addClass('heldInDepotInfo');
845				$(fermoDeposito).append(
846					$('<p/>')
847						.text(statusDescr)
848				);
849				$(fermoDeposito).append(
850						$('<p/>')
851							.text(dopAddressComplete)
852					);
853				$(fermoDeposito).append(
854					$('<a/>')
855						.attr('href',url)
856						.attr('target','_blank')
857				);		
858
859			}
860			//fine informazioni aggiuntive per fermi deposito
861			
862			//costruisco il pannello info di destra
863			//var ldvNew = $(this).find('HeldInDepotDetails > HID1ReplacingDoc').text(); 
864			var ldvNewStyle = "display:none";
865						
866			if(ldvNew && ldvNew!='') {	
867				ldvNewStyle = "display:block";
868			}
869			var itemno = $(this).find('ConsignmentDetails > Itemno').text();
870			var itemText = (itemno > 1)?'colli':'collo';
871			
872			var shipmentDetail = $('<div/>');
873			$(shipmentDetail).attr('name','shipmentDetail');
874			$(shipmentDetail).addClass('layout__item layout__item--vertical-stretch consignment-status__info 1/5 portable-1/1 hide-portable');
875			var consStatusInfo = document.createElement('consignment-status-info');
876			$(consStatusInfo).addClass('ng-isolate-scope');
877			$(consStatusInfo).append(
878				$('<div/>')
879				.addClass('layout layout--expanded')
880				.append($('<div/>')
881						.addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1')
882						.append($('<div/>')
883								.addClass('consignment-status__info-field')
884								.append($('<span/>')
885										.addClass('consignment-status__label consignment-status__info-label ng-binding')
886										.text("Lettera di vettura")
887								)
888								.append($('<span/>')
889										.addClass('consignment-status__info-field--highlighted ng-binding')
890										.text(conNo)
891								)
892						)
893				)
894				.append($('<div/>')
895						.addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1')
896						.append($('<div/>')
897								.attr('style',sendRefStyle)
898								.addClass('consignment-status__info-field')
899								.append($('<span/>')
900										.addClass('consignment-status__label consignment-status__info-label ng-binding')
901										.text("Riferimento mittente")
902								)
903								.append($('<span/>')
904										.addClass('consignment-status__info-field--highlighted ng-binding')
905										.text(senderRef)
906								)
907						)
908				)
909			);	
910			if(awb != '') {
911				$(consStatusInfo).append($('<div/>')
912						.addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1')
913						.append($('<div/>')
914							.attr('style',sendRefStyle)
915							.addClass('consignment-status__info-field')
916							.append($('<span/>')
917									.addClass('consignment-status__label consignment-status__info-label ng-binding')
918									.text("FedEx AWB")
919							)
920							.append($('<span/>')
921									.addClass('consignment-status__info-field--highlighted ng-binding')
922									.text(awb)
923							)
924						)
925				);
926			};
927			$(consStatusInfo).append($('<div/>')
928				.addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1')
929				.append($('<div/>')
930					.addClass('consignment-status__info-field')
931					.append($('<span/>')
932							.addClass('consignment-status__label consignment-status__info-label ng-binding')
933							.text("Info spedizione")
934					)
935					.append($('<span/>')
936							.addClass('consignment-status__info-field--highlighted ng-binding')
937							.text(itemno+' '+itemText)
938					)
939				)
940				.append($('<div/>')
941					.attr('style',ldvNewStyle)
942					.addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1')
943					.append($('<div/>')
944							.addClass('consignment-status__info-field')
945							.append($('<span/>')
946									.addClass('consignment-status__label consignment-status__info-label ng-binding')
947									.text("Nuova lettera di vettura")
948							)
949							.append($('<span/>')
950									.addClass('consignment-status__info-field--highlighted ng-binding')
951									.append($('<a/>')
952											.text(ldvNew)
953											.attr('target','_blank')
954											.attr('href','getTrack.html?wt=1&consigNos='+ldvNew)
955									)
956							)
957					)
958				)
959			);
960			$(shipmentDetail).append(consStatusInfo);
961			
962			//Pulsanti aggiuntivi eventuali
963			if($(this).find('PamSped').text() == 'Y') {
964
965				$(shipmentDetail).append($('<div/>')
966									   .addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1 no-print')
967									   .append($('<div/>')
968											   .addClass('consignment-status__info-field')
969											   .append($('<button/>')
970													   .text("Vuoi modificare data o luogo di consegna?")
971													   .attr('type','button')
972													   .attr('onclick','javascript:openPDM("'+conNo+'")')
973													   .attr('title','Clicca qui se vuoi cambiare luogo e data di consegna di questa spedizione')
974													   .css('text-align','center')
975													   .addClass('button button--min button--blue pdmButton')
976												)
977										)
978				)
979			}
980			if(false) {
981				$(shipmentDetail).append($('<div/>')
982									   .addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1 no-print')
983									   .append($('<div/>')
984											   .addClass('consignment-status__info-field')
985											   .append($('<a type="button"/>')
986													   .text("Svincolo giacenza")
987													   .attr('href','https://www.tnt.it/lasciatiAvvisi/Law.do?lv='+conNo)
988													   .attr('target','_blank')
989													   .css('text-align','center')
990													   .addClass('button button--min button--blue'))))
991			}
992			if(webChat == 'L') {			
993				$(shipmentDetail).append($('<div/>')
994									   .addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1 no-print')
995									   .append($('<div/>')
996											   .addClass('consignment-status__info-field')
997											   .append($('<a type="button"/>')
998													   .text("Gestisci riconsegna")
999													   .attr('target','_blank')
1000													   .attr('href','https://www.tnt.it/lasciatiAvvisi/Law.do?lv='+conNo)
1001													   .css('text-align','center')
1002													   .addClass('button button--min button--blue'))))
1003			}
1004/******* Disabilitato pulsante "richiedi prova di consegna su richiesta di Tommaso in quanto innumerevoli POD non sono disponibili 
1005			
1006			if($(this).find('PODDetails > PODRequest').text() == 'Y') {
1007				$(shipmentDetail).append($('<div/>')
1008									   .addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1 no-print')
1009									   .append($('<div/>')
1010											   .addClass('consignment-status__info-field')
1011											   .append($('<button type="button"/>')
1012													   .text("Richiedi prova di consegna")
1013													   .attr('onclick','javascript:btnPODRequestOnClick(\'' + conNo + '\', \'' + consignmentType + '\')')
1014													   .css('text-align','center')
1015													   .addClass('button button--min button--blue'))))
1016			}
1017********************************/			
1018			if($(this).find('PODDetails > PODDownload').text() == 'Y') {			
1019				$(shipmentDetail).append($('<div/>')
1020									   .addClass('layout__item 1/1 lap-1/3 phone-and-up-1/3 phone-1/1 no-print')
1021									   .append($('<div/>')
1022											   .addClass('consignment-status__info-field')
1023											   .append($('<a type="button"/>')
1024													   .text("Scarica prova di consegna")
1025													   .attr('target','_self')
1026													   .attr("href","javascript:downloadPOD('"+conNo+"','"+consType+"','"+consignmentDate+"','"+accNo+"','','')")
1027													   .css('text-align','center')
1028													   .addClass('button button--min button--blue'))))
1029			}
1030			//fine pannello info di destra
1031//			Costruzione link alla chat
1032			var liveChatLinkPresent = false;
1033			if ($(this).find('SSApproach > WebChat').length > 0) {
1034				liveChatLinkPresent = true;
1035			}		
1036			// costruzione dell'elemento per aprire la chat
1037			var chatPanelContent = $('<div/>');
1038			$(chatPanelContent).attr('id','chatPanel'+conNo);
1039			$(chatPanelContent).attr('style','display:inline-block');
1040			$(chatPanelContent).addClass('3/12 palm-1/1 imageStatus');
1041			
1042			if ($(this).find('SSApproach > WebChat').length > 0 ) {
1043				if (($(this).find('SSApproach > WebChat').text() == 'Y')||($(this).find('SSApproach > WebChat').text() == 'C')) {
1044					var sssLink = $.trim($(this).find('SSApproach > SSSLink').text());
1045					var digest = $(this).find('ConNo').attr('digest');
1046					var chatMessage = $(this).find('SSApproach > ChtOpnTm').text();
1047					var chatText = (webChat == 'C')?("Clicca qui e chatta con il nostro Servizio Clienti") : ("Web Chat");					
1048					//var href = "javascript:openChat('"+sssLink+"','"+digest+"','"+conNo+"','&amp;force_agent=0','"+chatMessage+"')";
1049					href = "javascript:openChatNew('tnt-customer-service.it','it-IT','"+conNo+"', 'tracking', '#chattadiv')";
1050					
1051					var $chatLink = $('<a/>');
1052					$chatLink.attr('href',href);					
1053					$chatLink.addClass('support__item chat');
1054					
1055					var $imgChat = $('<span/>');
1056					$imgChat.addClass('media');
1057					$imgChat.append(
1058							$('<i/>')
1059							.addClass('icon__support-chat media__img')
1060							.attr('style','margin-right:2px; font-size:60px; line-height:32px; vertical-align:middle; width:50px;')
1061					);
1062					$imgChat.append(
1063							$('<span/>')
1064							.attr('style','color: #444; padding-top: 3px; font-size: 20px;')
1065							.addClass('media__body')
1066							.text(chatText)
1067					);
1068					
1069					if (webChat == 'C') {
1070						$imgChat.attr('title', 'Necessitiamo di ulteriori informazioni');
1071					} else if (webChat == 'Y' || webChat == 'L') {
1072						$imgChat.attr('title', 'Contattaci se vuoi ulteriori dettagli');
1073					} else {
1074						$imgChat.attr('title', 'Chat non prevista');
1075						liveChatLinkPresent = false;
1076					}
1077					$chatLink.append($imgChat);
1078					$(chatPanelContent).append($chatLink);
1079				}
1080			}
1081			//costruisco barra per chat link
1082			
1083			var chatLinkTxt;
1084			
1085			if(webChat == 'Y') {
1086				chatLinkTxt = "Consegneremo appena possibile. FedEx ti contatter&#224; in caso di necessit&#224;.";
1087			}
1088			else { 
1089				if(webChat == 'L') {
1090					chatLinkTxt = "Gestisci Riconsegna (clicca <a href='https://www.tnt.it/lasciatiAvvisi/Law.do?lv="+conNo+"' target='_blank'>qui</a>).";
1091				}
1092				else {
1093					chatLinkTxt = "Per consegnare la tua spedizione ci servono maggiori informazioni.";
1094				}
1095			}
1096			
1097			var chatLinkBar = $('<div/>');
1098			$(chatLinkBar).attr('name','chatLinkBar');
1099			$(chatLinkBar).addClass('layout__item 1/1 ng-scope');
1100			
1101			var consStatusAction =	document.createElement('consignment-status-action');
1102			$(consStatusAction).addClass('consignment-status-action ng-isolate-scope');
1103			$(consStatusAction).append(
1104				$('<div/>')
1105				.addClass('layout consignment-status-action__indicator ng-scope')
1106				.append($('<div/>')
1107						.addClass('layout__item 4/5 portable-1/1 consignment-status-action__indicator-layer')
1108						.append($('<div/>')
1109								.append($('<span/>')
1110										.addClass('consignment-status-action__indicator-arrow consignment-status-action__indicator-arrow--step-3')
1111								)
1112						)
1113				)
1114				.append($('<div class="layout__item 1/5 hide-portable"/>'))
1115			)
1116			$(chatLinkBar).append(consStatusAction);
1117			
1118			var bindInterceptor = document.createElement('bind-html-intercept-links');
1119			$(bindInterceptor).addClass('ng-scope ng-isolate-scope');
1120			$(bindInterceptor).append(
1121				$('<span>')
1122				.addClass('ng-scope')
1123				.html(chatLinkTxt)
1124			);
1125			
1126			$(chatLinkBar).append(
1127				$('<div/>')
1128				.addClass('consignment-status-action__message track-info-box box-border box--light-grey box-padding box--with-icon')
1129				.append($('<div/>')
1130						.addClass('layout layout--expanded layout--vertical-stretch consignment-status-action__message--warning')
1131						.append($('<div/>')
1132								.addClass('layout__item 1/1 layout__item--vertical-stretch')
1133								.append($('<span class="icon__warning"/>'))
1134										.append($('<h3 class="ng-binding"/>')
1135												.text(statusTmp)
1136										)
1137										.append($('<p/>')
1138												.append(bindInterceptor)
1139										)
1140						)
1141						.append(chatPanelContent)
1142				)	
1143			);
1144			//fine barra chat link
1145			// tratto chat in riga risultati
1146			if (webChat == 'C'){
1147				var chatHtml = $('#chatPanel' + conNo).html();
1148				$('#rowDeliveryDate'+conNo).click(function(){});
1149				$('#rowDeliveryDate'+conNo).html(chatHtml);
1150				$('#rowDeliveryDate'+conNo).addClass('imageStatus');
1151				$('#rowDeliveryDate'+conNo).find('span.media__body').css('font-size', '14px');
1152				$('#rowDeliveryDate'+conNo).find('span.media').css('min-width', '150px');
1153				$('#rowDeliveryDate'+conNo).find('span.media').css('width', '150px');
1154				$('#rowDeliveryDate'+conNo).find('span.media__body').addClass('hide-palm');
1155			}
1156			//costruisco la barra inferiore
1157			var isSaved = ""; var saveClass = ""; saveTxt = "";
1158			if(checkCookie(conNo)) {
1159				isSaved = "yes"; 
1160				saveClass = "consignment-status-details__actions-save--remove";
1161				saveText = "Rimuovi";
1162			}
1163			else {
1164				isSaved = "no"; 
1165				saveClass = "consignment-status-details__actions-save--unsaved";
1166				saveText = "Salva";
1167			}
1168			
1169			var underBar = $('<div/>');
1170			$(underBar).attr('name','underBar');
1171			$(underBar).addClass('layout');
1172			
1173			if(webChat != 'N' && webChat != '') {
1174				$(underBar).append(chatLinkBar);
1175			}
1176			else {
1177				var customerServiceBar = $('<div/>');
1178				$(customerServiceBar).attr('name','customerServiceBar');
1179				$(customerServiceBar).addClass('track-info-box box-border box--light-grey box-padding');
1180				$(customerServiceBar).append(
1181					$('<p class="ng-binding"/>')
1182						.text('Per ulteriori informazioni contatta il nostro ')
1183						.append($('<a/>')
1184							.attr('href','https://www.tnt.it/CustomerOnline/')
1185							.attr('target','_blank')
1186							.text('Customer Service')
1187						)
1188				);
1189				$(underBar).append(customerServiceBar);
1190			}
1191			
1192			var consStatusDetails = document.createElement('consignment-status-details');
1193			$(consStatusDetails).addClass("ng-isolate-scope");
1194			$(consStatusDetails).append(
1195				$('<div/>')
1196				.addClass("consignment-status-details__actions no-print ng-scope")
1197				.append($('<div/>')
1198					.addClass("roster")
1199					.append($("<div/>")
1200						.attr('name','toggleButton'+countParziale)
1201						.addClass("roster__item roster__item--flex")
1202						.append($('<div/>')
1203							.addClass('consignment-status-details__actions-toggle ng-scope')
1204							.append(
1205								$('<a/>')
1206								.attr('href','javascript:toggleDetails("'+countParziale+'")')
1207								.append($('<span/>')
1208										.text('Mostra dettagli')
1209								)
1210									
1211							)
1212						)
1213					)
1214					.append($('<div class=\"roster__item\"/>')
1215						.append($('<div/>')
1216							.addClass('consignment-status-details__actions-share')
1217							.append($('<a/>')
1218								.attr('href','javascript:openDialog("'+conNo+'")')
1219								.append($('<span/>')
1220										.text("Condividi")
1221								)
1222							)
1223						)
1224					)					
1225					.append($('<div/>')
1226						.attr('name','saveButton'+countParziale)
1227						.attr('saved',isSaved)
1228						.addClass('roster__item')
1229						.append($('<div/>')
1230							.addClass('consignment-status-details__actions-save '+saveClass)
1231							.append($('<a/>')
1232									.attr('href','javascript:saveButton('+countParziale+',"'+conNo+'")')
1233									.append($('<span/>')
1234											.text(saveText)
1235									)
1236							)
1237						)
1238					)						
1239				)
1240			);
1241			
1242			$(underBar).append(consStatusDetails);
1243			//fine barra inferiore
1244			//costruisco l'intero pannello delle info
1245			var shipmentInfos = $('<div/>');
1246			$(shipmentInfos).attr('name','shipmentInfos');
1247			$(shipmentInfos).addClass('layout layout--vertical-stretch layout--vertical-stretch--
1247padding');
1248			$(shipmentInfos).append($('<div/>')
1249								  .addClass('layout__item layout__item--vertical-stretch 4/5 portable-1/1')
1250								  .append($('<div/>')
1251										  .attr('name','shipmentStatus')
1252										  .addClass('layout__item layout__item--vertical-stretch 4/5 portable-1/1')
1253										  .append(shipmentTravel)
1254										  .append(shipmentProgressBar)
1255										  .append(fermoDeposito)
1256										  .append(replacingDocument)
1257				)	
1258				.append(shipmentDetail)
1259			);
1260			//costruisco il pannello dei dettagli
1261			var detailsPanel = $('<div/>');
1262			$(detailsPanel).attr('name','detailsPanel'+countParziale);
1263			$(detailsPanel).attr("style","display:none");
1264			$(detailsPanel).addClass('layout consignment-status-details__contents ng-scope box--white box-border box-push');
1265			$(detailsPanel).append($('<div/>')
1266				 .addClass('layout layout--expanded 1/1')
1267				 .append($('<div/>')
1268						 .addClass('layout__item 1/1 box-border--t hide-phone')
1269						 .append($('<div/>')
1270							 .addClass('layout layout--expanded consignment-status-details__contents-row consignment-status-details__contents-row--headers')
1271							 .append($('<div class=\"layout__item 1/12 [phone-and-up-1/12]\"/>')
1272									 .append($('<span/>')
1273											 .text('Stato')
1274											 .addClass('ng-binding')
1275									 )
1276							 )
1277							 .append($('<div class=\"layout__item 1/4 [phone-and-up-1/12]\"/>')
1278									 .append($('<span/>')
1279											 .text('Data')
1280											 .addClass('ng-binding')
1281									 )
1282							 )
1283							 .append($('<div class=\"layout__item 1/6 [phone-and-up-1/12]\"/>')
1284									 .append($('<span/>')
1285											 .text('Filiale')
1286											 .addClass('ng-binding')
1287									 )
1288							 )
1289							 .append(
1290									 $('<div class=\"layout__item 1/4 [phone-and-up-1/12]\"/>')
1291									 .append($('<span/>')
1292											 .text('Descrizione')
1293											 .addClass('ng-binding')
1294									 )
1295							 )
1296						 )
1297				 )
1298			);
1299			if(statusGroup == 'C') {
1300				$(detailsPanel).append($('<div class=\"layout__item 1/1 box-border--t consignment-status-details__signatory ng-scope\"/>')
1301					 .append($('<div/>')
1302							 .addClass('layout layout--expanded consignment-status-details__contents-row consignment-status-details__signatory--row text--wrap')
1303							 .append($('<div/>')
1304									 .addClass('layout__item 1/12 phone-1/1')
1305									 .append($('<span class=\"icon__signed\"/>'))
1306							 )
1307							 .append($('<div/>')
1308									 .attr('id','signatory'+countParziale)
1309									 .addClass('layout__item 11/12 [phone-1/1] consignment-status-details__actions-signatory ng-binding ng-scope')
1310									 .text('Ricevuta e firmata da '+collectionName)
1311									 .append($('<span/>') 
1312											 .addClass('consignment-status-details__actions-signatory-toggle ng-binding')
1313									 )
1314							 )	
1315					 )
1316				);
1317			}
1318
1319			var description_old = ""; 
1320			var date_old = ""; 
1321			var depot_old = "";
1322			
1323			$(this).find('StatusDetails').each(function() {
1324				
1325				var code = $(this).find('StatusCode').text();
1326				var description = $(this).find('StatusDescription').text();
1327				var date = $(this).find('StatusDate').text();
1328				var time = $(this).find('StatusTime').text();
1329				var group = $(this).find('StatusGroup').text();
1330				var trackingDisplayDepot = $(this).find('TrackingDisplayDepot').text();
1331				var depot = "";
1332				
1333				if(trackingDisplayDepot == 'Y') {
1334					depot = $(this).find('Depot').text();
1335				}
1336				
1337				if(!((description == description_old)&&(date == date_old)&&(depot == depot_old))) {
1338					var statusClass = "";
1339					
1340					if(colorChat == 'Y') {iconClass = 'icon__oke-warn';}
1341					if(colorChat == 'R') {iconClass = 'icon__oke-error';}
1342					if(colorChat == 'G') {iconClass = 'icon__oke';}
1343					
1344					if((group == "N")||(group == "A")||(group == "NC")) {
1345						iconClass = 'icon__warning';
1346					}
1347					if(statusCode == "20" || statusCode == "40") {
1348						iconClass = 'icon__oke';
1349					}
1350					
1351					if(group == 'C') {
1352						statusClass='layout layout--expanded consignment-status-details__contents-row consignment-status-details__contents-row--important';
1353					} 
1354					else {
1355						statusClass='layout layout--expanded consignment-status-details__contents-row';
1356					}
1357					
1358					var localDate = document.createElement('locale-date');
1359					var localTime = document.createElement('time');
1360					
1361					$(localDate).addClass('ng-isolate-scope');
1362					$(localTime).addClass('ng-binding ng-scope');
1363					
1364					$(localDate).append(localTime);
1365					
1366					var statusDataDiv = $('<div/>');
1367					$(statusDataDiv).addClass(statusClass);
1368					
1369					$(statusDataDiv).append($('<div/>')
1370						.addClass('layout__item 1/12 phone-and-up-1/12 phone-1/1')
1371						.append($('<span/>')
1372							.addClass(iconClass + ' ng-scope')
1373						)	
1374					);
1375					
1376					$(statusDataDiv).append($('<div/>')
1377						.addClass('layout__item 1/4 phone-1/1 hide-phone-and-up')
1378						.append($('<span/>')
1379								.addClass('consignment-status-details__local-date')
1380								.text(date + ' ' + time)
1381								.append(localDate)							
1382						)
1383						.append($('<span/>')
1384								.addClass('hide-phone-plus ng-binding')
1385						)
1386					);
1387					
1388					$(statusDataDiv).append($('<div/>')
1389						.addClass('layout__item 1/6 phone-and-up-5/12 phone-1/1 consignment-status-details__location')
1390						.append($('<span/>')
1391								.addClass('text--wrap ng-binding')
1392								.text(depot)
1393						)
1394						.append($('<span/>')
1395								.addClass('hide-phone hide-lap-and-up')
1396								.append(localDate)
1397						)
1398					);
1399					
1400					$(statusDataDiv).append($('<div/>')
1401						.addClass('layout__item 1/3 phone-and-up-6/12 phone-1/1')
1402						.append($('<span/>')
1403								.text(description)
1404								.addClass('text--wrap ng-binding')
1405						)
1406					);
1407					
1408					$(detailsPanel).append(statusDataDiv);
1409					
1410					code_old = code;
1411					description_old = description;
1412					date_old = date;
1413					depot_old = depot;
1414				}
1415			});
1416			//fine pannello dettagli	
1417			//Compongo il risultato totale
1418			$(shipmentProgress).append(shipmentInfos);
1419			$(shipmentProgress).append(underBar);
1420			$(shipmentProgress).append(detailsPanel);
1421
1422			$('#resultContainer').append(shipmentProgress);					
1423		});
1424		
1425		//pannello selezione pagina
1426		pageNo = xml.find('ResultSet > PageNo').text();
1427		eof = xml.find('EndOfFile').text();
1428		
1429		if (pageNo == 1 && eof != 'N') {
1430			$('#pagingPanel').hide();
1431			$('#pagingPanel2').hide();
1432		} else {
1433			if (pageNo > 1) {
1434				$('#divPrevious').show();
1435				$('#divPrevious2').show();
1436			} else {
1437				$('#divPrevious').hide();
1438				$('#divPrevious2').hide();
1439			}
1440			if (eof == 'N') {
1441				$('#divNext').show();
1442				$('#divNext2').show();
1443			} else {
1444				$('#divNext').hide();
1445				$('#divNext2').hide();
1446			}
1447			$('#pageNoSpan').text(pageNo);
1448			$('#pageNoSpan2').text(pageNo);
1449			$('#pagingPanel').show();
1450			$('#pagingPanel2').show();
1451		}
1452		$('form[name=trackingForm] input[name=pageNo]').val(pageNo);
1453	
1454		//$('a.podRequestLinkButton').click(btnPODRequestOnClick);
1455		$('#resultPanel').slideDown(400, fixIE8);
1456		$('#resultContainer').addClass('only-print');
1457		
1458		if(notFound > 0) {
1459			if(notFound >1) {
1460				$('li#stillNotFoundTxt').html('Spiacente alcune spedizioni non sono state trovate. Verifica di aver inserito correttamente i numeri di spedizione. Ti ricordiamo che dal momento in cui la spedizione viene affidata a FedEx possono passare alcune ore prima che sia rintracciabile sul tracking. In caso di necessit&#224; <a href="https://www.tnt.it/CustomerOnline/">clicca qui</a>.');
1461			} else {
1462				$('li#stillNotFoundTxt').html('Spiacente questa spedizione non &#232; stata trovata. Verifica di aver inserito correttamente il numero di spedizione. Ti ricordiamo che dal momento in cui la spedizione viene affidata a FedEx possono passare alcune ore prima che sia rintracciabile sul tracking. In caso di necessit&#224; <a href="https://www.tnt.it/CustomerOnline/">clicca qui</a>.');
1463			}
1464			$('div#stillNotFound').css('display','block');
1465		}
1466	    $('html,body').animate({scrollTop: $('#resultPanel').offset().top},'slow');
1467	}
1468    fixIE8();
1469}
1470//------------------------------------------------------------------------------------------------------------------------------------
1471$(document).ready(function(){
1472	
1473	if(BrowserDetect.browser == 'Explorer' && BrowserDetect.version <=8)
1474	{
1475		jQuery.ajaxSetup({
1476            xhr: function() {
1477                    //return new window.XMLHttpRequest();
1478                    try{
1479                        if(window.ActiveXObject)
1480                            return new window.ActiveXObject("Microsoft.XMLHTTP");
1481                    } catch(e) { }
1482
1483                    return new window.XMLHttpRequest();
1484                }
1485        });
1486	}
1487	
1488		var trType = getUrlVars()['trType'];
1489	
1490		if(trType == 'multiple')
1491			textModeSwitchOnClick();
1492	
1493		var today = new Date(parseInt($('input[name=today]').val()));
1494		today.setDate(today.getDate() - 1);
1495		while(today.getDay() == 0 || today.getDay() == 6)
1496		{
1497			today.setDate(today.getDate() - 1);
1498		}
1499		
1500		var meno6 = new Date(parseInt($('input[name=today]').val()));
1501		meno6.setDate(today.getDate() - 8);
1502		
1503		var date = (today.getDate() < 10) ? ("0" + today.getDate()) : (today.getDate());
1504		var month = ((today.getMonth() + 1) < 10) ? ("0" + (today.getMonth() + 1)) : (today.getMonth() + 1);
1505		var year = today.getFullYear();
1506		
1507		var date_m6 = (meno6.getDate() < 10) ? ("0" + meno6.getDate()) : (meno6.getDate());
1508		var month_m6 = ((meno6.getMonth() + 1) < 10) ? ("0" + (meno6.getMonth() + 1)) : (meno6.getMonth() + 1);
1509		var year_m6 = meno6.getFullYear();
1510
1511	var festivi = ['2024-06-02', '2024-12-08', '2024-04-01', '2024-04-25', '2024-08-15', '2024-12-26', '2024-11-01', '2024-01-06'];
1512	
1513	$('#startDate').datepicker(
1514		    {
1515				minDate: '-7D',
1516				maxDate: 'today',
1517				beforeShowDay: function(date){
1518			        var string = $.datepicker.formatDate('yy-mm-dd', date);
1519			        if(festivi.indexOf(string) == -1)
1520			        	return $.datepicker.noWeekends(date);
1521			        else
1522			        	return false;
1523			    },
1524		    	zIndex: 2,
1525		    	onSelect: function(strDate){
1526		    		var date = $(this).datepicker('getDate');
1527		    		$('#endDate').datepicker('option', 'minDate', date);
1528		    	}
1529	});	
1530	
1531	$('#endDate').datepicker(
1532		    {
1533		    	minDate: '-7D',
1534		    	maxDate: 'today',
1535				beforeShowDay: function(date){
1536			        var string = $.datepicker.formatDate('yy-mm-dd', date);
1537			        if(festivi.indexOf(string) == -1)
1538			        	return $.datepicker.noWeekends(date);
1539			        else
1540			        	return false;
1541			    },
1542		    	zIndex: 2,
1543		    	onSelect: function(strDate){
1544		    		var date = $(this).datepicker('getDate');
1545		    		$('#startDate').datepicker('option', 'maxDate', date);
1546		    	}
1547		    	
1548	});		
1549	
1550	$('')
1551	
1552	
1553	
1554	$('#textModeSwitch').click(textModeSwitchOnClick);
1555	$('#submitButton').click(submitButtonOnClick);
1556	$('#cancelButton').click(cancelButtonOnClick);
1557	
1558	setInputFieldsRequired();
1559
1560	$('a.previous').click(function(){
1561		$('form[name=trackingForm] input[name=searchMethod]').val('Back');
1562		return submitData();
1563	});
1564
1565	$('a.next').click(function(){
1566		$('form[name=trackingForm] input[name=searchMethod]').val('Forward');
1567		return submitData();
1568	});
1569
1570	podPanelDialog = $('#podPanel').dialog({
1571		autoOpen: false,
1572		modal: true,
1573		closeText: '',
1574		dialogClass: 'errorDialog',
1575		width: 750
1576
1577
1578	});
1579
1580	spinner = $('div.spinner').dialog({
1581		autoOpen: false,
1582		modal: true,
1583		height: 250,
1584		dialogClass: 'cssSpinner',
1585		open: function( event, ui ) {
1586			$('div.spinner').spin(opts);			
1587		},
1588		close: function( event, ui ) {
1589			$('div.spinner').spin(false);
1590		}
1591	});
1592	
1593	errorDialog = $('div#errorDialog').dialog(
1594	{
1595	   draggable: true,
1596	   autoOpen: false,
1597	   resizable: false,
1598	   //position:['center', 100],
1599	   title: 'Errore',
1600	   width: 410,
1601	   modal: true,
1602	   dialogClass: 'errorDialog',
1603	   closeText: '',
1604	   buttons: {
1605           Chiudi: function () {
1606               $(this).dialog('close');
1607           }
1608	   }
1609	});
1610	
1611	errorDialogPdm = $('div#errorDialogPDM').dialog({
1612	   draggable: true,
1613	   autoOpen: false,
1614	   resizable: false,
1615	   //position:['center', 100],
1616	   title: 'Errore',
1617	   width: 410,
1618	   modal: true,
1619	   dialogClass: 'errorDialogPDM',
1620	   closeText: '',
1621	   buttons: {
1622           Chiudi: function () {
1623               $(this).dialog('close');
1624           }
1625	   }
1626	});
1627	
1628	fedexDialog = $('div#fedexDialog').dialog(
1629	{
1630	   draggable: true,
1631	   autoOpen: false,
1632	   resizable: false,
1633	   //position:['center', 100],
1634	   title: 'Messaggio importante',
1635	   width: 410,
1636	   modal: true,
1637	   dialogClass: 'errorDialog',
1638	   closeText: ''
1639	});
1640	
1641	
1642	$('#btnTrack').click(btnTrackOnClick);
1643		
1644	toggleAccountNo();
1645	
1646	if ($('#autoSearch').val() == '1') {
1647		submitButtonOnClick();
1648	}
1649	fixPlaceholder();
1650	init();
1651	
1652});
1653//------------------------------------------------------------------------------------------------------------------------------------
1654function submitPODData() {
1655	$('form[name=podForm] input.is-error').removeClass("is-error");
1656	spinner.dialog('open');
1657	$.ajax({
1658		url: $('form#podForm').attr('action'),
1659		type: $('form#podForm').attr('method'),
1660		data: $('form#podForm').serialize(),
1661		dataType: 'text',
1662		complete: function(jqXHR, textStatus){
1663		},
1664		
1665		success: function(xmlString){
1666			spinner.dialog('close');
1667			xmlString = xmlString.replace("<!DOCTYPE ResultSet SYSTEM \"podOU.dtd\">", "");
1668			var xml = $.parseXML(xmlString);
1669			if ($(xml).find('ResultSet > Complete').length > 0) {
1670				podPanelDialog.dialog('close');
1671				message = $(xml).find('ResultSet > Complete').attr('message');
1672				$('div#errorDialog').dialog( "option", "title", "Messaggio");
1673				$('div#errorDialog').html(message);
1674				$('div#errorDialog').dialog('open');
1675			} else {
1676				message = $(xml).find('RuntimeError > Message').text();
1677				$('div#errorDialog').dialog( "option", "title", "Errore");
1678				$('div#errorDialog').html(message);
1679				$('div#errorDialog').dialog('open');
1680			}
1681		},
1682		error: function(jqXHR, textStatus, errorThrown){
1683			spinner.dialog('close');
1684			podPanelDialog.dialog('close');
1685				$('div#errorDialog').dialog( "option", "title", "Errore");
1686				$('div#errorDialog').html("Si &egrave; verificato un errore. Si prega di riprovare pi&ugrave; tardi");
1687				$('div#errorDialog').dialog('open');
1688
1689		}	
1690	});
1691	
1692	return false;
1693}
1694function downloadPOD(conno,ctype,cdate,accno,docId,archId) {
1695	//codCli
1696	$('form[name=pdfDownload] input#pd_conNo').val(conno);
1697	$('form[name=pdfDownload] input#pd_type').val(ctype);
1698	$('form[name=pdfDownload] input#pd_startDate').val(cdate);
1699	$('form[name=pdfDownload] input#pd_accountNo').val(accno);
1700	$('form[name=pdfDownload] input#pd_documentID').val(docId);
1701	$('form[name=pdfDownload] input#pd_archiveID').val(archId);
1702	
1703	$('form[name=pdfDownload]').submit();
1704}
1705function submitPDMData(ldv) {
1706	$('form[name=pdmForm] input.is-error').removeClass("is-error");
1707
1708	$.ajax({
1709		url: $('form[name=pdmForm]').attr('action'),
1710		type: $('form[name=pdmForm]').attr('method'),
1711		data: $('form[name=pdmForm]').serialize(),
1712		dataType: 'text',
1713		complete: function(jqXHR, textStatus){
1714		},
1715		
1716		success: function(xmlString){
1717			xmlString = xmlString.replace("<!DOCTYPE ResultSet SYSTEM \"podOU.dtd\">", "");
1718			var xml = $.parseXML(xmlString);
1719			
1720			if ($(xml).find('ResultSet > RadLink').text() != "") {
1721				$.magnificPopup.close()
1722				window.open('http://'+$(xml).find('ResultSet > RadLink').text(),'_blank');
1723			} else {
1724				$('div#errorDialogPDM').html('Dati destinatario non validi.');
1725				$('div#errorDialogPDM').dialog('open');
1726			}
1727		},
1728	});
1729}
1730function btnPdmOnClick(ldv) {
1731	
1732	var isValid = true;
1733	$('.error').each(function(){$(this).removeClass('is-error')});
1734	  
1735	if($.trim($('form[name=pdmForm] input[name=email]').val()) =='' && $.trim($('form[name=pdmForm] input[name=phone]').val()) =='')
1736	{
1737	  	isValid = false;
1738	  	$('input[name=email]').addClass('is-error');
1739	  	$('input[name=phone]').addClass('is-error');
1740	}
1741		
1742	if(!isValid) {
1743		message = "I campi evidenziati sono obbligatori";
1744
1745		return false;
1746	}
1747
1748	$('form[name=pdmForm] input[name=lv]').val(ldv);	
1749	$('form[name=pdmForm] input[name=email]').val($('input#email').val());
1750	$('form[name=pdmForm] input[name=phone]').val($('input#phone').val());
1751
1752	return submitPDMData(ldv);
1753}
1754function fixPlaceholder() {
1755	if (document.documentMode && (document.documentMode || 100) < 10) {
1756	$('[placeholder]').off('focus').off('blur');
1757	$('[placeholder]').focus(function() {
1758		  var input = $(this);
1759		  if (input.val() == input.attr('placeholder')) {
1760		    input.val('');
1761		    input.removeClass('placeholder');
1762		  }
1763		}).blur(function() {
1764		  var input = $(this);
1765		  if (input.val() == '' || input.val() == input.attr('placeholder') || $(this).hasClass('placeholder')) {
1766		    input.addClass('placeholder');
1767		    input.val(input.attr('placeholder'));
1768		  }
1769		}).blur();
1770	$('[placeholder]').parents('form').submit(function() {
1771		  $(this).find('[placeholder]').each(function() {
1772		    var input = $(this);
1773		    if (input.val() == input.attr('placeholder')) {
1774		      input.val('');
1775		    }
1776		  })
1777		});
1778	
1779	}
1780}
1781
1782function fixIE8() {
1783	$('#mainDiv').toggleClass('ie8fix');
1784	fixPlaceholder();
1785}
1786
1787var opts = {
1788		  lines: 15, // The number of lines to draw
1789		  length: 24, // The length of each line
1790		  width: 14, // The line thickness
1791		  radius: 30, // The radius of the inner circle
1792		  corners: 1, // Corner roundness (0..1)
1793		  rotate: 0, // The rotation offset
1794		  direction: 1, // 1: clockwise, -1: counterclockwise
1795		  color: '#000', // #rgb or #rrggbb or array of colors
1796		  speed: 1, // Rounds per second
1797		  trail: 60, // Afterglow percentage
1798		  shadow: false, // Whether to render a shadow
1799		  hwaccel: false, // Whether to use hardware acceleration
1800		  className: 'spinner', // The CSS class to assign to the spinner
1801		  zIndex: 2e9, // The z-index (defaults to 2000000000)
1802		  top: '50%', // Top position relative to parent
1803		  left: '50%' // Left position relative to parent
1804		};
1805
1806
1807function getUrlVars()
1808{
1809    var vars = [], hash;
1810    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
1811    for(var i = 0; i < hashes.length; i++)
1812    {
1813        hash = hashes[i].split('=');
1814        vars.push(hash[0]);
1815        vars[hash[0]] = hash[1];
1816    }
1817    return vars;
1818}
1819//------------------------------------------------------------------------------------------------------------
1820function toggleDetails(num) {
1821	
1822	var htmlClose = "<div class=\"consignment-status-details__actions-toggle ng-scope\"\"><a href=\"javascript:toggleDetails('"+num+"')\"><span>Mostra dettagli</span></a></div>";
1823	var htmlOpen  = "<div class=\"consignment-status-details__actions-toggle ng-scope consignment-status-details__actions-toggle--open\"\"><a href=\"javascript:toggleDetails('"+num+"')\"><span>Nascondi dettagli</span></a></div>";
1824	
1825	var style = ($("div[name=detailsPanel"+num+"]").attr("style").toLowerCase());
1826	
1827	if(style == "display:none"||style == "display:none;"||style == "display: none"||style == "display: none;") {
1828		$('div[name=detailsPanel'+num+']').attr("style","display:block");
1829		$('div[name=toggleButton'+num+']').html(htmlOpen);
1830	}
1831	else {
1832		$('div[name=detailsPanel'+num+']').attr("style","display:none");
1833		$('div[name=toggleButton'+num+']').html(htmlClose);
1834	}
1835}
1836
1837function saveButton(num,conno) {
1838	
1839	var htmlUnsaved = "<div class=\"consignment-status-details__actions-save consignment-status-details__actions-save--unsaved\"><a href=\"javascript:saveButton("+num+",'"+conno+"')\"><span class=\"ng-binding\">Salva</span></a></div>";
1840	var htmlSaved  =  "<div class=\"consignment-status-details__actions-save consignment-status-details__actions-save--remove\"><a href=\"javascript:saveButton("+num+",'"+conno+"')\"><span class=\"ng-binding\">Rimuovi</span></a></div>";
1841	
1842	if($('div[name=saveButton'+num+']').attr("saved") == "no") 
1843	{
1844		if(saveShipmentInCookie(conno)) {
1845			$('div[name=saveButton'+num+']').attr("saved","yes");
1846			$('div[name=saveButton'+num+']').html(htmlSaved);
1847			$('div[name=mySaved]').attr("style","display:inline");
1848		}
1849	}
1850	else {
1851		removeCookie(conno);
1852		$('div[name=saveButton'+num+']').attr("saved","no");
1853		$('div[name=saveButton'+num+']').html(htmlUnsaved);
1854	}
1855}
1856function openDialog(conno) {
1857
1858	var shareLink = window.document.domain+"/tracking/getTrack.html?wt=1&consigNos="+conno;
1859	
1860	var mailSubject = 'Monitora la spedizione FedEx '+conno;
1861	var mailText = "Ciao,\r\n\r\nQui di seguito trovi il link per seguire l'andamento della spedizione "+conno+" sul Tracking di FedEx http%3A%2F%2Fwww.tnt.it%2Ftracking%2FgetTrack.html%3Fwt%3D1%26consigNos%3D"+conno +" \r\nTi ricordiamo che puoi controllare le tue spedizioni FedEx in qualsiasi momento scaricando la nostra App \"FedEx Express Italy\". Visita https://www.tnt.it/contents/tnt-app.html.\r\n\r\n";
1862	
1863	$shareDialog = $('<div class="modal modal--show"/>');
1864	$shareDialog.append(
1865		$('<div class="box-padding box--white box-border"/>')
1866		.append(
1867			$('<div/>')
1868			.append(
1869				$('<h2 class="modal__header ng-binding ng-scope"/>')
1870				.text('Condividi spedizione')
1871			)
1872			.append(
1873				$('<label class="label__heading ng-binding"/>')
1874				.text('Copia il link sottostante per condividere questa spedizione.')
1875			)
1876			.append(
1877				$('<input id="share-all-url" class="input--100 share-all-modal__copy-field ng-pristine ng-untouched ng-valid ng-scope ng-not-empty"/>')
1878				.val(shareLink)
1879			)
1880			.append(
1881				$('<div class="roster ng-scope"/>')
1882				.append(
1883					$('<div class="roster__item--flex 1/2"/>')
1884					.append($('<span class="share-all-modal__divider"/>'))
1885				)
1886				.append(
1887					$('<div class="roster__item"/>')
1888					.append($('<span class="share-all-modal__or ng-binding"/>')
1889							.text('O')
1890					)
1891				)
1892				.append(
1893					$('<div class="roster__item--flex 1/2"/>')
1894					.append($('<span class="share-all-modal__divider"/>'))
1895				)
1896			)
1897			.append(
1898				$('<a class="button button--blue share-all-modal__email-button ng-binding ng-scope ng-isolate-scope"/>')
1899				.text('Condividi via email')
1900				.attr('href','mailto:?'+'subject='+mailSubject+'&searchType=CON&source=share&body='+mailText)
1901			)
1902			.append(
1903				$('<button class="button button--large button--line share-all-modal__cancel-button ng-binding ng-scope ng-isolate-scope" type="button"/>')
1904				.text('Annulla')
1905				.attr('onclick','$.magnificPopup.close()')
1906			)
1907		)
1908	)
1909	
1910	$.magnificPopup.open({
1911      items: {
1912    	src: $shareDialog,
1913        type: 'inline',
1914        showCloseBtn: false
1915      } 	
1916    });
1917}
1918function openInfo(value) {
1919	
1920	var title,text,foot = "";
1921	
1922	if(value == 'ldv') {
1923		title = "Lettera di vettura";
1924		text = "Puoi trovare la lettera di vettura nella mail di conferma della tua spedizione, nelle note che ti sono state inviate, nel manifest, ecc.";
1925	}
1926	else {
1927		title = "Riferimento mittente";
1928		text = "Questo &#232; un riferimento opzionale fornito durante la prenotazione della spedizione. Se non ne sei in possesso, per favore effettua il tracking usando la lettera di vettura.";
1929	}
1930	foot = "Sai che puoi cercare pi&#250; spedizioni insieme? Usa una virgola per separare le lettere di vettura oppure copiale e incollale da un file esterno.";
1931	
1932	$resultItem = $("<div class=\"modal modal--show\"/>");
1933	$resultItem.append(
1934	$("<div class=\"box-padding box-border box--white\"/>")
1935		.append($("<a class=\"panel-close ng-scope\"/>")
1936			.css("display","none")	
1937			.attr("href","$.magnificPopup.close()")
1938			.append($("<i/>")
1939				.addClass("icon__anchor-close")
1940			)
1941		)
1942		.append($("<div/>")
1943			.append($("<h2 class=\"modal__header ng-binding ng-scope\"/>")
1944				.html(title)	
1945			)
1946			.append($("<p class=\"ng-binding ng-scope\">")
1947				.html(text)	
1948			)
1949			.append($("<p class=\"ng-binding ng-scope\">")
1950				.html(foot)	
1951			)
1952			.append($("<button class=\"ng-binding ng-scope ng-isolate-scope\" type=\"button\"/>")
1953				.text("Chiudi")
1954				.attr("onclick","$.magnificPopup.close()")
1955			)
1956		)
1957	)
1958	
1959	$.magnificPopup.open({
1960      items: {
1961    	src: $resultItem,
1962        type: 'inline',
1963        showCloseBtn: false
1964      } 	
1965    });
1966}
1967function viewSignatory(off,cn) {
1968	$('div#signatory'+off).html('Ricevuta e firmata da '+cn+'.');
1969}
1970function openPDM(ldv) {
1971	
1972	$resultItem = $('<div/>');
1973	$resultItem.addClass('modal modal--show');
1974	$resultItem.append(
1975	  $('<div/>')
1976	  	.addClass('box-padding box-border box--white')
1977		.append($('<a/>')
1978			.addClass('panel-close ng-scope')
1979			.css('display','none')	
1980			.attr('href','$.magnificPopup.close()')
1981			.append($("<i/>").addClass("icon__anchor-close"))
1982		)
1983		.append($('<div/>')
1984			.append($('<h2/>')
1985					.addClass('modal__header ng-binding ng-scope')
1986					.text('Modifica data o luogo di consegna')	
1987			)
1988		)
1989		.append($('<div/>')
1990			.append($('<p/>')
1991				.text('Se vuoi eliminare le attese o prevedi di non essere disponibile per il giorno della consegna, scegli una delle opzioni di consegna alternative che abbiamo messo a tua disposizione.')
1992			)
1993			.append($('<p/>'))
1994		)
1995		.append($('<form/>')
1996				.attr('id','pdmForm')
1997				.attr('name','pdmForm')
1998				.attr('action','sendPdmRequest.html')
1999				.attr('method','post')
2000				.append($('<input/>')
2001						.attr('id','lv')
2002						.attr('name','lv')
2003						.attr('type','hidden')
2004						.val(ldv)
2005						
2006				)
2007				.append($('<div/>')
2008						.css('display','inline-block')
2009						.addClass('roster')
2010						.append($('<label/>')
2011								.css('vertical-align','middle')
2012								.css('font-weight','bold')
2013								.text('Email')
2014						)
2015						.append($('<input/>')
2016								.attr('id','email')
2017								.attr('name','email')
2018								.attr('type','text')
2019								.attr('placeholder','Inserisci l\'indirizzo email del destinatario')
2020								.addClass('textarea required')
2021								.css('float','right')
2022								.css('width','60%')
2023								.css('height','50px')
2024								.css('text-align','middle')
2025						)
2026				)
2027				.append($('<p/>'))
2028				.append($('<div/>')
2029						.css('display','inline-block')
2030						.addClass('roster')
2031						.append($('<label/>')
2032								.text('Telefono')
2033								.css('vertical-align','middle')
2034								.css('font-weight','bold')
2035						)
2036						.append($('<input/>')
2037								.attr('id','phone')
2038								.attr('name','phone')
2039								.attr('type','text')
2040								.attr('placeholder','Inserisci il numero di telefono del destinatario')
2041								.addClass('textarea required')
2042								.css('float','right')
2043								.css('width','60%')
2044								.css('height','50px')
2045						)
2046						
2047				)
2048				.append($('<p/>'))
2049				.append($("<div/>")
2050					.addClass('roster')
2051					.append($("<button/>")
2052							.text('Continua')
2053							.attr('type','button')
2054							.attr('onclick','javascript:btnPdmOnClick("'+ldv+'")')
2055							.addClass('button button--blue')
2056							.css('float','right')
2057							.css('width','60%')
2058					)
2059				)
2060			)
2061	);
2062	
2063	$.magnificPopup.open({
2064		items: {
2065			src: $resultItem,
2066			type: 'inline',
2067			showCloseBtn: false
2068		} 	
2069    });
2070}
2071function imprime() {
2072	print();
2073}
2074//---------------------------------------- GESTIONE COOKIE ---------------------------------------------------
2075function setCookie(cvalue, exdays) {
2076	var n = checkCookies();
2077	if(n>=3) {
2078		alert("Si possono salvare al massimo 3 spedizioni. Se vuoi salvare questa spedizione devi cancellare una delle precedenti.");
2079		return false;
2080	}
2081	else {
2082	    var d = new Date();
2083	    d.setTime(d.getTime() + (exdays*24*60*60*1000));
2084	    var expires = "expires="+d.toUTCString();
2085	    var name = 'savedShipment' + cvalue;
2086	    $.cookie(name, encodeURIComponent(cvalue), {expires: 30}, {path:'/'});
2087	    return true;
2088	}
2089}
2090function getCookie(cname) {
2091    var name = cname + "=";
2092    var ca = document.cookie.split(';');
2093    for(var i=0; i<ca.length; i++) {
2094        var c = ca[i];
2095        while (c.charAt(0)==' ') c = c.substring(1);
2096        if (c.indexOf(name) == 0){ 
2097        	return decodeURIComponent(c.substring(name.length, c.length));
2098        }
2099    }
2100    return "";
2101}
2102function getCookies() {
2103	if (checkCookies()>0) {
2104		return document.cookie.split(';');
2105	}
2106	else return "";
2107}
2108function checkCookie(conno) {
2109	if(checkCookies()>=1) {
2110		var cookies = document.cookie.split(';');
2111		for(var i=0;i<cookies.length;i++) {
2112			if(cookies[i].split('=')[1] == conno) { 
2113				return true;
2114			}
2115		}
2116	}
2117	return false;
2118}
2119function checkCookies() {
2120	var cookie = $.cookie();
2121
2122	if((cookie == "undefined")||(cookie == "")) {
2123		return 0;
2124	} else {
2125		var cookies = document.cookie.split(';');
2126		var count = 0;
2127		var name = "";
2128		for(var i=0;i<cookies.length;i++) {
2129			name = cookies[i].replace(' ','').substring(0,13);
2130			if(name == "savedShipment") { 
2131				count++; 
2132			}
2133		}
2134		return count;
2135	}
2136}
2137function removeCookie(conno) {
2138	
2139	$.removeCookie("savedShipment"+conno);
2140
2141	if(checkCookies()==0) {
2142		$('div[name=mySaved]').attr("style","display:none");
2143	}
2144}
2145function saveShipmentInCookie(conno) {
2146	return setCookie(conno,30);
2147}
2148function init() {
2149
2150	if(checkCookies()>0) {
2151		$('div[name=mySaved]').attr("style","display:block");
2152	}
2153	else {
2154		$('div[name=mySaved]').attr("style","display:none");
2155	}
2156}
2157function toSaved(origin) {
2158	
2159	var cookies = document.cookie.split(';');
2160	var name = "";
2161	var list = "";
2162	
2163	for(var i=0;i<cookies.length;i++) {
2164		name = cookies[i].replace(' ','').substring(0,13);
2165		if(name == "savedShipment") {
2166			list = list + cookies[i].split('=')[1] + ",";
2167		}
2168	}
2169	list = list.substring(0,list.length-1);
2170	
2171	if(list != "") {
2172		if(origin=="detailed") {
2173			window.open("getTrack.html?wt=1&consigNos="+list,"_self");
2174		}	else {	
2175			//$('#autoSearch').val(1);
2176			$('form[name=trackingForm] input[name=numberText]').val(list);
2177			submitButtonOnClick();
2178		}
2179	}
2180}
2181//--------------------------------------------------------------------------------------------------------------------------------

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.