PageSourceSearch

https://westernvistashistoricbyway.com/scripts/forms.js?v=1790601371

js westernvistashistoricbyway.com collected 2026-09-28 13:16:22 UTC 21,944 bytes, 715 lines download raw bytes

1/*created: 20150831 modified: 20170825*/
2if(typeof(ajaxRouter) == 'undefined')
3	var ajaxRouter = '';
4
5var purchaseTotal =
6{
7	cheapestMembership:
8	{
9		cost:null,
10		id:null,
11		type:null
12	}, //holds cheapest membership information
13
14	discount:
15	{
16		amount:0, //holds the returned amount of the applied discount
17		autoApply:0, //holds the returned amount of the applied discount
18		description:null, //holds the description of the applied discount
19		eligible:[],
20		item:null, //holds the table id of the item the discount is to be applied to
21		type:null //holds the type of discount
22	}, //holds applied discount information
23	discountAmountTotal:0, //holds the total amount of the discount in dollars
24	discountEligible:[], //holds a list of who is eligible to use the discount
25	discountsAutoApply:[], //holds discounts that should automatically be applied
26	discountsApplied:[], //holds a list of discounts that have been applied
27
28	membership:[
29	{
30		cost:null,
31		id:null,
32		type:null
33	}], //holds portal user information
34
35	membershipRequestSent:false, //flag indicating if membership information has been sent for
36	membershipRequestCallbackQue:[], //list of callbacks that need to execute upon the return of the request
37
38	submitEnableFlags:
39	{
40		payment:true,
41		portal:true
42	} //flags to indicate if submit button should be enabled or disabled
43};
44
45var visitor =
46{
47	type:null //the type of visitor
48}; //information about the visitor
49
50purchaseTotal.updateTotal = function()
51{
52	var total = 0;
53
54	$('.subtotalInput').each(function() {
55			total += Number($(this).text());
56	});
57	//console.log(total);
58	//apply discount
59	if(purchaseTotal.discountType == 'percent') //percent
60		total = total * purchaseTotal.discountAmountTotal;
61	else //total
62		total = total - purchaseTotal.discountAmountTotal;
63
64	document.getElementById('total').innerHTML = total.toFixed(2);
65}
66
67purchaseTotal.updateDiscountAmountDisplay = function()
68{
69	/**
70	* - Go through the list of applied discounts
71	* -- Show discount description
72	* -- Show discount amount
73	* - Update list of discounts on the form
74	*/
75
76	if(document.getElementById('discountApply') != null)
77	{
78		var ul = ''; //
79
80		for(var i=0, len=purchaseTotal.discountsApplied.length; i<len; i++)
81			ul += '<li><span>' + purchaseTotal.discountsApplied[i].description + '</span><span>' + (purchaseTotal.discountsApplied[i].type == 'total' || purchaseTotal.discountsApplied[i].type == 'item' ? '- $' + purchaseTotal.discountsApplied[i].amount : purchaseTotal.discountsApplied[i].amount + (purchaseTotal.discountsApplied[i].type == 'percent' ? '%' : '')) + '</span></li>';//.toFixed(2)
82
83		if(ul) ul = '<ul>' + ul + '</ul>';
84
85		document.getElementById('discountApply').innerHTML = ul;
86	}
87
88	//(typeof(document.getElementById('discountApply')) != 'undefined') && (document.getElementById('discountApply')) && (document.getElementById('discountApply').innerHTML = (purchaseTotal.discountAmountTotal ? ('-' + (purchaseTotal.discountType == 'total' || purchaseTotal.discountType == 'item' ? '$' : '') + purchaseTotal.discountAmountTotal + (purchaseTotal.discountType == 'percent' ? '%' : '')): ''));
89	/*
90	if(purchaseTotal.discountAmountTotal)
91	{
92		document.getElementById('discountApply').innerHTML = '-' + (purchaseTotal.discountType == 'total' || purchaseTotal.discountType == 'item' ? '$' : '') + purchaseTotal.discountAmountTotal + (purchaseTotal.discountType == 'percent' ? '%' : '');
93	}
94	else
95		document.getElementById('discountApply').innerHTML = '';*/
96}
97
98purchaseTotal.applyBestDiscount = function()
99{
100	/**
101	* Compares all eligible discounts and an applied discount to determine which one is the best
102	*/
103}
104
105purchaseTotal.eligibleForDiscount = function(eligible)
106{
107	//console.log('eligible');
108	console.log(eligible);
109  console.log(visitor.type);
110	console.log(eligible.indexOf(visitor.type.toString()) + 1);
111
112	if(eligible.length < 1)
113		return true
114	else if(visitor.type != null)
115	  return eligible.indexOf(visitor.type.toString()) + 1;
116
117	return 0;
118}
119
120purchaseTotal.updateDiscountAmountTotal = function()
121{
122	/**
123	* - Calculate the sum of all discounts
124	* - Update purchaseTotal.discountAmountTotal
125	*/
126
127	var total = 0;
128
129	for(var i=0, len=purchaseTotal.discountsApplied.length; i<len; i++)
130	{
131		//console.log(purchaseTotal.discountsApplied[i]);
132		if(purchaseTotal.discountsApplied[i].type == 'item' && purchaseTotal.discountsApplied[i].item) //specific item
133		{
134			//console.log('itemdiscount');
135			var quantity = purchaseTotal.getQuantity(purchaseTotal.discountsApplied[i].item);
136
137			if(quantity)
138				total += purchaseTotal.discountsApplied[i].amount * quantity;
139		}
140		else if(purchaseTotal.discountsApplied[i].type == 'percent') //percent
141			total += (100 - purchaseTotal.discountsApplied[i].amount) / 100;
142		else if(purchaseTotal.discountsApplied[i].type == 'total') //total
143			total += purchaseTotal.discountsApplied[i].amount;
144	}
145
146	 purchaseTotal.discountAmountTotal = total;
147	 //console.log(purchaseTotal.discountAmountTotal);
148
149/*	if(purchaseTotal.discountEligible.length == 0 || purchaseTotal.portalType.indexOf(purchaseTotal.discountEligible))
150	{
151		if(purchaseTotal.discountType == 'item' && purchaseTotal.discountItem) //specific item
152		{
153			var quantity = purchaseTotal.getQuantity(purchaseTotal.discountItem);
154
155			if(quantity)
156				purchaseTotal.discountAmountTotal = purchaseTotal.discountAmount * quantity;
157			else
158				purchaseTotal.discountAmountTotal = 0;
159		}
160		else if(purchaseTotal.discountType == 'percent') //percent
161			purchaseTotal.discountAmountTotal = (100 - purchaseTotal.discountAmount) / 100;
162		else if(purchaseTotal.discountType == 'total') //total
163			purchaseTotal.discountAmountTotal = purchaseTotal.discountAmount;
164		else
165			purchaseTotal.discountAmountTotal = 0;
166	}*/
167}
168
169purchaseTotal.updateDiscountsApplied = function()
170{
171	/**
172	* - Reset purchaseTotal.discountsApplied
173	* - Itinerate through automatically applied discounts
174	* - Evaluate applied discount
175	*/
176
177	var j = 0; //index for purchaseTotal.discountsApplied
178	purchaseTotal.discountsApplied = [];
179	console.log(purchaseTotal.discountsAutoApply);
180	for(var i=0, len=purchaseTotal.discountsAutoApply.length; i<len; i++)
181		if(purchaseTotal.eligibleForDiscount(purchaseTotal.discountsAutoApply[i].eligible))
182		{
183			//console.log('adding');
184			//console.log(purchaseTotal.discountsAutoApply[i]);
185			purchaseTotal.discountsApplied[j] = purchaseTotal.discountsAutoApply[i];
186			//console.log(purchaseTotal.discountsApplied[j]);
187			j++;
188		}
189
190	if(purchaseTotal.discount.amount && purchaseTotal.discount.autoApply == 0 && purchaseTotal.eligibleForDiscount(purchaseTotal.discount.eligible))
191		purchaseTotal.discountsApplied[j] = purchaseTotal.discount;
192
193	//console.log(purchaseTotal.discountsApplied);
194}
195
196purchaseTotal.getQuantity = function(fiid)
197{
198	//get quantity of specific item
199	var quantity = document.getElementById('quantityInput' + fiid);
200
201	if(typeof(quantity) != 'undefined')
202		return quantity.value;
203
204	return null;
205}
206
207purchaseTotal.getDiscount = function()
208{
209	var request = $.post(ajaxRouter, {code:document.getElementById('discountInput').value, file:'forms/forms.php', salt:document.getElementById('discountSalt').value}); //send request
210
211	request.done(function(vars) //evaluate request
212	{
213		//console.log(vars);
214		if(vars = vars.parseStr())
215		{
216		//console.log(vars);
217			purchaseTotal.discount.amount = typeof(vars.amount) == 'undefined' ? 0 : Number(vars.amount);
218			purchaseTotal.discount.autoApply = typeof(vars.autoApply) == 'undefined' ? 0 : Number(vars.autoApply);
219			purchaseTotal.discount.description = typeof(vars.description) == 'undefined' ? '' : vars.description;
220			purchaseTotal.discount.eligible = typeof(vars.eligible) == 'undefined' ? [] : vars.eligible.split('|');
221			purchaseTotal.discount.item = typeof(vars.item) == 'undefined' ? null : Number(vars.item);
222			purchaseTotal.discount.type = typeof(vars.type) == 'undefined' ? null : vars.type;
223
224			purchaseTotal.updateDiscountsApplied();
225			purchaseTotal.updateDiscountAmountTotal();
226			purchaseTotal.updateDiscountAmountDisplay();
227			purchaseTotal.updateTotal();
228		}
229	});
230}
231
232purchaseTotal.getDiscounts = function() //gets discounts that should automatically be applied
233{
234	/**
235	* Gets all discounts that should automatically be applied
236	* - Request returns an array of all discount information
237	* - All informatio is stored in purchaseTotal.discountsAutoApply
238	*/
239
240	if(document.getElementById('discountSalt') == null)
241	{
242		purchaseTotal.updateTotal();
243	}
244	else
245	{
246		var request = $.post(ajaxRouter, {code:null, file:'forms/forms.php', salt:document.getElementById('discountSalt').value}); //send request
247
248		request.done(function(vars) //evaluate request
249		{
250			//console.log(vars);
251			if(vars = vars.parseStr())
252			{
253				//console.log('vars');
254				//console.log(vars);
255				if(typeof(vars.amount) != 'undefined')
256					for(var i=0, len=vars.amount.length; i<len; i++)
257					{
258						//console.log('amount' + vars.amount[i]);
259						purchaseTotal.discountsAutoApply[i] =
260						{
261							amount:vars.amount[i],
262							description:vars.description[i],
263							eligible:vars.eligible[i].split('|'),
264							item:vars.item[i],
265							type:vars.type[i]
266						};
267					}
268
269				purchaseTotal.updateDiscountsApplied();
270				purchaseTotal.updateDiscountAmountTotal();
271				purchaseTotal.updateDiscountAmountDisplay();
272				purchaseTotal.updateTotal();
273				console.log('auto');
274				purchaseTotal.updateJoinDiscountInformation();
275			}
276		});
277	}
278}
279
280purchaseTotal.updateJoinDiscountInformation = function()
281{
282	/**
283	* Checks if membership is required or if a memberhsip discount is available an words message accordingly
284	*/
285
286	var joinDiscount = null;
287
288	//check if applicant is an eligible member
289	if((joinDiscount = document.getElementById('joinDiscount')) != null)
290	{
291		var membership = purchaseTotal.getCheapestMembership(purchaseTotal.updateJoinDiscountInformation);
292
293		if(membership) //get cheapest membership option
294		{
295			var discount = purchaseTotal.getMembershipDiscountAmount(membership.id); //check for membership discount
296
297			if(membership)
298				joinDiscount.innerHTML = 'Join for one year for only $' + membership.cost + (discount ? ' and save $' + discount + ' on this event!' : '.'); //add message to form
299		}
300	}
301}
302
303purchaseTotal.getCheapestMembership = function(callback)
304{
305	if(purchaseTotal.cheapestMembership.cost == null)
306	{
307		if(purchaseTotal.membership[0].cost == null)
308		{
309			purchaseTotal.setMembership(callback);
310			return false; //have to wait for information
311		}
312
313		var cheapest = {cost:1000000, id:null}; //set to an unreasonable cost
314
315		for(var i=0, len=purchaseTotal.membership.length; i<len; i++)
316			if(purchaseTotal.membership[i].cost > 0 && purchaseTotal.membership[i].cost < cheapest.cost)
317				cheapest =
318				{
319					cost:purchaseTotal.membership[i].cost,
320					id:purchaseTotal.membership[i].id,
321					type:purchaseTotal.membership[i].type
322				};
323
324		purchaseTotal.cheapestMembership = cheapest;
325	}
326
327	return purchaseTotal.cheapestMembership;
328}
329
330purchaseTotal.setMembership = function(callback)
331{
332	purchaseTotal.membershipRequestCallbackQue[purchaseTotal.membershipRequestCallbackQue.length] = callback;
333
334	if(!purchaseTotal.membershipRequestSent)
335	{
336		purchaseTotal.membershipRequestSent = true;
337
338		var request = $.post(ajaxRouter, {action:'getPortalUserTypesInformation', file:'modules/portal/portalAjax.php'}); //send request
339
340		request.done(function(vars) //evaluate request
341		{
342			console.log(vars);
343			if(vars = vars.parseStr())
344			{
345				//console.log('vars');
346				//console.log(vars);
347				if(typeof(vars.type) != 'undefined')
348					for(var i=0, len=vars.type.length; i<len; i++)
349					{
350						purchaseTotal.membership[i] =
351						{
352							cost:vars.cost[i],
353							id:vars.putid[i],
354							type:vars.type[i]
355						};
356					}
357
358				console.log(purchaseTotal.membership);
359
360				for(var i=0, len=purchaseTotal.membershipRequestCallbackQue.length; i<len; i++)
361					purchaseTotal.membershipRequestCallbackQue[i]();
362			}
363		});
364	}
365}
366
367purchaseTotal.getMembershipDiscountAmount = function(id)
368{
369		console.log(purchaseTotal.discountsAutoApply);
370	for(i=0, len=purchaseTotal.discountsAutoApply.length; i<len; i++)
371	{
372		if((purchaseTotal.discountsAutoApply[i].eligible.indexOf(id) + 1))
373			return purchaseTotal.discountsAutoApply[i].amount;
374	}
375
376	return false;
377}
378
379purchaseTotal.updateJoinValue = function()
380{
381	var _join, cheapest;
382
383	if((_join = document.getElementById('_' + purchaseTotal.unique + '_portal_join')) != null && (cheapest = purchaseTotal.getCheapestMembership(purchaseTotal.updateJoinValue)))
384	{
385		_join.value = cheapest.id;
386		console.log(_join.value);
387	}
388
389	return false
390}
391
392purchaseTotal.addItem = function(item)
393{
394	var field = document.createElement('div');
395	field.className = 'formField';
396	field.id = 'formField' + item.id;
397	field.innerHTML = '\
398				<span><label for="_teslarace20170405150839_tshirtsmall_teslarace20170405150839">' + item.description + '</label></span><span class="costSpan"> \
399					<span class="costFlex"> \
400						<span class="cost" id="cost' + item.id + '">$' + item.amount + '</span> \
401						<span class="operator">x</span> \
402						<span class="quantity"><input class="size4 quantityInput" id="quantityInput' + item.id + '" name="quantity[]" type="text" value="' + item.quantity + '"' + (item.readonly ? ' readonly="readonly"' : '') + '><input name="eritid[]" type="hidden" value="' + item.id + '"></span> \
403						<span class="operator">=</span> \
404						<span class="subtotal">$<span class="subtotalInput" id="subtotal' + item.id + '">' + (item.amount * item.quantity).toFixed(2) + '</span></span></span></span>';
405
406	document.getElementById('formItems').appendChild(field);
407	//$('.costSpan')
408}
409
410purchaseTotal.removeItem = function(item)
411{
412	var field = document.getElementById('formField' + item.id);
413
414	if(field != null)
415	  field.parentNode.removeChild(field);
416}
417
418purchaseTotal.submitEnableToggle = function(flag, value)
419{
420	if(typeof(flag) != 'undefined')
421		purchaseTotal.submitEnableFlags[flag] = value;
422
423	for(var key in purchaseTotal.submitEnableFlags)
424		if(!purchaseTotal.submitEnableFlags[key])
425		{
426			$('#' + purchaseTotal.form + ' [type=submit]').prop('disabled', true);
427			return false;
428		}
429
430	$('#' + purchaseTotal.form + ' [type=submit]').prop('disabled', false);
431	return true;
432}
433
434quantityAutoIncrement = function()
435{
436	$('.item').each(function()
437	{
438		if(this.type == 'text')
439			$(this).on('blur', quantityUpdate);
440		else if(this.type == 'checkbox')
441			$(this).change(quantityUpdate);
442	});
443
444	$('.costRemove').on('mousedown', quantityUpdateAll);
445
446	quantityUpdateAll();
447}
448
449quantityUpdate = function()
450{
451	/**
452	* - Get class name
453	* - Find which item this affects
454	* - Get all elements that increment this item
455	* - Sum those elements that are not empty
456	* - Update remaining quantity
457	* - Write sum to item quantity
458	* -- Quantity will be recalculated after form submission to prevent tampering
459	* - Update purchase totals
460	*/
461
462	var classes = this.className.split(' ');
463
464	for(i=0, len=classes.length; i<len; i++)
465		if(classes[i].match(/^item(\d+)/))
466		{
467			var itemId = classes[i].replace(/[\D]/g, '');
468			var quantity = 0;
469
470			$('.' + classes[i]).each(function()
471			{
472				if((this.type == 'text' && this.value.replace(/\s/g,'').length) || (this.type == 'checkbox' && this.checked))
473					quantity++;
474			});
475
476			items.remaining.update(itemId, quantity);
477			document.getElementById('quantityDisplay' + itemId).innerHTML = document.getElementById('quantityInput' + itemId).value = quantity;
478
479			document.getElementById('subtotal' + itemId).innerHTML = (quantity * document.getElementById('cost' + itemId).innerHTML.replace(/[^\d\.]/g, '')).toFixed(2);
480
481			purchaseTotal.updateDiscountsApplied();
482			purchaseTotal.updateDiscountAmountTotal();
483			purchaseTotal.updateDiscountAmountDisplay();
484			purchaseTotal.updateTotal();
485		}
486
487}
488
489quantityUpdateAll = function()
490{
491	$('.item').each(function()
492	{
493		if(this.type == 'text')
494			$(this).trigger('blur');
495		else if(this.type == 'checkbox')
496			$(this).trigger('change');
497	});
498}
499
500visitor.getType = function()
501{
502	var request = $.post(ajaxRouter, {action:'getVisitorType', file:'forms/forms.php'}); //send request
503
504	request.done(function(vars) //evaluate request
505	{
506		console.log(vars);
507		if(vars = vars.parseStr())
508		{
509			if(typeof(vars.type) != 'undefined')
510				visitor.type = vars.type;
511		}
512
513		purchaseTotal.getDiscounts(); //get discounts that should automatically be applied; must be here else it may be done before visitor type is fetched
514	});
515}
516
517var items = {remaining: {}};
518
519items.remaining.set = function() //sets javascript varibles to keep track of remaining items
520{
521	items.remainingList = [];
522
523	$('.itemsRemaining').each(function()
524	{
525		var classes = this.className.split(' ');
526
527		for(i=0, len=classes.length; i<len; i++)
528			if(classes[i].match(/^itemsRemaining(\d+)/))
529			{
530				items.remainingList[classes[i].replace(/[\D]/g, '')] = this.innerHTML.replace(/[\D]/g, '');
531
532				if(this.innerHTML.replace(/[\D]/g, '') > 0)
533				  items.enable(classes[i].replace(/[\D]/g, ''));
534				else
535				  items.disable(classes[i].replace(/[\D]/g, ''));
536
537			}
538	});
539}
540
541items.remaining.update = function(itemId, quantity) //updates the number of remaining items
542{
543	if(typeof(items.remainingList[itemId]) != 'undefined')
544	{
545		//need to determine whether to increment or decrement
546		var remaining = items.remainingList[itemId] - quantity;
547
548		if(remaining > 0)
549		{
550			$('.itemsRemaining' + itemId).html('Only ' + remaining + ' Remaining');
551			items.enable(itemId);
552			//console.log('not sold');
553		}
554		else
555		{
556			$('.itemsRemaining' + itemId).html('Sold Out');
557			items.disable(itemId);
558			//console.log('sold');
559		}
560	}
561}
562
563items.disable = function(itemId) //disable a form field that auto increments
564{
565	//console.log('here');
566	$('.item' + itemId).prop('disabled', true);
567}
568
569items.enable = function(itemId) //enable a form field that auto increments
570{
571	$('.item' + itemId).prop('disabled', false);
572}
573
574loginSuccessful = function(user)
575{
576	visitor.type = user.type;
577	document.getElementById('joinLoginFields').style.display = 'none';
578	purchaseTotal.updateDiscountsApplied();
579	purchaseTotal.updateDiscountAmountTotal();
580	purchaseTotal.updateDiscountAmountDisplay();
581	purchaseTotal.updateTotal();
582	$.colorbox.close();
583}
584
585$(document).ready(function()
586{
587  if(document.getElementById('formUnique') != null)
588  	purchaseTotal.unique = document.getElementById('formUnique').value;
589
590	//for login
591	if(document.getElementById('portalUserLogin') != null)
592		document.getElementById('portalUserLogin').href = '/red/modules/portal/userLoginForm.php';
593
594	$('#portalUserLogin').colorbox({
595		closeButton: true,
596		fixed:true,
597		height:'300px',
598		width:($(window).width() > 400 ? '400px' :  '100%'),
599		iframe:true,
600		overlayClose:false
601	});
602
603	//for uploading images
604	$('.imageUploadCrop').colorbox({
605		closeButton: true,
606		height: $(window).height()*.75,
607		width: $(window).width()*.75,
608		iframe:true,
609		overlayClose:false,
610		onClosed:function()
611		{
612			//console.log(window);
613			//console.log(imageUploadCropUnique);
614			if(typeof imageUploadCropUrl != 'undefined')
615			{
616				if(document.getElementById('imagePreview' + imageUploadCropUnique) != null)
617					document.getElementById('imagePreview' + imageUploadCropUnique).src = '/' + imageUploadCropUrl;
618				else //add element
619				{
620					$('#imageUploadCrop' + imageUploadCropUnique).before($('<img />').attr(
621					{
622						class:'imagePreview',
623						id:'imagePreview' + imageUploadCropUnique,
624						src:'/' + imageUploadCropUrl
625					}));
626
627					$('#imageUploadCrop' + imageUploadCropUnique).html('Change Image');
628				}
629
630				document.getElementById('image' + imageUploadCropUnique).value = imageUploadCropUrl;
631				imageUploadCropUrl = undefined;
632				imageUploadCropUnique = undefined;
633			}
634		}
635	});
636
637	//for portal
638	if(document.getElementsByClassName('costSpan').length)
639	{
640		purchaseTotal.form = document.getElementById('formUnique').value;
641
642		purchaseTotal.submitEnableToggle; // $('#' + purchaseTotal.form + ' [type=submit]').prop('disabled', true);
643		$('#' + purchaseTotal.form + ' #_' + purchaseTotal.form + '_portal_join').on('change', function()
644		{
645			//console.log(purchaseTotal.form + 'non' + this.checked);
646			if(this.checked)
647			{
648				purchaseTotal.addItem(
649				{
650					amount:purchaseTotal.getCheapestMembership().cost,
651					description:purchaseTotal.getCheapestMembership().type + ' Fee',
652					name:'',
653					quantity:1,
654					readonly:true,
655					id:'membershipFee',
656				}); //add mebership fee
657
658				visitor.typeSave = visitor.type; //remember old type
659				visitor.type = purchaseTotal.getCheapestMembership().id; //set new type
660				purchaseTotal.submitEnableToggle('portal', true);
661			}
662			else
663			{
664				purchaseTotal.removeItem(
665				{
666					id:'membershipFee',
667				}); //remove mebership fee
668
669				visitor.type = visitor.typeSave; //restore old type
670				purchaseTotal.submitEnableToggle('portal', false);
671			}
672
673			//update form
674			purchaseTotal.updateDiscountsApplied();
675			purchaseTotal.updateDiscountAmountTotal();
676			purchaseTotal.updateDiscountAmountDisplay();
677			purchaseTotal.updateTotal();
678		});
679
680
681		$('.quantityInput').on('blur', function()
682		{
683			var id = this.id.replace('quantityInput','');
684
685			document.getElementById('subtotal' + id).innerHTML = (Number(this.value.replace(/[^\d\.]/g, '')).toFixed() * document.getElementById('cost' + id).innerHTML.replace(/[^\d\.]/g, '')).toFixed(2);
686
687			purchaseTotal.updateDiscountsApplied();
688			purchaseTotal.updateDiscountAmountTotal();
689			purchaseTotal.updateDiscountAmountDisplay();
690			purchaseTotal.updateTotal();
691		});
692
693		$('#discountButton').on('click', function()
694		{
695			purchaseTotal.getDiscount();
696		});
697	}
698
699	//set submit flags
700	if(document.getElementById('cardNumber') != null)
701		purchaseTotal.submitEnableFlags.payment = false;
702
703	if(document.getElementById('portalUserTypes') != null)
704		purchaseTotal.submitEnableFlags.portal = false;
705
706	//initialize
707	if(true)
708	{
709		//visitor.getType();
710		//items.remaining.set();
711		quantityAutoIncrement(); //must come after items are set
712		//purchaseTotal.updateJoinValue();
713		console.log('loaded');
714	}
715});

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.