PageSourceSearch

https://kar.myamericanalliance.com/script/custom.js

js myamericanalliance.com collected 2026-10-08 15:57:37 UTC 8,576 bytes, 218 lines download raw bytes

1var GlobalScript = {
2	Origin: "External"
3
4	,
5	paramString: '',
6	closeRedirect: '',
7	OnLoad: function() {
8		//add crumple to GQ_ vrms
9		AddrSuggestions.Initialize({showSuggestions: false, validateSelected: false}); 
10		
11		var vrmName = $('div#middle').attr('vrmname');
12		if(vrmName.substr(0,2) == 'GQ'){
13		 $('input[id="Continue"],input[id="Back"],input[id="Exit"],input[id="WorkSheet"],input[id="Save"],input[id="AddLNAI"],input[id="Cancel"],input[id="ShowAll"],input[id="NewSearch"]').addClass('GQ_navbutton');
14		 $('#rightColumn').addClass('crumple');
15		 $('div.StaticContainer:not(.borderless),div.DynamicContainer:not(.borderless)').addClass('GQ_container');
16		 $('div.StaticContainer,div.DynamicContainer').find('H3').addClass('GQ_header');
17		 $('input[type="button"]').addClass('GQ_button');
18		}
19		//word wrap any appropriate TableMasters
20		$('.sHeaderInner td[wrap=1]').each(function() {
21		var Wrapper = $(this).parent().parent().parent().parent().parent().parent().parent();
22
23		//get Properties for each column
24		var child = 0;
25		var properties = new Array();
26		var width, colWidth;
27		 $(Wrapper).find('.sHeaderInner thead td').each(function() {
28		  child++;
29		  properties[child] = new Array();
30		  
31		  width = parseFloat($(this).attr('width')) / 100;
32		  //subtract 14 from sData.width to take care of the scroll bar
33		  colWidth  = width * ($('.sData').width()-14);
34		  properties[child]['width'] = colWidth;
35		  properties[child]['wrap'] = ($(this).attr('wrap') == 1);
36		 });
37
38		 // resize table and word wrap appropriate cells
39		 // placing this in a separate loop so in the future it can handle cols with undefined widths
40		 for (child in properties) {
41		  $(Wrapper).find('.sHeaderInner col:nth-child('+child+')').attr('width',properties[child].width);
42		  $(Wrapper).find('.sData col:nth-child('+child+')').attr('width',properties[child].width);
43		  if (properties[child].wrap) $(Wrapper).find('.sData tr td:nth-child('+child+')').css('white-space','normal');
44		 }
45		 
46		 //word wrapping resized the table - take care of that...
47		 var height = 0;
48		 $(Wrapper).find('.sData tr').each(function() {height+= $(this).height()});
49		 if (height > 210) height = 210;
50		 var TableHeight = height + 18;
51		 $(Wrapper).find('.sData').height(height);
52		 $(Wrapper).height(TableHeight);
53
54		}); 
55		
56		if(typeof String.prototype.trim !== 'function') {
57		  String.prototype.trim = function() {
58			return this.replace(/^\s+|\s+$/g, ''); 
59		  }
60		}
61	},
62	
63	ShowDialog: function (d_title,d_msg,d_width,d_height)
64		{
65			$("#dialog_div").remove();
66			var dialog_html="";
67			dialog_html=dialog_html+'<div id="dialog_div" style="display: block; position: absolute; overflow:hidden;z-index: 1106; outline: 0px; top: 275px; left: 670px;" class="ui-dialog ui-widget ui-widget-content ui-corner-all  ui-draggable ui-resizable" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-ModalWindow">';
68			dialog_html=dialog_html+'	<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix draggable-handle" unselectable="on" style="-webkit-user-select: none;">';
69			dialog_html=dialog_html+'		<span class="ui-dialog-title" id="dialog_title" unselectable="on" style="-webkit-user-select: none;">Title</span>';
70			dialog_html=dialog_html+'		<a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button" unselectable="on" style="-webkit-user-select: none;">';
71			dialog_html=dialog_html+'		<span class="ui-icon ui-icon-closethick" unselectable="on" style="-webkit-user-select: none;">close</span></a>';
72			dialog_html=dialog_html+'	</div>';
73			dialog_html=dialog_html+'	<div id="dialog_content" class="flora ui-dialog-content ui-widget-content" style="text-align:left;height: 100%; width: auto;" dialoginit="true">';
74			dialog_html=dialog_html+'	</div>';
75			dialog_html=dialog_html+'</div>';
76			
77			var dialog=$(dialog_html);
78			$("a",dialog).click(function(){$("#dialog_div").remove();});
79			$("#dialog_title",dialog).html(d_title);
80			$("#dialog_content",dialog).html(d_msg);	
81			$("body").append(dialog);
82			$("#dialog_div").css({width:d_width+"px",height:d_height+"px"});
83			$("#dialog_div").draggable({handle:'.draggable-handle'});	
84			
85		}
86	,
87	HideDialog: function()
88		{
89			$("#dialog_div").remove();
90		}
91	,
92	ModalUploadWindow: function(UploadParams,closeRedirect)
93	{
94		var paramString='';
95		if (closeRedirect) GlobalScript.closeRedirect = closeRedirect;
96		else GlobalScript.closeRedirect = '';
97		if (typeof(UploadParams)=='object') {
98			$.each(UploadParams,function(param,val){
99				paramString += param + '=' + val + '&';
100			});
101		} else paramString = UploadParams;
102		if (GlobalScript.paramString == paramString) {
103			$('#modalUpload').dialog('open');
104		} else {
105			$('#modalUpload').remove();
106			GlobalScript.paramString = paramString;
107			Communication.CustomRequest('ajax.max?AJAX_ACTION=ModalUpload', function(resp) {
108				var top = $('body').scrollTop();
109				var upl = $('<div id="modalUpload" style="text-align: left; overflow: hidden;" />').append(resp);
110				upl.dialog({
111					modal: true, 
112					width: 520,
113					height: 620,
114					resizable: false,
115					closeOnEscape : true,
116					title : "Add Attachment",
117					close : function (){ 
118						upl.find('#UPL_TITLE_CONTENT').val('').change();
119						upl.find('#DIV_Progress').hide();
120						upl.find('#DIV_Upload').hide();
121						upl.find('#DIV_Main').show();
122						upl.find('#DIV_RESULT').hide();
123					}
124				});
125			});
126		}
127	},
128	
129	ZP4_Validation: function(cls, cb) {
130		if (cb === undefined) cb = function(error,CorrectAddress,RespCounty) {};
131		var AddressFields = {
132			Address1	: $('.' + cls + '.Address1'),
133			City		: $('.' + cls + '.City'),
134			State		: $('.' + cls + '.State'),
135			Zip			: $('.' + cls + '.Zip'),
136			County		: $('.' + cls + '.County')
137		}
138		
139		var ReqParams = $.param({
140			'AJAX_ACTION'	: 'GetZP4Ex',
141			'Address_IN'	: AddressFields.Address1.val(),
142			'City_IN'		: AddressFields.City.val(),
143			'State_IN'		: AddressFields.State.val(),
144			'Zip_IN'		: AddressFields.Zip.val(),
145		});
146		
147		var SetAddrFields = function(Address) {
148			AddressFields.Address1.val(Address.A);
149			AddressFields.City.val(Address.C);
150			AddressFields.State.val(Address.S);
151			AddressFields.Zip.val(Address.Z);
152			AddressFields.County.val(Address.CN);
153		};
154		
155		Communication.CustomRequest('zp4sugestion.max?' + ReqParams, function(AjaxResp) {
156			var jsonResp = JSON.parse(AjaxResp);
157			var Addr = jsonResp.Addr;
158			if (jsonResp.Valid=="1")
159			{
160				SetAddrFields(Addr[0]);
161				cb('',1,Addr[0].CN);
162			}
163			else if (jsonResp.SugCnt!="0") {
164			
165				var html = '';
166				html += '<p>Please select one of the following addresses or change your entered address manually:</p>';
167				html += '<div class="suggestions"></div>';
168				html += '<p><button class="manual-entry">Change Address Manually</button></p>';
169				
170				var $dialog = $('<div/>').addClass('address-suggestion-dialog').html(html);
171				var $suggestions = $dialog.find('.suggestions');
172				var $manualEntryButton = $dialog.find('.manual-entry');
173					
174				
175				$.each(Addr, function(index,data){
176					var suggestion = $('<address/>').addClass('suggestion').data('suggestion-data',data).html('');
177					suggestion.append((data.A)).append('<br />')
178						.append((data.C)).append(', ').append((data.S)).append(' ').append((data.Z)).append('<br />').append((data.CN));
179					$suggestions.append(suggestion);
180				});
181				var keepData = {"A":AddressFields.Address1.val(),
182				"C":AddressFields.City.val(),
183				"S":AddressFields.State.val(),
184				"Z":AddressFields.Zip.val(),
185				"CN":AddressFields.County.val()
186				}
187
188				var keepIt = $('<address/>').addClass('suggestion').data('suggestion-data',keepData).html('');
189				keepIt.append('Keep Current').append('<br />').append('Address').css('text-align','center');
190				$suggestions.append(keepIt);
191				
192				$($suggestions).find('.suggestion').click(function() {
193					$dialog.dialog('destroy');
194					var Addr = $(this).data('suggestion-data');
195					var Current = 1;
196					SetAddrFields(Addr);
197					if ($(this).text()=='Keep CurrentAddress') Current=2;
198					cb('',Current,Addr.CN);
199				});
200				
201				$manualEntryButton.click(function() {
202						$dialog.dialog('destroy');
203						cb('',0,Addr.CN);
204				});
205					
206				$dialog.dialog({
207					title : 'Address Suggestions',
208					autoOpen : true,
209					width : 420
210				});
211			}
212			else {
213				cb('Invalid Address.');
214				AddressFields.Zip.focus();
215			}
216		});
217	}
218};

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.