PageSourceSearch

https://satruck.org/scripts/devnext.satruck.vehicle.js?t=134347155896426444

js satruck.org collected 2026-09-24 09:27:33 UTC 31,025 bytes, 962 lines download raw bytes

1
2//Handles the vehicle workflow
3
4satruck.controller.vehicle = 
5{
6	initControls: function()
7	{
8		//$("#donor-street").change(function()
9		//{
10		//	satruck.controller.vehicle.donorAddressGeocode();
11		//});
12
13		//setup vehicle-year for years 1960
14		var years = '<option value="0" selected="selected">(Unknown)</option>';
15		var maxYear = new Date().getFullYear() + 1;
16		for (var i = maxYear; i >= 1960; i--)
17		{
18			years = years + '<option value="' + i + '">' + i + '</option>';
19		}
20		$("#vehicle-year").empty().append(years);
21
22		//setup adsource options to be configureable by territory
23		var adsourceOptions = ['Unknown (Not Listed)',
24			'AAA Westways Magazine',
25			'Another Organization',
26			'Auto Trader',
27			'Billboard',
28			'Blue Bags',
29			'Donated Before',
30			'Family or Friends',
31			'Favorite Charity',
32			'Flyer in Mail',
33			'Internet',
34			'K-EARTH 101',
35			'Newspaper',
36			'Post Card',
37			'Radio',
38			'Recycler',
39			'Salvation Army Referral',
40			'TV'];
41		var adsourceOptionsUSW = ['Unknown (Not Listed)',
42			'AAA Westways Magazine',
43			'Another Organization',
44			'Bill Abbott Show',
45			'Blue Bags',
46			'Donated Before',
47			'Family or Friends',
48			'Favorite Charity',
49			'Social Media',
50			'Salvation Army Referral',
51			'Senior Guide'];
52		var adsourceHtml = '';
53		var wip = satruck.config._loadWorkflowData();
54		if (wip.tid == 40) {
55			adsourceOptions = adsourceOptionsUSW;
56        }
57
58		for (var i = 0; i < adsourceOptions.length; i++) {
59			adsourceHtml += '<option>' + adsourceOptions[i] + '</option>'
60        }
61
62		$("#vehicle-adsource").empty().append(adsourceHtml);
63
64		$('.vehicle-icon').click(function(e)
65		{
66			e.preventDefault();
67			$('.vehicle-icon').removeClass('selected');
68			$(this).addClass('selected');
69		});
70
71		$(".vehicle.panel-body").on('click', ".vehicle-next", function(e)
72		{
73			e.preventDefault();
74			
75
76			var step = $(this).data("currentstep");
77
78			satruck.workflow.pushToWip(step, 'switch');
79
80			if(step != 4) {
81				$('html,body').animate({ scrollTop: 0 }, 500);
82			}
83			
84			switch(step) 
85			{
86				case 1:
87					satruck.controller.vehicle.validateStep1();
88					break;
89				case 2:
90					satruck.controller.vehicle.validateStep2();
91					break;
92				case 3:
93					satruck.controller.vehicle.validateStep3();
94					break;
95				case 4:
96					satruck.controller.vehicle.validateStep4();
97					break;
98				default:
99					break;
100			}
101			//satruck.controller.vehicle.next(step);
102		});
103		$(".vehicle.panel-body").on('click', ".vehicle-back", function(e)
104		{
105			e.preventDefault();
106
107			var step = $(this).data("currentstep");
108			if (step == 4 && (!satruck.account.is_logged_in() && !$("#donor-account-question-form").is(":visible")))
109			{
110			    satruck.workflow.loadDonorQuestion();
111			    //Tealium
112			    satruck.tealium._setVehicleSubPageTealium("4-1");
113			}
114			else
115			{
116				satruck.controller.vehicle.back(step);
117			}
118		});
119
120		$("#btn-vin-lookup").click(function(e)
121		{
122			e.preventDefault();
123			var btn = $(this);
124			var vin = $.trim($("#vehicle-vin").val());
125			if (vin)
126			{
127
128				var wip = satruck.config._loadWorkflowData();
129
130				btn.addClass('spinner');
131
132				satruck.workflow.pushToWip(3, "kbb vin lookup: "+vin);
133
134				satruck.api.GetVehicleByVin(vin, wip.zip, function(apiResult)
135				{
136					//fill in here what can be from lookup
137					if (apiResult && apiResult.Success == true && apiResult.RetVal)
138					{
139						$("#vehicle-make").val(apiResult.RetVal.Manufacturer);
140						$("#vehicle-model").val(apiResult.RetVal.Model);
141						$("#vehicle-year").val(apiResult.RetVal.Year);
142					} 
143					else 
144					{
145						var $parent = $("#vehicle-vin").parent('div');
146						var $helpText = $parent.children('small');
147						DN.Validation.ShowError($parent, $helpText);
148						$("#vehicle-vin").focus(function() 
149						{
150							DN.Validation.HideError($parent);
151						});
152					}
153					btn.removeClass('spinner');
154				});
155				
156			} 
157			else 
158			{
159				var $parent = $("#vehicle-vin").parent('div');
160				var $helpText = $parent.children('small');
161				DN.Validation.ShowError($parent, $helpText);
162				$("#vehicle-vin").focus(function() 
163				{
164					DN.Validation.HideError($parent);
165				});
166			}
167		});
168
169		satruck.controller.customPanel();
170
171		//setup make and model
172		satruck.api.GetMakesAndModels(0, function(apiResult)
173		{
174			satruck.config.makes = apiResult.RetVal.Manufacturers;
175			satruck.config.models = apiResult.RetVal.Models;
176
177			if (satruck.config.makes != null)
178            {
179			    var items = $.map(satruck.config.makes, function(item)
180			    {
181				    return {
182					    label: item.Manufacturer,
183					    value: item.Manufacturer_id,
184					    id: item.Manufacturer_id
185				    }
186			    });
187			}
188
189			$("#vehicle-make").autocomplete(
190			{
191				source: function( request, response ) 
192				{
193					var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( request.term ), "i" );
194					response( $.grep( items, function( item )
195					{
196						return matcher.test( item.label );
197					}) );
198				},
199				minLength: 0,
200				select: function(event, ui)
201				{
202					$(this).val(ui.item.label);
203					event.preventDefault();
204					var id = ui.item.id;
205					var mods = satruck.config.models.filter(function(m) { if (m.Manufacturer_id == id) { return true; } else { return false; } });
206					satruck.controller.vehicle.loadModels(mods);
207				},
208				focus: function(event, ui)
209				{
210					$(this).val(ui.item.label);
211					event.preventDefault();
212					var id = ui.item.id;
213					var mods = satruck.config.models.filter(function(m) { if (m.Manufacturer_id == id) { return true; } else { return false; } });
214					satruck.controller.vehicle.loadModels(mods);
215				}
216			})
217			.focus(function()
218			{            
219				$(this).trigger('keydown.autocomplete');
220			});
221		});
222
223		$("#confirm-dialog").dialog(
224		{
225			autoOpen: false,
226			height: 400,
227			width: 600,
228			modal: true,
229			buttons:
230			[{
231				text:"Continue Editing",
232				click:function()
233				{
234					$(this).dialog("close");
235				},
236				'class' : 'btn btn-default dialog-cancel'
237			},
238			{
239				text: "Save Ticket",
240				click:function()
241				{
242					var wip = satruck.config._loadWorkflowData();
243					satruck.workflow.pushToWip(3, "vehicle order submitting");
244					
245					//tracking
246					wip.donation.isMobile = satruck.config.ismobile;
247					wip.donation.sourceType = satruck.config._getSourceType();
248
249					wip.donation.donor.FirstName = $("#donor-firstname").val();
250                    wip.donation.donor.LastName = $("#donor-lastname").val();
251                    wip.donation.donor.HomePhone = DN.Validation.unFormatPhone($("#donor-homephone").val());
252                    wip.donation.donor.DayPhone = DN.Validation.unFormatPhone($("#donor-dayphone").val());
253                    wip.donation.donor.AddressLine1 = $("#donor-street").val();
254                    wip.donation.donor.AddressLine2 = $("#donor-street2").val();
255                    wip.donation.donor.City = $("#donor-city").val();
256                    wip.donation.donor.State = $("#donor-state").val();
257                    wip.donation.donor.ZipCode = $("#donor-zip").val();
258                    //wip.donation.donor.CrossStreet = $("#donor-crossstreet").val();
259                    wip.donation.donor.OtherInformation = $("#donor-otherinformation").val();
260                    wip.donation.donor.Email = $("#donor-email").val();
261                    wip.donation.donor.IsBusiness = $("#donor-isbusiness").is(":checked");
262                    wip.donation.donor.NoSolicitation = $("#donor-nosolicitation").is(":checked");
263                    wip.donation.donor.NoServiceReminders = $("#donor-noservicereminders").is(":checked");
264					wip.donation.donor.DoNotEmailSolicitation = $("#donor-donotemailsolicitation").is(":checked");
265					wip.donation.donor.DoNotCallSolicitation = $("#donor-donotcallsolicitation").is(":checked");
266					wip.donation.donor.DoNotTextSolicitation = $("#donor-donottextsolicitation").is(":checked");
267					wip.donation.donor.DoNotEmailServiceReminders = $("#donor-donotemailservicereminders").is(":checked");
268					wip.donation.donor.DoNotCallServiceReminders = $("#donor-donotcallservicereminders").is(":checked");
269					wip.donation.donor.DoNotTextServiceReminders = $("#donor-donottextservicereminders").is(":checked");
270                    satruck.config._persistWorkflowData(wip);
271
272					$(this).dialog("close");
273					//load busy
274					$('body').addClass('loading');
275					satruck.workflow.donorAddressGeocode(function()
276					{
277						wip = satruck.config._loadWorkflowData();
278
279						satruck.api.SubmitVehicleOrder(wip.donation, wip.donation.donor, function(apiResult)
280						{
281							$('body').removeClass('loading');
282
283							wip = satruck.config._loadWorkflowData();
284
285							if (apiResult && apiResult.Success == true)
286							{
287								//var dateObj = new Date(wip.donation.scheduleDate);
288								//var dateFormatted = satruck.config.days[(new Date(wip.donation.scheduleDate)).getDay()] + ", " + wip.donation.scheduleDate;
289								var orderid = apiResult.RetVal.Pickup_id ? apiResult.RetVal.Pickup_id : "unknown";
290								var mypickupsurl = apiResult.RetVal && apiResult.RetVal.MyPickupsURL ? apiResult.RetVal.MyPickupsURL : "unknown";
291								//var myreceiptsurl = apiResult.RetVal && apiResult.RetVal.MyReceiptsURL ? apiResult.RetVal.MyReceiptsURL : "unknown";
292
293								wip.currentStep = 5;
294								wip.dropOutStep = 1000;
295								wip.isComplete = true;
296								wip.order_id = orderid;
297								wip.mypickupsurl = mypickupsurl;
298								//wip.myreceiptsurl = myreceiptsurl;
299								satruck.workflow.pushToWip(5, "ticket created: pickup_id-"+orderid);
300								satruck.workflow.pushToWip(5, "ticket created: my_pickups_url-"+mypickupsurl);
301								//wip.stepDetails.push({step:5, stepData: "ticket created: my_receipts_url-"+myreceiptsurl, timestamp: UTC_TIMESTAMP});
302
303								$("input[name*='order_id']").val(orderid);
304								$("input[name*='ajax_ticket_Pickup_id']").val(orderid);
305								$("input[name*='donate_my_pickups_url']").val(mypickupsurl);
306								//$("input[name*='ajax_ticket_ScheduleDate']").val(orderid);
307							    //$("input[name*='ajax_ticket_ScheduleDateString']").val(orderid);
308                                //Tealium
309								utag_data.order_id = orderid;
310								utag_data.ajax_ticket_Pickup_id = orderid;
311								utag_data.donate_my_pickups_url = mypickupsurl;
312							    //New Tealium Tags
313								utag_data.donation_id = orderid;
314								utag_data.product_name = wip.donation.vehicleYear + " " + wip.donation.make + " " + wip.donation.model;
315								utag_data.product_quantity = "1";
316								utag_data.site_section = "Donate Vehicle";
317								utag_data.site_type = "ARC";
318								utag_data.login_status = satruck.account.is_logged_in() ? "Logged In" : "Not Logged In";
319								utag_data.pickup_date = $.datepicker.formatDate('yymmdd', new Date()) + ":NA:NA";
320								//utag_data.ajax_ticket_ScheduleDate = dateObj;
321								//utag_data.ajax_ticket_ScheduleDateString = dateFormatted;
322
323								//if (mypickupsurl != "unknown") 
324								//{
325								//	$("#confirm-mypickups").attr("href", mypickupsurl); 
326								//}
327								//if (myreceiptsurl != "unknown") 
328								//{
329								//	$("#confirm-myreceipts").attr("href", myreceiptsurl); 
330								//}
331
332								wip.tealium = utag_data;
333								satruck.config._persistWorkflowData(wip);
334
335								window.location = satruck.config.urls.vehicleconfirm;
336							}
337							else
338							{
339								wip.hasErrors = true;
340
341								satruck.workflow.pushToWip(4, "err:"+apiResult.ErrorMessage + ";terminate: aborted failed workflow", wip);
342								//satruck.api.SubmitWorkflowData(wip);
343
344								if(apiResult.ErrorMessage) 
345								{
346									DN.Utils.ShowError(apiResult.ErrorMessage, "Sorry!");
347								} 
348								else 
349								{
350									DN.Utils.ShowError("There was a problem submitting your ticket. We value your donation and deeply apologize for the inconvenience. Please feel free to try again or call 1-800-728-7825 for assistance.", "Sorry!");
351								}
352
353								
354							}
355						});
356					});
357					
358				},
359				'class' : 'btn btn-default dialog-confirm'
360			}]
361		});
362
363		$("#account-question-yes").on('click', function(e)
364		{
365			e.preventDefault();
366			satruck.workflow.loadDonorLogin();
367		    //Tealium
368			satruck.tealium._setVehicleSubPageTealium("4-2");
369		});
370
371		$("#account-question-no").on('click', function(e)
372		{
373			e.preventDefault();
374			satruck.workflow.loadDonorInfo();
375		    //Tealium
376			satruck.tealium._setVehicleSubPageTealium("4-3");
377		});
378
379		$("#account-question-not-sure").on('click', function(e)
380		{
381			e.preventDefault();
382			//satruck.workflow.loadDonorLookup();
383		 //   //Tealium
384			//satruck.tealium._setVehicleSubPageTealium("4-4");
385
386			satruck.controller.profile.openForgotPasswordDialog();
387		});
388
389		if (satruck.account.is_logged_in())
390		{
391			$('#step-3-donor-submit').show();
392			$('#step-3-next').hide();
393		}
394		else
395		{
396			$('#step-3-donor-submit').hide();
397			$('#step-3-next').show();
398		}
399	},
400
401	next: function(step)
402	{
403		$(".step").hide();
404		$(".step" + (step + 1)).show();
405
406		//set the info cumb if logged in on the date step
407		if (step == 2 && satruck.account.is_logged_in) { step++; }
408
409		satruck.controller.setBreadCrumbs((step + 1), 'vehicle');
410		satruck.controller.customPanel();
411	},
412	back: function(step)
413	{
414		$(".step").hide();
415		$(".step" + (step - 1)).show();
416		satruck.controller.setBreadCrumbs((step - 1), 'vehicle');
417		satruck.controller.customPanel();
418	},
419	step: function(crumb)
420	{
421		if ($(crumb).hasClass("active"))
422		{
423			var step = $(crumb).data("step");
424			$(".step").hide();
425			$(".step" + step).show();
426
427			//set the info cumb if logged in on the date step
428			if (step == 3 && satruck.account.is_logged_in) { step++; }
429
430			satruck.controller.setBreadCrumbs(step, 'vehicle');
431		}
432	},
433	validateStep1: function()
434	{
435		satruck.controller.vehicle.persistType();
436		//satruck.controller.vehicle.loadInfoForm();
437	},
438	validateStep2: function()
439	{
440		var $visibleStep = $('.step:visible .table:visible');
441		DN.Validation.fieldHasData($visibleStep, satruck.controller.vehicle.persistInfo);
442	},
443	validateStep3: function()
444	{
445		satruck.controller.vehicle.persistNotes();
446	},
447	validateStep4: function()
448	{
449		var wip = satruck.config._loadWorkflowData();
450
451		if ($("#donor-login-form").is(":visible"))
452		{
453			if ($.trim($("#donor-username").val()).length == 0)
454			{
455				var $parent = $("#donor-username").parent('div');
456				var $helpText = $parent.children('small');
457				DN.Validation.ShowError($parent, $helpText);
458				$("#donor-username").focus(function()
459				{
460					DN.Validation.HideError($parent);
461				});
462			}
463			else if ($.trim($("#donor-password").val()).length == 0)
464			{
465				var $parent = $("#donor-password").parent('div');
466				var $helpText = $parent.children('small');
467				DN.Validation.ShowError($parent, $helpText);
468				$("#donor-password").focus(function()
469				{
470					DN.Validation.HideError($parent);
471				});
472			}
473			else
474			{
475				var wip = satruck.config._loadWorkflowData();
476
477				satruck.workflow.pushToWip(4, "donor logging in")
478
479				$('body').addClass('loading');
480
481				satruck.account._login($("#donor-username").val(), $("#donor-password").val(), function(apiResult)
482				{
483					$('body').removeClass('loading');
484
485					if (apiResult && apiResult.Success && apiResult.Success == false)
486					{
487						wip.hasErrors = true;
488						satruck.workflow.pushToWip(4, "err:"+apiResult.ErrorMessage + ";terminate: aborted failed workflow", wip);
489
490						DN.Utils.ShowError(apiResult.ErrorMessage);
491					    //Tealium
492						if (typeof utag != 'undefined' && utag != null) {
493						    utag.link({
494						        'event_name': 'Login Failure', //Event Name
495						        'event_type': 'login_failure', //Event Type
496						    });
497						}
498					}
499					else
500					{
501					    //Tealium
502					    if (typeof utag != 'undefined' && utag != null) {
503					        utag.link({
504					            'event_name': 'Login Success', //Event Name
505					            'event_type': 'login_success', //Event Type
506					        });
507					    }
508						var donor = $.extend({}, satruck.donor.default);;
509						donor = apiResult.DonorInfo;
510						donor.DonorUserId = apiResult.DonorUserId;
511						if (donor != null && donor.Donor_id > 0)
512						{
513							if(wip.zip == donor.ZipCode) 
514							{
515								wip.donation.donor = donor;
516								wip.donation.did = donor.Donor_id;
517
518								satruck.workflow.pushToWip(4, "Donor login success: " + wip.tid + "|" + wip.donation.aid + "|" + wip.donation.did, wip);
519
520								satruck.account._persistUser(donor, false, false, function()
521								{
522									satruck.workflow.fillDonorForm(wip);
523									satruck.workflow.pickupComplete();
524								});
525							} 
526							else 
527							{
528								// Populate fields in dialog 
529								$('#update-address-dialog').find('.wip-zip').text(wip.zip);
530								$('#update-address-dialog').find('#donor-city').val(wip.zipcity);
531								$('#update-address-dialog').find('#donor-state').val(wip.zipstate);
532								$('#update-address-dialog').find('#donor-zip').val(wip.zip);
533
534								// Open dialog
535								satruck.controller.profile.misMatchedAddressDialog(donor);
536							}
537						}
538						else
539						{
540
541							if(apiResult.StatusMessage) 
542							{
543								satruck.workflow.pushToWip(4, apiResult.StatusMessage);
544								DN.Utils.ShowMessage('Sorry! Unfortunately we have an error: ' + apiResult.StatusMessage, "Login Error", true);
545							} 
546							else 
547							{
548								satruck.workflow.pushToWip(4, "No matching donor in territory/ARC/Zip: " + wip.tid + "|" + wip.donation.aid + "|");
549								DN.Utils.ShowConfirm("Sorry, we could not find your account! Would you like to look it up by phone number?", "Sorry!",
550								function()
551								{
552									satruck.workflow.loadDonorLookup();
553								});
554							}
555						}
556					}
557				});
558			}
559		}
560		else if ($('#donor-update-form').is(':visible')) 
561		{
562			var wip = satruck.config._loadWorkflowData();
563			var $visibleStep = $('#donor-update-form');
564
565			function updateUser()
566			{
567				var user = satruck.account._loadUser(true);
568				user.AddressLine1 = $.trim($visibleStep.find('#donor-street').val());
569				user.DayPhone = $.trim($visibleStep.find('#donor-dayphone').val());
570				user.AddressLine2 = $.trim($visibleStep.find('#donor-street2').val());
571				user.Latitude = 0;
572				user.Longitude = 0;
573				wip.donation.donor = user;
574				satruck.config._persistWorkflowData(wip);
575				satruck.account._updateUserInWorkflow(user);
576				satruck.workflow.fillDonorForm(wip);
577			}
578
579			DN.Validation.fieldHasData($visibleStep, updateUser);
580
581		}
582		else if ($("#donor-lookup-form").is(":visible"))
583		{
584			if (!DN.Validation.isValidPhone($("#donor-phone").val())) 
585			{
586				var $parent = $("#donor-phone").parent('div');
587				var $helpText = $parent.children('small');
588				DN.Validation.ShowError($parent, $helpText);
589				$("#donor-phone").focus(function() 
590				{
591					$(this).addEventListener ("input", DN.Validation.HideError($parent), false);
592				});
593			} 
594			else if ($.trim($("#donor-name").val()).length == 0) 
595			{
596				var $parent = $("#donor-name").parent('div');
597				var $helpText = $parent.children('small');
598				DN.Validation.ShowError($parent, $helpText);
599				$("#donor-name").focus();
600			} 
601			else 
602			{
603				satruck.workflow.doDonorLookup();
604			}
605		}
606		else
607		{
608			//Validate all donor fields are filled in
609			//If good, then it's time to throw up a confirmation Modal, and then
610			//On to the Success Page
611
612			var haserrors = false;
613			
614			function createAccountinWorkflow()
615			{
616				if($('.create-account-option').hasClass('confirm-account-creation'))
617				{
618					if ($.trim($("#donor-info-password").val()) == '' || $.trim($("#donor-info-password").val()).length < 6 || $.trim($("#donor-info-password").val()).length > 20)
619					{
620						DN.Validation.ShowErrorEasy("#donor-info-password");
621						haserrors = true;	
622					}
623					if ($.trim($("#donor-info-password").val()) != $.trim($('#donor-info-confirmpassword').val()))
624					{
625						DN.Validation.ShowErrorEasy("#donor-info-confirmpassword");
626						haserrors = true;
627					}
628
629					wip.creatingAccount = true;
630
631					satruck.workflow.pushToWip(3, "donor creates account in pickup workflow", wip);
632
633					if (haserrors)
634					{
635						return false;
636					}
637
638				} 
639				else 
640				{
641					satruck.workflow.pushToWip(3, "donor does not create account in pickup workflow");
642				}
643
644				satruck.config._persistWorkflowData(wip);
645				satruck.workflow.persistDonorInfo(wip);
646
647			}
648
649			var $visibleStep = $('.step:visible .table:visible');	
650			DN.Validation.fieldHasData($visibleStep, createAccountinWorkflow);
651		}
652	},
653
654	validateStep5: function() 
655	{
656
657	},
658
659	persistType: function(step)
660	{
661		var wip = satruck.config._loadWorkflowData();
662		var $type = $("#vehicle-type-select a.selected");
663
664		//Types
665		//Car = 401
666		//Boat = 405
667		//Motorcycle = 406
668		//RV = 404
669		//Truck = 402
670		//Van = 403
671		//Other = 0
672		var type = $type && $type.length ? $type.text() : "Car";
673		var typeInt = 401;
674		switch(type.toLowerCase()) 
675		{
676			case "car":
677				typeInt = 401;
678				break;
679			case "boat":
680				typeInt = 405;
681				break;
682			case "motorcycle":
683				typeInt = 406;
684				break;
685			case "rv":
686				typeInt = 404;
687				break;
688			case "truck":
689				typeInt = 402;
690				break;
691			case "van":
692				typeInt = 403;
693				break;
694			case "other":
695				typeInt = 0;
696				break;
697		}
698
699		wip.donation.vehicleType = typeInt;
700		//Tealium
701		utag_data.vehicle_type = wip.donation.vehicleType;	    
702
703		wip.currentStep = 2;
704		wip.dropOutStep = 3;
705		satruck.workflow.pushToWip(2, "vehicle info start", wip );
706
707		satruck.controller.vehicle.next(1);
708
709	    //New Tealium Tags		
710		satruck.tealium._setVehicleSubPageTealium(2);
711	},
712
713	loadModels: function(models) 
714	{
715		var isinit = $("#vehicle-model").data("isinit");
716		if (isinit) $("#vehicle-model").autocomplete("destroy");
717		$("#vehicle-model").data("mymodels", models);
718
719		var items = $.map(models, function(item)
720		{
721			return {
722				label: item.Model,
723				value: item.Model
724			}
725		});
726
727		$("#vehicle-model").autocomplete(
728		{
729			source: items,
730			minLength:0
731		}).focus(function(){            
732            $(this).trigger('keydown.autocomplete');
733        });
734
735		$("#vehicle-model").data("isinit", true);
736	},
737
738	persistInfo: function()
739	{
740		var wip = satruck.config._loadWorkflowData();
741
742		wip.donation.vin = $("#vehicle-vin").val();
743		wip.donation.make = $("#vehicle-make").val();
744		wip.donation.model = $("#vehicle-model").val();
745		wip.donation.vehicleYear = $("#vehicle-year").val();
746		wip.donation.color = $("#vehicle-color").val();
747		wip.donation.tagNumber = $("#vehicle-plate").val();
748		wip.donation.adSource = $("#vehicle-adsource").val();
749
750		//tealium
751		utag_data.vehicle_VIN = wip.donation.vin;
752		utag_data.vehicle_manuf = wip.donation.make;
753		utag_data.vehicle_model = wip.donation.model;
754		utag_data.vehicle_year = wip.donation.vehicleYear;
755		utag_data.vehicle_color = wip.donation.color;
756		utag_data.vehicle_plate = wip.donation.tagNumber;
757		utag_data.vehicle_source = wip.donation.adSource;
758		utag_data.vehicle_addr = $("#vehicle-address").val();
759		utag_data.vehicle_zip = $("#vehicle-zip").val();
760	    //New Tealium Tags
761		utag_data.site_section = "Donate Vehicle";
762		utag_data.site_type = "ARC";
763		utag_data.login_status = satruck.account.is_logged_in() ? "Logged In" : "Not Logged In";
764
765		if (wip.vehicleAddress != $("#vehicle-address").val() || wip.donation.vehicleZip != $("#vehicle-zip").val() || !wip.donation.vehicleLatitude || !wip.donation.vehicleLongitude)
766		{
767			wip.donation.vehicleAddress = $("#vehicle-address").val();
768			wip.donation.vehicleZip = $("#vehicle-zip").val();
769			wip.donation.vehicleCity = "";
770			wip.donation.vehicleState = "";
771			wip.donation.vehicleLatitude = "";
772			wip.donation.vehicleLongitude = "";
773		}
774		
775		wip.currentStep = 3;
776		wip.dropOutStep = 4;
777
778		satruck.workflow.pushToWip(3, "vehicle notes start", wip);
779
780		satruck.config._persistWorkflowData(wip);
781
782		satruck.controller.vehicle.next(2);
783        //Tealium
784		satruck.tealium._setVehicleSubPageTealium(3);
785	},
786
787	vehicleLocationGeocode: function() 
788	{
789		var wip = satruck.config._loadWorkflowData();
790
791		if(($("#vehicle-zip").val().length>=5)&&($("#vehicle-address").val().length>=1)) 
792		{
793			satruck.workflow.pushToWip(4,  "vehicle geocode request start: " + wip.tid + "|" + wip.donation.aid + "|" + wip.donation.vehicleAddress + "|" + wip.donation.vehicleZip);
794			
795			//satruck.api.GeocodeMapquest(wip.donation.vehicleAddress, wip.donation.vehicleZip, function(apiResult)
796			satruck.api.Geocode(wip.donation.vehicleAddress, wip.donation.vehicleZip, wip.tid, wip.donation.aid, "SATruck", function(apiResult)
797			{
798				
799				if (apiResult && apiResult.Success == true)
800				{
801					if (apiResult.RetVal.Accuracy > 0) 
802					{
803						wip.donation.vehicleLatitude = apiResult.RetVal.Lat;
804						wip.donation.vehicleLongitude = apiResult.RetVal.Lon;
805						if ((apiResult.RetVal.City == "")
806							&&	($("#vehicle-zip").val() == $("#donor-zip").val())) 
807						{
808							//try and correct if zip is same
809							wip.donation.vehicleCity = wip.zipcity;
810						} 
811						else 
812						{
813							wip.donation.vehicleCity = apiResult.RetVal.City;
814						}
815						wip.donation.vehicleState = wip.zipstate;
816
817						satruck.workflow.pushToWip(4, "geocode request success: " + wip.donation.vehicleLatitude + "|" + wip.donation.vehicleLongitude, wip);
818					}
819					else
820					{
821						wip.donation.vehicleCity = "";
822						wip.donation.vehicleState = "";
823						wip.donation.vehicleLatitude = "";
824						wip.donation.vehicleLongitude = "";
825
826						satruck.workflow.pushToWip(4, "geocode request returned inaccurate result", wip);
827					}
828				}
829				else
830				{
831					wip.donation.vehicleCity = "";
832					wip.donation.vehicleState = "";
833					wip.donation.vehicleLatitude = "";
834					wip.donation.vehicleLongitude = "";
835
836					satruck.workflow.pushToWip(4, "geocode request returned success = false", wip);
837				}
838
839				//Tealium
840				utag_data.vehicle_city = wip.donation.vehicleCity;
841				utag_data.vehicle_state = wip.donation.vehicleState;
842				utag_data.vehicle_lat = wip.donation.vehicleLatitude;
843				utag_data.vehicle_lon = wip.donation.vehicleLongitude;
844			    //New Tealium Tags
845				utag_data.site_section = "Donate Vehicle";
846				utag_data.site_type = "ARC";
847				utag_data.login_status = satruck.account.is_logged_in() ? "Logged In" : "Not Logged In";
848
849				satruck.config._persistWorkflowData(wip);
850			});	
851		}
852	},
853
854	persistNotes: function()
855	{
856		var wip = satruck.config._loadWorkflowData();
857
858		wip.donation.contactPreference = $("#contactpref-select").val();
859		wip.donation.notes = $("#pickupnotes").val();
860		//tealium
861		utag_data.vehicle_donor_contact = wip.donation.contactPreference;
862		utag_data.vehicle_notes = wip.donation.notes;
863
864		wip.currentStep = 4;
865		wip.dropOutStep = 5;
866		satruck.workflow.pushToWip(4, "vehicle donor start", wip);
867
868		if (!satruck.account.is_logged_in())
869		{
870			satruck.workflow.loadDonorQuestion();
871			satruck.controller.vehicle.next(3);
872		    //Tealium
873			satruck.tealium._setVehicleSubPageTealium("4-1");
874		}
875		else
876		{
877			if(satruck.account.is_profile_complete() == false) 
878			{
879				// we need the user to update their profile first
880				satruck.controller.vehicle.next(3);
881				satruck.workflow.loadDonorInfo(true);
882			} 
883			else 
884			{
885				// skip login process
886				var user = satruck.account._loadUser(true);
887				wip.donation.donor = user;
888				wip.donation.did = user.Donor_id;
889				satruck.workflow.pushToWip(4, "Donor login success: " + wip.tid + "|" + wip.donation.aid + "|" + wip.donation.did, wip);
890				satruck.workflow.fillDonorForm();
891				satruck.workflow.pickupComplete();
892			}
893			
894		}
895	},
896
897	pickupComplete: function()
898	{
899		var wip = satruck.config._loadWorkflowData();
900		//wip.donation.donor.DayPhone = DN.Validation.unFormatPhone($("#donor-dayphone").val());
901
902		var typeString = "Car";
903        var type = wip.donation.vehicleType || wip.donation.vehicleType == 0 ? wip.donation.vehicleType : 401;
904		switch(type) 
905		{
906			case 401:
907				typeString = "Car";
908				break;
909			case 405:
910				typeString = "Boat";
911				break;
912			case 406:
913				typeString = "Motorcycle";
914				break;
915			case 404:
916				typeString = "RV";
917				break;
918			case 402:
919				typeString = "Truck";
920				break;
921			case 403:
922				typeString = "Van";
923				break;
924			case 0:
925				typeString = "Other";
926				break;
927		}
928
929		var confirmHtml = "<div class='confirmText'><p><span style='font-weight:bold'>Donor Info</span>:<br />"+
930			$.trim(wip.donation.donor.FirstName) + " " + $.trim(wip.donation.donor.LastName) + "<br />" + 
931			$.trim(wip.donation.donor.AddressLine1) + "<br />" +
932			(wip.donation.donor.AddressLine2 ? $.trim(wip.donation.donor.AddressLine2) + "<br />" : "") +
933			$.trim(wip.donation.donor.City) + ", " + $.trim(wip.donation.donor.State) + " " + wip.donation.donor.ZipCode + "<br />" +
934			(wip.donation.donor.DayPhone ? DN.Validation.formatPhone(wip.donation.donor.DayPhone) + "<br />" : "") + "</p>" +
935			"<p><span style='font-weight:bold'>Contact Preference</span>: " + wip.donation.contactPreference + "</p>";
936
937		confirmHtml += "<p><span style='font-weight:bold'>Vehicle</span>: " +
938			wip.donation.vehicleYear + " " + wip.donation.make + " " + wip.donation.model + " <span style='font-weight:bold'>Color</span>: " + wip.donation.color + "</p>" +
939			"<p><span style='font-weight:bold'>Type</span>: " + typeString + "</p>" +
940			"<p><span style='font-weight:bold'>Location</span>: " + (wip.donation.vehicleAddress ? wip.donation.vehicleAddress + (wip.donation.vehicleZip ? ", " + wip.donation.vehicleZip : "") 
940: (wip.donation.vehicleZip ? wip.donation.vehicleZip : "")) + "</p>" +
941			"<p><span style='font-weight:bold'>Pickup Notes</span>: " + wip.donation.notes + "</p></div>";
942
943		//On next screen
944		//$("#confirm-donation-details").html("<pre>"+confirmHtml+"</pre>");
945
946		$("#confirm-dialog").html(confirmHtml);
947
948		satruck.workflow.pushToWip(4, "Confirm Donation: " + wip.tid + "|" + wip.donation.aid + "|" + wip.donation.did);
949
950		$("#confirm-dialog").dialog("open");
951	    //Tealium
952		utag_view = utag_data;
953		utag_view.page_name = "ARC | donate vehicle:confirm vehicle information";
954		utag_view.site_section = "Donate Vehicle";
955		utag_view.site_type = "ARC";
956		utag_view.product_name = wip.donation.vehicleYear + " " + wip.donation.make + " " + wip.donation.model;
957		utag_view.product_quantity = "1";
958		if (typeof utag != 'undefined' && utag != null) {
959		    utag.view(utag_view);
960		}
961	}
962};

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.