PageSourceSearch

https://decaturrealestategroup.com/autochatlib.js

js decaturrealestategroup.com collected 2026-09-28 18:39:54 UTC 43,844 bytes, 1,122 lines download raw bytes

1/*
2Copyright 2022 Profile Your City, Inc.
3*/
4
5function hideChatIf(x) {
6  if (x.matches) { // If media query matches
7	  console.log('hideChatIf:true');
8	  return true;
9  }
10}
11
12function LeadingZero(s,max) {
13	
14	s = s.toString();
15	//console.log('s:'+s);
16	//console.log('max:'+max);
17	//console.log('s.length:'+s.length);
18    var z = max - s.length + 1;
19	//console.log('z:'+z);
20	//alert('s:' + s + 'z:'+ z);
21    z = z>1 ? Array(z).join('0') : '';
22    return (z + s);     
23}
24
25function MysqlDateNow() {
26	
27	var since= new Date();
28	var now_date = since.getFullYear() + '-' + LeadingZero(since.getMonth()+1,2) + '-' + LeadingZero(since.getDate(),2)+' '+ LeadingZero(since.getHours(),2)+':'+LeadingZero(since.getMinutes(),2)+':'+LeadingZero(since.getSeconds(),2);
29	//console.log("modified:: " + now_date);
30	
31	return now_date;
32	
33}
34 
35function aChatCondition(current_name,condition_type) {
36
37if (typeof condition_type !== 'undefined') {
38	
39//console.log("current_name:: " + current_name);
40//console.log("condition_type:: " + condition_type);
41
42var chatCondition = { };
43var chatConditionOut = [];
44
45//HANDLE CONDITIONS
46if (condition_type.match(/:/gmi)) { //complex
47	ct_arr = condition_type.split(":");
48
49	if (typeof ct_arr !== 'undefined' && Array.isArray(ct_arr) && typeof ct_arr[0] !== 'undefined' && typeof ct_arr[1] !== 'undefined') {
50		ct = ct_arr[0];
51		crules = ct_arr[1];
52	} else {
53		ct = condition_type.toLowerCase();;
54	}
55
56} else { //simple
57	ct = condition_type.toLowerCase();;
58}
59
60//console.log("ct829:: " + ct);
61
62if (ct != null && ct != '') {
63
64ctvitem = localStorage.getItem(ct);
65
66if(ctvitem != null) {
67   ctv = ctvitem.toLowerCase();
68  
69//console.log("ctvitem.toLowerCase:: " + ctv);
70
71cr_arr =crules.split("|");
72//console.table(cr_arr);
73
74condition_met = true;
75
76   	if (Array.isArray(cr_arr)) {
77   		cr_arr.forEach((ca) => {
78			cav = ca.toLowerCase();
79   			if (ctv == cav) {
80   				condition_met = false;
81   			} 
82   		});
83		localStorage.setItem(current_name + '_skip',condition_met);
84		//console.log('853:' + current_name + '_skip, '+  condition_met  + ', ctv: '+  ctv + ', cav: '+  cav);
85   } else {
86	//console.log("ct855:: " + ct);
87	if (ctv == ct) {
88		condition_met = false;
89	} 
90	localStorage.setItem(current_name + '_skip',condition_met);
91	//console.log('860:' + current_name + '_skip, '+  condition_met + ', ctv: '+  ctv + ', ct: '+  ct);
92	
93   }
94
95
96}
97
98
99}
100
101} else {
102localStorage.setItem(current_name + '_skip',false);
103//console.log('872:' + current_name + '_skip, false');
104}
105
106
107} //func
108
109function aChatValid(input,validation_type) {
110
111var input = input.toLowerCase();
112var chatValidation = { };
113var chatValidationOut = [];
114
115//return true if no validation
116if (validation_type == 'none') {
117
118//console.log(input + ' No validation required!');
119
120chatValidation["isvalid"] = true;
121chatValidation["message"] = input;
122chatValidationOut.push(chatValidation);
123
124return chatValidationOut;
125}
126
127//HANDLE COMPLEX VALIDATION
128if (validation_type.match(/:/gmi)) { //complex
129//console.log('complex:' + input + ' ' + validation_type);
130vt_arr = validation_type.split(":");
131
132if (typeof vt_arr !== 'undefined' && Array.isArray(vt_arr) && typeof vt_arr[0] !== 'undefined' && typeof vt_arr[1] !== 'undefined') {
133	vt = vt_arr[0];
134	vrules = vt_arr[1];
135	//console.log('vt:' + vt + ' vrules:' + vrules);
136} else {
137	vt = validation_type;
138	//console.log('simplex vt:' + vt);
139}
140
141} else { //simple
142vt = validation_type;
143//console.log('simple:' + input + ' ' + validation_type);
144//console.log('simple vt:' + vt);
145}
146
147//VALIDATION RULES
148if (vt == 'notempty') {
149if(typeof input !== 'undefined' && input != '') {
150	//console.log(input + ' Yes! Response is not empty!');
151	chatValidation["isvalid"] = true;
152	chatValidation["message"] = input;
153	chatValidationOut.push(chatValidation);
154} else {
155	//console.log(input + ' Your reply can not be empty.');
156	chatValidation["isvalid"] = false;
157	chatValidation["message"] = '🤔 Your reply can not be empty.';
158	chatValidationOut.push(chatValidation);
159}
160}
161if (vt == 'yesno') {
162if (aYesOrNoValid(input)) {
163	//console.log(input + ' Response is OK!');
164	chatValidation["isvalid"] = true;
165	chatValidation["message"] = input;
166	chatValidationOut.push(chatValidation);
167} else {
168	//console.log(input + 'Please answer Yes or No. You can also reply Y or N.');
169	chatValidation["isvalid"] = false;
170	chatValidation["message"] = '🤔 Please answer Yes or No. You can also reply Y or N.';
171	chatValidationOut.push(chatValidation);
172}
173}
174if (vt == 'email') {
175if (input.match(/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/g)) {
176	//console.log(input + ' Email looks valid!');
177	chatValidation["isvalid"] = true;
178	chatValidation["message"] = input;
179	chatValidationOut.push(chatValidation);
180} else {
181	//console.log(input + ' Does not look like a valid email!');
182	chatValidation["isvalid"] = false;
183	chatValidation["message"] = '🤔 That does not look like an email address. Try again:';
184	chatValidationOut.push(chatValidation);
185}
186}
187if (vt == 'numeric') {
188
189input = aChatNumbers(input);
190
191if (typeof input !== 'undefined' && input != '' && input.match(/\d/g)) {
192	chatValidation["isvalid"] = true;
193	chatValidation["message"] = input;
194	chatValidationOut.push(chatValidation);
195	//console.log(input + ' response numeric and valid!');
196} else {
197	chatValidation["isvalid"] = false;
198	chatValidation["message"] = '🤔 That does not look like a number.  Try again:';
199	chatValidationOut.push(chatValidation);
200	//console.log(input + ' - Your reply should be numbers.');
201}
202}
203if (vt == 'limit') {
204
205vr_arr =vrules.split("|");
206
207rule_valid = false;
208if (Array.isArray(vr_arr)) {
209
210	vr_arr.forEach((va) => {
211		if (input == va) {
212			rule_valid = true;
213		}
214	});
215
216	if (rule_valid && typeof input !== 'undefined' && input != '') {
217		chatValidation["isvalid"] = true;
218		chatValidation["message"] = input;
219		chatValidationOut.push(chatValidation);
220		//console.log(input + ' response is valid!');
221	} else {
222		chatValidation["isvalid"] = false;
223		chatValidation["message"] = '🤔 Something you entered did not match. Your reply must be one of the following: '+ vr_arr.join(", ");
224		chatValidationOut.push(chatValidation);
225		//console.log(input + ' response is NOT valid! ' + 'Your reply must be one of the following: '+ vr_arr.join(", "));
226	}
227
228
229} else {
230	if (typeof input !== 'undefined' && input != '') {
231		chatValidation["isvalid"] = true;
232		chatValidation["message"] = input;
233		chatValidationOut.push(chatValidation);
234		//console.log('tbd');
235	} else {			
236		chatValidation["isvalid"] = false;
237		chatValidation["message"] = '🤔 Your reply should not be empty.';
238		chatValidationOut.push(chatValidation);
239		//console.log('Your reply should not be empty.');
240	}
241}
242}
243
244return chatValidationOut;
245
246}
247
248 function saveChoices (name) {
249	 
250 	$('#'+ida+'chatmessage').val(toProperCase($('#' + name + '').val()));
251	document.getElementById(ida+'chatsubmit').click();
252	
253 }
254
255 function skipChoices () {
256 	$('#'+ida+'chatmessage').val('');
257	document.getElementById(ida+'chatsubmit').click();	
258 }
259
260 function buildMultiSelectCity() {
261	 console.log('buildMultiSelectCity');
262
263	 out = 'Type or Choose then click Save Choices:<br><select id=\"city\" class=\"form-control\" multiple=\"multiple\" size=\"5\" style=\"height:auto !important;\" name=\"city[]\" title=\"city[]\"><option value=\"\" selected=\"selected\"></option><option value=\"Alachua\">Alachua</option><option value=\"Altamonte Springs\">Altamonte Springs</option><option value=\"Alva\">Alva</option><option value=\"Anna Maria\">Anna Maria</option><option value=\"Anthony\">Anthony</option><option value=\"Apollo Beach\">Apollo Beach</option><option value=\"Apopka\">Apopka</option><option value=\"Arcadia\">Arcadia</option><option value=\"Ave Maria\">Ave Maria</option><option value=\"Aventura\">Aventura</option><option value=\"Avon Park\">Avon Park</option><option value=\"Babcock Ranch\">Babcock Ranch</option><option value=\"Bartow\">Bartow</option><option value=\"Belle Glade\">Belle Glade</option><option value=\"Belleview\">Belleview</option><option value=\"Beverly Hills\">Beverly Hills</option><option value=\"Big Pine Key\">Big Pine Key</option><option value=\"Boca Grande\">Boca Grande</option><option value=\"Boca Raton\">Boca Raton</option><option value=\"Bokeelia\">Bokeelia</option><option value=\"Bonifay\">Bonifay</option><option value=\"Bonita Springs\">Bonita Springs</option><option value=\"Bowling Green\">Bowling Green</option><option value=\"Boynton Beach\">Boynton Beach</option><option value=\"Bradenton\">Bradenton</option><option value=\"Brandon\">Brandon</option><option value=\"Brooksville\">Brooksville</option><option value=\"Bushnell\">Bushnell</option><option value=\"Cape Coral\">Cape Coral</option><option value=\"Captiva\">Captiva</option><option value=\"Casselberry\">Casselberry</option><option value=\"Cayo Costa\">Cayo Costa</option><option value=\"Celebration\">Celebration</option><option value=\"Century\">Century</option><option value=\"Chokoloskee\">Chokoloskee</option><option value=\"Citrus Springs\">Citrus Springs</option><option value=\"Clearwater\">Clearwater</option><option value=\"Clermont\">Clermont</option><option value=\"Clewiston\">Clewiston</option><option value=\"Cocoa\">Cocoa</option><option value=\"Coral Gables\">Coral Gables</option><option value=\"Coral Springs\">Coral Springs</option><option value=\"Crystal River\">Crystal River</option><option value=\"Cudjoe Key\">Cudjoe Key</option><option value=\"Cutler Bay\">Cutler Bay</option><option value=\"Dade City\">Dade City</option><option value=\"Dania Beach\">Dania Beach</option><option value=\"Davenport\">Davenport</option><option value=\"Davie\">Davie</option><option value=\"Daytona Beach\">Daytona Beach</option><option value=\"Deerfield Beach\">Deerfield Beach</option><option value=\"Delray Beach\">Delray Beach</option><option value=\"Deltona\">Deltona</option><option value=\"Destin\">Destin</option><option value=\"Doral\">
263Doral</option><option value=\"Dover\">Dover</option><option value=\"Duck Key\">Duck Key</option><option value=\"Dundee\">Dundee</option><option value=\"Dunedin\">Dunedin</option><option value=\"Dunnellon\">Dunnellon</option><option value=\"Eagle Lake\">Eagle Lake</option><option value=\"East Palatka\">East Palatka</option><option value=\"Edgewater\">Edgewater</option><option value=\"Edgewood\">Edgewood</option><option value=\"El Portal\">El Portal</option><option value=\"Englewood\">Englewood</option><option value=\"Estero\">Estero</option><option value=\"Eustis\">Eustis</option><option value=\"Everglades City\">Everglades City</option><option value=\"Felda\">Felda</option><option value=\"Floral City\">Floral City</option><option value=\"Fort Denaud\">Fort Denaud</option><option value=\"Fort Lauderdale\">Fort Lauderdale</option><option value=\"Fort Mc Coy\">Fort Mc Coy</option><option value=\"Fort Meade\">Fort Meade</option><option value=\"Fort Myers\">Fort Myers</option><option value=\"Fort Myers Beach\">Fort Myers Beach</option><option value=\"Fort Pierce\">Fort Pierce</option><option value=\"Fort Walton Beach\">Fort Walton Beach</option><option value=\"Frostproof\">Frostproof</option><option value=\"Gainesville\">Gainesville</option><option value=\"Gibsonton\">Gibsonton</option><option value=\"Golden Gate\">Golden Gate</option><option value=\"Goodland\">Goodland</option><option value=\"Graceville\">Graceville</option><option value=\"Green Acres\">Green Acres</option><option value=\"Green Cove Springs\">Green Cove Springs</option><option value=\"Greenacres\">Greenacres</option><option value=\"Gulf Breeze\">Gulf Breeze</option><option value=\"Haines\">Haines</option><option value=\"Haines City\">Haines City</option><option value=\"Hallandale\">Hallandale</option><option value=\"Hallandale Beach\">Hallandale Beach</option><option value=\"Hastings\">Hastings</option><option value=\"Hawthorne\">Hawthorne</option><option value=\"Hernando\">Hernando</option><option value=\"Hernando Beach\">Hernando Beach</option><option value=\"Hialeah\">Hialeah</option><option value=\"Hialeah Gardens\">Hialeah Gardens</option><option value=\"Hobe Sound\">Hobe Sound</option><option value=\"Holiday\">Holiday</option><option value=\"Hollywood\">Hollywood</option><option value=\"Holmes Beach\">Holmes Beach</option><option value=\"Homestead\">Homestead</option><option value=\"Hudson\">Hudson</option><option value=\"Immokalee\">Immokalee</option><option value=\"Indian Harbour Beach\">Indian Harbour Beach</option><option value=\"Indian Rocks Beach\">Indian Rocks Beach</option><option value=\"Inglis\">Inglis</option><option value=\"Inverness\">Inverness</option><option value=\"Islamorada\">Islamorada</option><option value=\"Jacksonville\">Jacksonville</option><option value=\"Jacksonville Beach\">Jacksonville Beach</option><option value=\"Jasper\">Jasper</option><option value=\"Jensen Beach\">Jensen Beach</option><option value=\"Jupiter\">Jupiter</option><option value=\"Key Largo\">Key Largo</option><option value=\"Key West\">Key West</option><option value=\"Kissimmee\">Kissimmee</option><option value=\"La Crosse\">La Crosse</option><option value=\"Labelle\">Labelle</option><option value=\"Lady Lake\">Lady Lake</option><option value=\"Lake City\">Lake City</option><option value=\"Lake Panasoffkee\">Lake Panasoffkee</option><option value=\"Lake Placid\">Lake Placid</option><option value=\"Lake Suzy\">Lake Suzy</option><option value=\"Lake Worth\">Lake Worth</option><option value=\"Lakeland\">Lakeland</option><option value=\"Lakewood Ranch\">Lakewood Ranch</option><option value=\"Land O Lakes\">Land O Lakes</option><option value=\"Lantana\">Lantana</option><option value=\"Largo\">Largo</option><option value=\"Lauderdale By The Sea\">Lauderdale By The Sea</option><option value=\"Lauderdale Lakes\">Lauderdale Lakes</option><option value=\"Lauderhill\">Lauderhill</option><option value=\"Lecanto\">Lecanto</option><option value=\"Lee\">Lee</option><option value=\"Leesburg\">Leesburg</option><option value=\"Lehigh Acres\">Lehigh Acres</option><option value=\"Little Torch Key\">Little Torch Key</option><option value=\"Longboat Key\">Longboat Key</option><option value=\"Lorida\">Lorida</option><option value=\"Loxahatchee\">Loxahatchee</option><option value=\"Lutz\">Lutz</option><option value=\"Madison\">Madison</option><option value=\"Marathon\">Marathon</option><option value=\"Marco Island\">Marco Island</option><option value=\"Margate\">Margate</option><option value=\"Mary Esther\">Mary Esther</option><option value=\"Matlacha\">Matlacha</option><option value=\"Matlacha Isles\">Matlacha Isles</option><option value=\"Mc Alpin\">Mc Alpin</option><option value=\"Melbourne\">Melbourne</option><option value=\"Melbourne Beach\">Melbourne Beach</option><option value=\"Merritt Island\">Merritt Island</option><option value=\"Mexico Beach\">Mexico Beach</option><option value=\"Miami\">Miami</option><option value=\"Miami Beach\">Miami Beach</option><option value=\"Miami Gardens\">Miami Gardens</option>
263<option value=\"Miami Lakes\">Miami Lakes</option><option value=\"Miami Springs\">Miami Springs</option><option value=\"Middleburg\">Middleburg</option><option value=\"Milton\">Milton</option><option value=\"Mims\">Mims</option><option value=\"Miramar\">Miramar</option><option value=\"Miromar Lakes\">Miromar Lakes</option><option value=\"Montura Ranches\">Montura Ranches</option><option value=\"Moore Haven\">Moore Haven</option><option value=\"Mount Dora\">Mount Dora</option><option value=\"Myakka City\">Myakka City</option><option value=\"Naples\">Naples</option><option value=\"Navarre\">Navarre</option><option value=\"New Port Richey\">New Port Richey</option><option value=\"New Smyrna Beach\">New Smyrna Beach</option><option value=\"Nokomis\">Nokomis</option><option value=\"North Fort Myers\">North Fort Myers</option><option value=\"North Miami\">North Miami</option><option value=\"North Miami Beach\">North Miami Beach</option><option value=\"North Palm Beach\">North Palm Beach</option><option value=\"North Port\">North Port</option><option value=\"Oakland Park\">Oakland Park</option><option value=\"Ocala\">Ocala</option><option value=\"Ocklawaha\">Ocklawaha</option><option value=\"Odessa\">Odessa</option><option value=\"Okeechobee\">Okeechobee</option><option value=\"Old Town\">Old Town</option><option value=\"Oldsmar\">Oldsmar</option><option value=\"Opa-Locka\">Opa-Locka</option><option value=\"Orange Park\">Orange Park</option><option value=\"Orlando\">Orlando</option><option value=\"Osprey\">Osprey</option><option value=\"Other\">Other</option><option value=\"Out Of Area\">Out Of Area</option><option value=\"Oviedo\">Oviedo</option><option value=\"Oxford\">Oxford</option><option value=\"Pahokee\">Pahokee</option><option value=\"Palatka\">Palatka</option><option value=\"Palm Bay\">Palm Bay</option><option value=\"Palm Beach\">Palm Beach</option><option value=\"Palm Beach Gardens\">Palm Beach Gardens</option><option value=\"Palm Coast\">Palm Coast</option><option value=\"Palm Harbor\">Palm Harbor</option><option value=\"Palm Springs\">Palm Springs</option><option value=\"Palmdale\">Palmdale</option><option value=\"Palmetto\">Palmetto</option><option value=\"Panama City\">Panama City</option><option value=\"Panama City Beach\">Panama City Beach</option><option value=\"Parkland\">Parkland</option><option value=\"Parrish\">Parrish</option><option value=\"Pembroke Pines\">Pembroke Pines</option><option value=\"Pensacola\">Pensacola</option><option value=\"Placida\">Placida</option><option value=\"Plant City\">Plant City</option><option value=\"Plantation\">Plantation</option><option value=\"Pompano Beach\">Pompano Beach</option><option value=\"Ponte Vedra\">Ponte Vedra</option><option value=\"Port Charlotte\">Port Charlotte</option><option value=\"Port Orange\">Port Orange</option><option value=\"Port Richey\">Port Richey</option><option value=\"Port St. Lucie\">Port St. Lucie</option><option value=\"Punta Gorda\">Punta Gorda</option><option value=\"Redington Shores\">Redington Shores</option><option value=\"Reunion\">Reunion</option><option value=\"River Ranch\">River Ranch</option><option value=\"Riverview\">Riverview</option><option value=\"Riviera Beach\">Riviera Beach</option><option value=\"Rockledge\">Rockledge</option><option value=\"Rotonda West\">Rotonda West</option><option value=\"Royal Palm Beach\">Royal Palm Beach</option><option value=\"Ruskin\">Ruskin</option><option value=\"Safety Harbor\">Safety Harbor</option><option value=\"Salt Springs\">Salt Springs</option><option value=\"San Antonio\">San Antonio</option><option value=\"Sanibel\">Sanibel</option><option value=\"Sarasota\">Sarasota</option><option value=\"Sebastian\">Sebastian</option><option value=\"Sebring\">Sebring</option><option value=\"Seffner\">Seffner</option><option value=\"Seminole\">Seminole</option><option value=\"Shalimar\">Shalimar</option><option value=\"Siesta Key\">Siesta Key</option><option value=\"Sorrento\">Sorrento</option><option value=\"South Bay\">South Bay</option><option value=\"South Daytona\">South Daytona</option><option value=\"Southwest Ranches\">Southwest Ranches</option><option value=\"Spring Hill\">Spring Hill</option><option value=\"St Cloud\">St Cloud</option><option value=\"St Petersburg\">St Petersburg</option><option value=\"St. Augustine\">St. Augustine</option><option value=\"St. James City\">St. James City</option><option value=\"St. Petersburg Beach\">St. Petersburg Beach</option><option value=\"Summerfield\">Summerfield</option><option value=\"Sun City Center\">Sun City Center</option><option value=\"Sunny Isles Beach\">Sunny Isles Beach</option><option value=\"Sunrise\">Sunrise</option><option value=\"Tallahassee\">
263Tallahassee</option><option value=\"Tamarac\">Tamarac</option><option value=\"Tampa\">Tampa</option><option value=\"Tarpon Springs\">Tarpon Springs</option><option value=\"Tavares\">Tavares</option><option value=\"Tavernier\">Tavernier</option><option value=\"Temple Terrace\">Temple Terrace</option><option value=\"The Villages\">The Villages</option><option value=\"Titusville\">Titusville</option><option value=\"Treasure Island\">Treasure Island</option><option value=\"Trenton\">Trenton</option><option value=\"University Park\">University Park</option><option value=\"Upper Captiva\">Upper Captiva</option><option value=\"Useppa Island\">Useppa Island</option><option value=\"Valrico\">Valrico</option><option value=\"Venice\">Venice</option><option value=\"Venus\">Venus</option><option value=\"Vero Beach\">Vero Beach</option><option value=\"Wauchula\">Wauchula</option><option value=\"Weeki Wachee\">Weeki Wachee</option><option value=\"Welaka\">Welaka</option><option value=\"Wellington\">Wellington</option><option value=\"Wesley Chapel\">Wesley Chapel</option><option value=\"West Palm Beach\">West Palm Beach</option><option value=\"Weston\">Weston</option><option value=\"Williston\">Williston</option><option value=\"Wimauma\">Wimauma</option><option value=\"Winter Garden\">Winter Garden</option><option value=\"Winter Haven\">Winter Haven</option><option value=\"Winter Park\">Winter Park</option><option value=\"Zephyrhills\">Zephyrhills</option><option value=\"Zolfo Springs\">
263Zolfo Springs</option></select><a href=\"#\" class=\"btn btn-round btn-danger btn-xs\" style=\"padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;height:unset;\" onclick=\"saveChoices(\'city\');\">Save Choices</a> <a href=\"#\" class=\"btn btn-round btn-success btn-xs\" style=\"padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;height:unset;\" onclick=\"skipChoices();\">Skip</a><br><br><br>';
264
265	 return out;
266
267 }
268
269 function buildMultiSelectCommunity(city_in, pt_in) {
270
271	 console.log('buildMultiSelectCommunity:city_in:'+city_in+':pt_in:'+pt_in);
272
273	 $.ajax({ url: '/fo/select?name=community_name&field=community_name&where_key=city&where_value='+city_in+'&p_type='+pt_in+'&selected=&options=&default_empty&size=5',
274		 dataType: 'html',
275		 success: function(response) {
276			 html_output =  'Type or Choose then click Save Choices:<br>'+response+'<a href=\"#\" style=\"padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;height:unset;\" class=\"btn btn-round btn-danger btn-xs\" onclick=\"saveChoices(\'community_name\');\">Save Choices</a> <a href=\"#\" style=\"padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;height:unset;\" class=\"btn btn-round btn-success btn-xs\" onclick=\"skipChoices();\">Skip</a><br><br><br>';
277
278			 $('#bmsc').html(html_output);
279
280			 $("#community_name").chosen();
281			 $("#community_name").trigger("chosen:updated");
282
283			 $('.conversation-list').scrollTo('100%', '100%', {
284				 easing: 'swing'
285			 });
286
287
288		 },
289		 error: function(XMLHttpRequest, textStatus, errorThrown) {
290			 console.log("Status: " + textStatus); alert("Error: " + errorThrown);
291
292			 html_output = 'Type a Community Name and press Enter or Click Send.<br><br>';
293
294			 $('#bmsc').html(html_output);
295
296		 }
297	 });
298
299 }
300
301 function buildMultiSelectSubdivision(community_name_in, pt_in) {
302
303	 console.log('buildMultiSelectSubdivision:community_name_in:'+community_name_in+':pt_in:'+pt_in);
304
305	 $.ajax({ url: '/fo/select?name=subdivision&field=subdivision&where_key=community_name&where_value='+community_name_in+'&p_type='+pt_in+'&selected=&options=&default_empty&size=5',
306		 dataType: 'html',
307		 success: function(response) {
308			 html_output =  'Type or Choose then click Save Choices:<br>'+response+'<a href=\"#\" style=\"padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;height:unset;\" class=\"btn btn-round btn-danger btn-xs\" onclick=\"saveChoices(\'subdivision\');\">Save Choices</a> <a href=\"#\" style=\"padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;height:unset;\" class=\"btn btn-round btn-success btn-xs\" onclick=\"skipChoices();\">Skip</a><br><br><br>';
309
310			 $('#bmss').html(html_output);
311
312			 $("#subdivision").chosen();
313			 $("#subdivision").trigger("chosen:updated");
314
315			 $('.conversation-list').scrollTo('100%', '100%', {
316				 easing: 'swing'
317			 });
318
319		 },
320		 error: function(XMLHttpRequest, textStatus, errorThrown) {
321			 console.log("Status: " + textStatus); alert("Error: " + errorThrown);
322
323			 html_output = 'Type a Subdivision Name and press Enter or Click Send.<br><br>';
324
325			 $('#bmss').html(html_output);
326
327		 }
328	 });
329
330 }
331
332 function aFlushSeries() {
333	
334   var fdata = localStorage.getObject('seriesData');
335 
336	if (typeof fdata !== "undefined" && fdata !== null && fdata.hasOwnProperty('questions')) {
337		for (var i=0; i<fdata.questions.length; i++) {
338		   for (var key in fdata.questions[i]) {
339			   localStorage.removeItem(fdata.questions[i].name);
340			   localStorage.removeItem('answer_time_'+i);
341			   localStorage.removeItem('question_time_'+i);
342		   }
343	   }
344	}
345
346	localStorage.removeItem('series_name');
347	localStorage.removeItem('await'); 
348	localStorage.removeItem('await_valid'); 
349
350}
351
352 function aChatSeries(isvalid,validmessage) {
353	 
354	 	  var sdata = localStorage.getObject('seriesData');
355	 	
356	var do_final_reload = '';
357	
358	if(sdata.hasOwnProperty('redirect')) {
359		if(sdata.redirect != '') {
360			do_final_reload = sdata.redirect;
361		}
362	}
363
364	sdata._token = $('input[name=_token]').val();		
365	
366     //set passthrough variables
367	 if(sdata.passthrough) {
368		 for (var p = 0, length = sdata.passthrough.length; p < length; p++) {
369 
370			 for (var pkey in sdata.passthrough[p]) {
371				 localStorage.setItem(pkey, sdata.passthrough[p][pkey]); // set passthrough
372				 sdata[pkey] = sdata.passthrough[p][pkey];
373			 }
374		 }
375	 }
376	 
377     //set persistant variables
378	 if(sdata.persist) {
379		 for (var p = 0, length = sdata.persist.length; p < length; p++) {
380 
381			 for (var pkey in sdata.persist[p]) {
382				 localStorage.setItem(pkey, sdata.persist[p][pkey]); // set passthrough
383				 sdata[pkey] = sdata.persist[p][pkey];
384			 }
385		 }
386	 }
387	
388	if (typeof sdata !== "undefined" && sdata !== null && sdata.hasOwnProperty('series') && sdata.series == true) {
389							
390	localStorage.setItem('series_name', sdata.series_name);
390 // set series name
391			 
392	 var name_we_ask = '';
393	 var question_we_ask = '';		 		
394	 var answered_count = 0;
395	 
396	    for (var i = sdata.questions.length - 1; i >= 0; i--) {
397 	 	   //check conditions and set
398			if(typeof sdata.questions[i].name !== "undefined" && typeof sdata.questions[i].condition !== "undefined") {
399				aChatCondition(sdata.questions[i].name,sdata.questions[i].condition);
400				}
401
402		   for (var key in sdata.questions[i]) {
403	   
404			skipit = localStorage.getItem(sdata.questions[i].name + '_skip');
405			//console.log(sdata.questions[i].name+'_skip, skipit:'+skipit);
406				
407			localStorage.setItem('answer_index', i);
408			
409			sdata.questions[i].question_time = localStorage.getItem('question_time_'+i);
410			//console.log('localStorage.getItem(question_time_'+i+'):'+localStorage.getItem('question_time_'+i));
411			
412			if (skipit == 'true') { // skip condition
413				/*localStorage.removeItem('cht_client_email');
414				localStorage.removeItem('cht_client_name');*/
415				//console.log(sdata.questions[i].name + '_skip=true');
416				answered_count++;
417				break;
418			} else {
419		
420			   if (localStorage.getItem(sdata.questions[i].name) != null) {
421				   var answered = localStorage.getItem(sdata.questions[i].name);
422
423				   //persist name & email
424				   if(sdata.questions[i].name == 'cht_client_email') {
425				   	localStorage.setItem('cht_client_email', answered); // set email
426					//console.log('cht_client_email :'+answered);
427					sdata.cht_client_email = answered;
428				   }
429				   if(sdata.questions[i].name == 'cht_client_name') {
430				   	localStorage.setItem('cht_client_name', answered); // set name
431					//console.log('cht_client_name :'+answered);
432					sdata.cht_client_name = answered;
433				   }
434				   if(sdata.questions[i].name == 'cht_city') {
435					   localStorage.setItem('saved_city', answered); // set name
436					  // console.log('saved_city :'+answered);
437					   sdata.saved_city = answered;
438				   }
439				   if(sdata.questions[i].name == 'cht_ptype') {
440					   localStorage.setItem('saved_ptype', answered); // set name
441					   // console.log('saved_ptype :'+answered);
442					   sdata.saved_ptype = answered;
443				   }
444				   if(sdata.questions[i].name == 'cht_community_name') {
445					   localStorage.setItem('saved_community_name', answered); // set name
446					  // console.log('saved_community_name :'+answered);
447					   sdata.saved_community_name = answered;
448				   }
449
450				   answered_count++;
451	   
452				   if (sdata.questions[i].validation == 'numeric') {
453				   		sdata.questions[i].answer = aChatNumbers(answered);
454				   } else {
455				   		sdata.questions[i].answer = answered;
456				   }
457				   					   
458				   answer_time = localStorage.getItem('answer_time_'+i);
459				   //console.log('answer_time '+i+':'+answer_time);
460				   
461				   sdata.questions[i].answer_time = answer_time;
462		   
463				   break;
464
465			   } else {
466					name_we_ask = sdata.questions[i].name;
467					question_we_ask = sdata.questions[i].question;
468					validation_we_require = sdata.questions[i].validation;
469					question_index = i;
470 
471					break;	 
472		   
473			   }
474	   
475	
476			}
477	    
478		   } //for
479		   	   
480	 	  
481		} //for
482
483		//console.log('series length:' + sdata.questions.length+', '+'answered_count:' + answered_count);
484
485		if(sdata.questions.length == answered_count) {
486	
487			localStorage.removeItem('await'); 
488			localStorage.removeItem('await_valid'); 
489	
490		    for (var i = sdata.questions.length - 1; i >= 0; i--) {//CLEANUP
491			   for (var key in sdata.questions[i]) {
492				   localStorage.removeItem(sdata.questions[i].name + '_skip');
493			   }
494		   }
495	
496			if(sdata.questions.length > 0) { //alert('We have all the answers!');
497		
498				if (typeof sdata !== "undefined" && sdata !== null && sdata.hasOwnProperty('reply') && sdata.reply != '') {
499			
500					rawreply = sdata.reply;
501					replyout = rawreply.replaceAll("#input#", validmessage);
502			
503					aChatMessage(replyout,$('input[name='+ida+'user_id]').val(),$('input[name='+ida+'agent_id]').val(),'Automatic Helper','agent');
504			
505				} else {
506					
507					//HANDLE DATA COLLECTION					
508					aChatSendData(sdata,do_final_reload);
509					
510					//CLEANUP PASSTHROUGH
511					if(sdata.passthrough) {
512			   			 for (var p = 0, length = sdata.passthrough.length; p < length; p++) {
513		 
514			   				 for (var pkey in sdata.passthrough[p]) {
515			   					 localStorage.removeItem(pkey);
516			   					 sdata[pkey] = null;
517			   				 }
518			   			 }
519			   		 }
520					 
521					 //CLEANUP TIMES
522		 		     for (var i = sdata.questions.length - 1; i >= 0; i--) {//CLEANUP
523		 			    for (var key in sdata.questions[i]) {
524		 			 	   localStorage.removeItem('question_time_'+i);
525						   localStorage.removeItem('answer_time_'+i);
526		 			    }
527		 		    }
528					localStorage.removeItem('question_index');
529					localStorage.removeItem('answer_index');
530					
531					
532				}
533		
534			}
535	
536			localStorage.removeItem('series_name');
537					
538		} else {
539	
540			if(name_we_ask != '') {
541				localStorage.setItem('await', name_we_ask); // set question name
542				localStorage.setItem('await_valid', validation_we_require);
543				//console.log('question_index 786: ' + question_index);
544			}
545			
546			if(question_we_ask != '') {
547
548				if(name_we_ask == 'cht_city') {
549					$("#city").chosen();
550					$("#city").trigger("chosen:updated");
551				}
552				if(name_we_ask == 'cht_community_name') {
553					s_city =  localStorage.getItem('saved_city');
554					s_ptype =  localStorage.getItem('saved_ptype');
555					buildMultiSelectCommunity(s_city,aConvertDisplayToData(s_ptype));
556					localStorage.removeItem('saved_city');
557				}
558				if(name_we_ask == 'cht_subdivision') {
559					s_community_name =  localStorage.getItem('saved_community_name');
560					s_ptype =  localStorage.getItem('saved_ptype');
561					buildMultiSelectSubdivision(s_community_name,aConvertDisplayToData(s_ptype));
562					localStorage.removeItem('saved_community_name');
563				}
564
565			   aChatMessage(question_we_ask,$('input[name='+ida+'user_id]').val(),$('input[name='+ida+'agent_id]').val(),'Automatic Helper','agent');
566			     
567 	           localStorage.setItem('question_time_'+question_index, MysqlDateNow());
568			   localStorage.setItem('question_index', question_index);
569			   
570			 }
571	 
572		}
573
574	
575	} else { //not series, only reply
576
577		aChatMessage(sdata.questions[0].question,$('input[name='+ida+'user_id]').val(),$('input[name='+ida+'agent_id]').val(),'Automatic Helper','agent');			 
578		
579		//HANDLE DATA COLLECTION		 SHTEMP MAKE FUNC			
580		aChatSendData(sdata,do_final_reload);
581		
582		//CLEANUP PASSTHROUGH
583		if(sdata.passthrough) {
584   			 for (var p = 0, length = sdata.passthrough.length; p < length; p++) {
585
586   				 for (var pkey in sdata.passthrough[p]) {
587   					 localStorage.removeItem(pkey);
588   					 sdata[pkey] = null;
589   				 }
590   			 }
591   		 }
592 
593	}
594	
595 } //function
596
597function aChatSendData(sdata,do_final_reload) {
598
599	//console.table(sdata);
600	
601	//console.log('497:do_final_reload:'+do_final_reload);
602	
603	if(do_final_reload) {
604		var reload_url = do_final_reload;
605	} else {
606		var reload_url = '';
607	}
608	
609	//console.log('503:reload_url:'+reload_url);
610		
611	  $.ajax({
612      url: 'https://decaturrealestategroup.com/newchat',
613      type: "post",
614      data: sdata,
615      success: function(data){
616	   //alert('aChatSendData SUCCESS!');
617		aChatUpdateItems();
618		//alert('Posted!');
619		//$('#postchat')[0].reset();
620		//$('#apostchat')[0].reset();
621		$('.chat-input').val('');
622		$(".chat-input").focus();
623
624      }
625    }).done(function(resp) {
626			
627			 aChatMessage(resp,$('input[name='+ida+'user_id]').val(),$('input[name='+ida+'agent_id]').val(),'Automatic Helper','agent');
628 		    
629    });    
630	
631    if (reload_url != '') {
632		gotourl = reload_url.toString().replace(/#/g,"");
633		//alert('Press OK automatically log in now');
634		console.log('525:gotourl:'+gotourl);
635		//window.location.replace(gotourl+'?frc=1');
636		$.get('https://decaturrealestategroup.com/'+ida+'chat-up', function(data) {
637		});
638		setTimeout(() => {  window.location.reload(); }, 10000);
639	}
640	
641}
642
643 function aChatMessage(message,user_id,agent_id,username,from) {
644	 
645	 if(message != '' && !message.match(/DOCTYPE/gmi)) {//not empty, and not a HTML page.
646		 
647		 		 
648		 var chatData = { };
649		 chatData["code"] = idcc;
650		 chatData["message"] = message;
651		 chatData["user_id"] = user_id;
652		 chatData["agent_id"] = agent_id;
653		 chatData["username"] = username;
654		 chatData["from"] = from;
655		 chatData["nice_time"] = dateTOAMORPM(new Date()); //new Date(Date.now()).toDateString();
656		 chatData["_token"] = $('input[name=_token]').val();
657		 chatDataOut.push(chatData);
658		 localStorage.setObject('chatData', chatDataOut );
659		 if(from == 'agent') {
660			aChatUpdateItems(true);
661		 } else {
662		 	aChatUpdateItems(false);
663		 }
664		 
665		 		
666		 
667		 
668		 
669		 
670	 }
671
672 }
673
674 function dateTOAMORPM(currentDateTime) {
675    var hrs = currentDateTime.getHours();
676    var mnts = currentDateTime.getMinutes();
677    var AMPM = hrs >= 12 ? 'PM' : 'AM';
678    hrs = hrs % 12;
679    hrs = hrs ? hrs : 12;
680    mnts = mnts < 10 ? '0' + mnts : mnts;
681    var result = hrs + ':' + mnts + ' ' + AMPM;
682    return result;
683 }
684
685 function aChatUpdateItems(sound) {
686	
687	 	 var data = localStorage.getObject('chatData');
688	 	
689	//console.table(chatMessages);
690
691	var output = '';
692	
693	$('#'+ida+'chatsubmit').text("Sending");
694		
695	if (isObject(data)) {
696	if (data.length < 1) {
697		$.ajax({
698		     type: "GET",
699		     url: "https://decaturrealestategroup.com/"+ida+"jchat/"+idcc+"?autobot=1",
700		     async: true,
701			 cache: false,
702		     beforeSend: function(x) {
703		      if(x && x.overrideMimeType) {
704		       x.overrideMimeType("application/json;charset=UTF-8");
705		      }
706		 },
707		 dataType: "json",
708		 beforeSend: function()
709	     {
710	         //$('#'+ida+'chatsubmit').text("Sending");
711	     },
712		 success: function(data){
713			 //alert(data[0].from);
714		    var output = '';
715			
716			for (i = 0; i < data.length; i++) { 
717			
718				if(data[i].message != '') {
719		            output += '<li class="clearfix';
720					if(data[i].from == 'user') {
721						output += ' odd';
722					}  
723		
724					output += '">'
725					+ '<div class="chat-avatar">'
726					+ '<i>'+ data[i].nice_time + '</i>'
727					+ '</div>'
728					+ '<div class="conversation-text"><div class="ctext-wrap"><i>'
729					+ data[i].username
730					+ '</i><p id="'+i+'">'
731					+ data[i].message
732					+ '</p></div></div></li>';
733				}
734		
735			}
736			
737		 }
738		}).done(function(resp) {
739			// console.log('sound3');
740     });    
741		
742	} else {
743    
744		if (data) {
745			for (i = 0; i < data.length; i++) { 
746			
747				if(data[i].message != '') {
748			        output += '<li class="clearfix';
749					if(data[i].from == 'user') {
750						output += ' odd';
751					} 
752
753					output += '">'
754					+ '<div class="chat-avatar">'
755					+ '<i>'+ data[i].nice_time + '</i>'
756					+ '</div>'
757					+ '<div class="conversation-text"><div class="ctext-wrap"><i>'
758					+ data[i].username
759					+ '</i><p id="'+i+'">'
760					+ data[i].message
761					+ '</p></div></div></li>';
762				}
763
764			}
765			//$('#'+ida+'chatsubmit').text("Sending");
766		}
767	
768	}
769	//console.log('here');
770    $('#'+ida+'chat_'+idcc).html(output);
771	if(sound) {
772		$('#'+ida+'chatsubmit').text("Sending");
773		//console.log('do sound');
774	    $('.'+ida+'conversation-list').scrollTo('100%', '100%', {
775			duration: 1,
776	        easing: 'swing',
777			done: playNewChatSound()
778	    });
779		$('#'+ida+'chatsubmit').text("Send");
780	} else {
781		$('#'+ida+'chatsubmit').text("Sending");
782	    $('.'+ida+'conversation-list').scrollTo('100%', '100%', {
783	        easing: 'swing'
784	    });
785		$('#'+ida+'chatsubmit').text("Send");
786	}
787
788	var uripath = location.pathname.substring(1);
789
790//Special multiselect fields init
791if(uripath != 'list-your-property') {
792	//console.table(document.getElementById('city'));
793	if (document.getElementById('city')) {
794		$('#city').chosen();
795	}
796	if (document.getElementById('subdivision')) {
797		$('#subdivision').chosen();
798	}
799	if (document.getElementById('community_name')) {
800		$('#community_name').chosen();
801	}
802}    
803
804 }
805 
806 $('#'+ida+'chatsubmit').text("Send");
807 
808}
809 
810 function playNewChatSound() {
811	 
812	 //$(document).ready(function() {
813		  $('#'+ida+'chatcount').text('New Message!');
814		   
815		  	  // });
816} 
817
818 function aYesOrNoValid(reply)
819 {
820	 reply = reply.toString();
821
822     if (reply == '0' || reply == 'N' || reply == 'n' || reply == 'No' || reply == 'no' || reply == 'NO') {
823         reply = true;
824     } else if (reply == 'Y' || reply == 'y' || reply == 'Yes' || reply == 'yes' || reply == 'YES' || reply == 1 || reply == '1') {
825         reply = true;
826     } else {
827         reply = false;
828     }
829
830     return reply;
831 }
832
833 function aChatNumbers(input) {
834
835	input = input.trim(input.toLowerCase());
836
837	switch (input) { 
838	case 'one':
839	   input = 1;
840	   break;
841	case 'two':
842	   input = 2;
843	   break;
844	case 'three':
845	   input = 3;
846	   break;
847	case 'four':
848	   input = 4;
849	   break;
850	case 'five':
851	   input = 5;
852	   break;
853	case 'six':
854	   input = 6;
855	   break;
856	case 'seven':
857	   input = 7;
858	   break;
859	case 'eight':
860	   input = 8;
861	   break;
862	case 'nine':
863	   input = 9;
864	   break;
865	case 'ten':
866	   input = 10;
867	   break;
868	default:
869	   input = input;
870	}		
871
872	output = input.toString().replace(/\D/g,"");
873
874	return output;
875			
876 }
877 
878 function openChatOnScrollUp (showit) {
879
880 	$("html, body").bind({'mousewheel DOMMouseScroll onmousewheel touchmove scroll': 
881 	    function(e) {
882 	        if (e.target.id == 'el') return;
883 	        //e.preventDefault();
884 	        e.stopPropagation();
885
886 	        //Determine Direction
887 	        if (e.originalEvent.wheelDelta && e.originalEvent.wheelDelta >= 0) {
888 	            //Up
889 	           // console.log("up");
890				if(showit) {
891					//console.log("up:"+showit);
892					//$('#'+ida+'chatbox').delay(3000).show(0);
893					
894				}
895 				
896
897 	        } else if (e.originalEvent.detail && e.originalEvent.detail <= 0) {
898 	            //Up
899 	          //  console.log("up2");
900				
901			if(showit) {
902				//console.log("up2:"+showit);
903 				//$('#'+ida+'chatbox').delay(3000).show(0);
904			}
905
906 	        } else {
907 	            //Down
908 	          //  console.log("down");
909			
910 	        }
911 	    }
912 	});
913	
914 }
915
916function toProperCase (str) {
917
918	str = str.toString().replace(/^,/, '');
919
920	clean = str.replace(/,/g,", ");
921
922	out = clean.toString().replace(/\w\S*/g,
923	    function(txt) {
924	      return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
925	    }
926	);
927
928	return out;
929}
930
931function isObject(val) {
932    if (val === null) { return false;}
933    return ( (typeof val === 'function') || (typeof val === 'object') );
934}
935
936/*function newStateCallback(response) {
937	
938	var result = response.state;
939	//console.log("Inside ajax: "+result);  
940	
941	//return result;    
942	  
943	  
944					
945		 cache: false,
946	     beforeSend: function(x) {
947	      if(x && x.overrideMimeType) {
948	       x.overrideMimeType("application/json;charset=UTF-8");
949	      }
950	 },
951	 datatype: "json",
952	 success: newStateCallback,
953
954}*/
955
956function newStateCheck(callback) 
957{
958	
959	var lock_get = 0;
960
961	if (lock_get == 0)
962	{
963	lock_get = 1;
964	$.ajax({
965	     type: "GET",
966	     url: "https://decaturrealestategroup.com/chat-state",
967	     async: true,
968		 cache: false,
969	     beforeSend: function(x) {
970	      if(x && x.overrideMimeType) {
971	       x.overrideMimeType("application/json;charset=UTF-8");
972	      }
973	 },
974	 dataType: "json",
975	 success: function(data){
976         lock_get = 0;
977		 //console.table(data);
978         if (data && callback)
979         {
980             callback(data.state);
981         }
982	 }
983	});
984	}
985	
986};
987	
988function newStateCheckX() {
989	
990	$.ajax({
991	     type: "GET",
992	     url: "https://decaturrealestategroup.com/chat-state",
993  		 async: true,
994         datatype: "json",
995         success: function(data) 
996         {
997            lock_get = 0;
998            if (data && callback)
999            {
1000                callback(data);
1001            }
1002         }
1003	});
1004	
1005}
1006
1007function newChatCheck(syncit,synctype,syncseconds) {
1008	
1009	if(synctype=='') {
1010		var synctype = 'user';
1011	}
1012	if(syncseconds=='') {
1013		var syncseconds = '10';
1014	}
1015	
1016	var syncccc = '';
1017
1018if(syncccc != '') {
1019	$.ajax({
1020	     type: "GET",
1021	     url: "https://decaturrealestategroup.com/jchatping/"+synctype+"/"+syncseconds+"/"+syncccc,
1022	     async: syncit,
1023		 cache: false,
1024	     beforeSend: function(x) {
1025	      if(x && x.overrideMimeType) {
1026	       x.overrideMimeType("application/json;charset=UTF-8");
1027	      }
1028	 },
1029	 dataType: "json",
1030	 success: function(data){
1031	 
1032		 if(data.cnt > 0) {
1033					 } else {
1034		 	//console.log('NONE newChatCheck');
1035		 }
1036	 }
1037	});
1038}
1039
1040}
1041
1042function chatUpdateItems(syncit) {
1043$('#'+ida+'chatsubmit').text("Sending");
1044$.ajax({
1045     type: "GET",
1046     url: "https://decaturrealestategroup.com/jchat/",
1047     async: syncit,
1048	 cache: false,
1049     beforeSend: function(x) {
1050      if(x && x.overrideMimeType) {
1051       x.overrideMimeType("application/json;charset=UTF-8");
1052      }
1053 },
1054 dataType: "json",
1055 success: function(data){
1056	 //alert(data[0].from);
1057    var output = '';
1058	
1059	for (i = 0; i < data.length; i++) { 
1060								
1061        output += '<li class="clearfix';
1062		if(data[i].from == 'user') {
1063			output += ' odd';
1064		} else {
1065			/*current_message = data[i].message;
1066			if(current_message.match(/continue with my Automatic Helper/)) {
1067				//alert('going back to bot');
1068			 //go back to bot
1069			 newStateCheck(function(currentState){
1070				 aChatUpdateItems();
1071		   	 });
1072			 
1073			}*/
1074			
1075		}
1076		
1077		output += '">'
1078		+ '<div class="chat-avatar">'
1079		+ '<i>'+ data[i].nice_time + '</i>'
1080		+ '</div>'
1081		+ '<div class="conversation-text"><div class="ctext-wrap"><i>'
1082		+ data[i].username
1083		+ '</i><p id="'+i+'">'
1084		+ data[i].message
1085		+ '</p></div></div></li>';
1086		
1087		
1088		
1089	}
1090	   
1091        $('#chat_').html(output);
1092		
1093        $('.conversation-list').scrollTo('100%', '100%', {
1094            easing: 'swing'
1095        });
1096		$('#'+ida+'chatsubmit').text("Send");
1097		
1098 }
1099});
1100
1101}
1102
1103function aConvertDisplayToData(input) {
1104
1105	low_str = input.toLowerCase();
1106
1107	switch (low_str) {
1108	case 'single family':
1109		return 'sfr';
1110	case 'condominiums':
1111		return 'sfr';
1112	case 'lots or land':
1113		return 'lots';
1114	case 'rentals':
1115		return 'rnt';
1116	case 'rental income':
1117		return 'rin';
1118	default:
1119		return 'sfr';
1120	}
1121
1122}

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.