PageSourceSearch

https://aviation-job.com/js/functions.js

js aviation-job.com collected 2026-10-08 03:55:39 UTC 12,619 bytes, 577 lines download raw bytes

1var AnimationStep = 25; 
2var AnimationInterval = 10; 
3var LoginHeight = 240;
4var c_step=0;
5
6function ShowLogin() 
7{
8	var oDiv = document.getElementById("main-login-form");
9		
10	if (c_step < (LoginHeight / AnimationInterval))
11	{
12		oDiv.style.display = "block";
13	 
14		Animate(oDiv);
15	}
16	else
17	{
18		HideAnimate(oDiv);
19	}
20}
21
22function HideLogin() 
23{
24	
25	var oDiv = document.getElementById("main-login-form");
26	HideAnimate(oDiv);
27}
28
29function HideAnimate(element) 
30{
31   
32    if (c_step <= 0)
33	{
34		element.style.display = "none";
35		return true;
36	}
37        
38	
39	c_step--;	
40	
41	element.style.clip="rect(0px 500px "+(c_step*AnimationStep)+"px 0px)";
42	
43    window.setTimeout(function() {
44        HideAnimate(element);
45    }, AnimationInterval);
46    return false;
47}
48
49
50function Animate(element) 
51{
52   
53    if (c_step >= (LoginHeight / AnimationInterval))
54        return true;
55	
56	c_step++;	
57	
58	element.style.clip="rect(0px 500px "+(c_step*AnimationStep)+"px 0px)";
59	
60    window.setTimeout(function() {
61        Animate(element);
62    }, AnimationInterval);
63    return false;
64}
65
66
67
68function ShowHide(div_name)
69{
70
71	if(document.getElementById(div_name).style.display=="block")
72	{
73		document.getElementById(div_name).style.display="none";
74	}
75	else
76	{
77		
78		document.getElementById(div_name).style.display="block";
79	}
80
81}
82
83
84
85function DeleteSavedListing(id)
86{
87	var saved_listings = r_cookie("saved_listings");
88	
89	if(saved_listings.indexOf(id+",") != -1)
90	{
91		saved_listings=saved_listings.replace(id+",","");
92		
93		document.cookie="saved_listings="+saved_listings;
94		
95		$("#save_"+id).removeAttr("href");
96		$("#save_"+id).text("Deleted"); 
97	}
98}
99
100function SaveListing(id)
101{
102	var saved_listings = r_cookie("saved_listings");
103	
104	if(saved_listings.indexOf(id+",") != -1)
105	{
106		
107	}
108	else
109	{
110		
111		saved_listings+=id+",";
112		document.cookie="saved_listings="+saved_listings;
113		
114		$("#save_"+id).removeAttr("href");
115		
116		if(typeof shortlisted !== 'undefined') 
117		{
118			$("#save_"+id).text(shortlisted); 
119		}
120		else
121		{
122			$("#save_"+id).text("Saved"); 
123		}
124	}
125	document.location.reload(true);
126}
127
128function r_cookie(cname)
129{
130	var name = cname + "=";
131	var ca = document.cookie.split(';');
132	for(var i=0; i<ca.length; i++) 
133	  {
134	  var c = ca[i].trim();
135	  if (c.indexOf(name)==0) return c.substring(name.length,c.length);
136	  }
137	return "";
138}
139
140function cancelDropDown(type,lang)
141{
142	lang = typeof lang !== 'undefined' ? lang : "en";
143	
144	document.getElementById("label_"+type).innerHTML="";
145	reload_items("",type,(type=="category"?"Category":"Location"),lang);
146}
147
148function dropDownChange(x,type,lang)
149{
150	lang = typeof lang !== 'undefined' ? lang : "en";
151	
152	var selected_option= x.options[x.selectedIndex].value;
153	
154	
155	if(selected_option!=""&&selected_option!="-1")
156	{
157		document.getElementById("field_"+type).value=selected_option;
158		var selected_options = selected_option.split("@");
159		reload_items(selected_options[0],type,selected_options[1],lang);
160	}
161}
162
163function reload_items(selected_location,type,selected_value,lang)
164{
165	lang = typeof lang !== 'undefined' ? lang : "en";
166	
167	if (window.XMLHttpRequest)
168	{
169		xmlhttp=new XMLHttpRequest();
170	}
171	else
172	{
173		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
174	}
175	xmlhttp.onreadystatechange=function()
176	{
177		if (xmlhttp.readyState==4 && xmlhttp.status==200)
178		{
179			fill_dropdown(xmlhttp.responseText,type,selected_value,selected_location,lang);
180		}
181	}
182	
183	xmlhttp.open("GET","include/suggest_"+type+".php?location="+selected_location+"&lang="+lang+"&q=",true);
184	xmlhttp.send(null);
185
186}
187
188
189
190function fill_dropdown(text,type,selected_value,selected_location,lang)
191{
192	if(text!="" && text!="no suggestion")
193	{
194		lang = typeof lang !== 'undefined' ? lang : "en";
195		
196		drop_down=document.getElementById(type);
197		var new_html="";
198		var splitArray = text.split("~");
199
200		var j = 0;
201		
202		if(splitArray.length>=1)
203		{
204			drop_down.options.length = 1;
205			
206			
207			if(selected_location=="")
208			{
209				if(type=="category"&&typeof cancel_category !== 'undefined')
210				{
211					document.getElementById("label_"+type).innerHTML=cancel_category;	
212				}
213				else
214				if(type=="location"&&typeof cancel_location !== 'undefined')
215				{
216					document.getElementById("label_"+type).innerHTML=cancel_location;	
217				}
218				else
219				{
220					document.getElementById("label_"+type).innerHTML="<br/>";
221				}
222			}
223			else
224			{
225				if(document.getElementById("label_"+type).innerHTML.indexOf("cancelDropDown") == -1)
226				{
227					document.getElementById("label_"+type).innerHTML="<a href=\"javascript:cancelDropDown('"+type+"','"+lang+"')\"><img src=\"images/small-x.png\" alt=\"\"/> "+selected_value+"</a> > ";
228				}
229				else
230				{
231					document.getElementById("label_"+type).innerHTML+="<a href=\"javascript:cancelDropDown('"+type+"','"+lang+"')\"><img src=\"images/small-x.png\" alt=\"\"/> "+selected_value+"</a> > ";	
232				}
233			}
234		}	
235
236		
237		for(j = 0; j < splitArray.length; j++)
238		{
239			var location = splitArray[j].split("#");
240		
241			if(location[0]=="no suggestion"||location[1]=="no suggestion"||location[0]=="")
242			continue;
243			
244			drop_down.options[j+1] = new Option(location[0],location[1]+"@"+location[0]);
245		
246		}
247	}
248}
249
250function GoBack()
251{
252	history.back();
253}
254
255function SuggestLocation(obj)
256{
257	if(obj.id=="job_location")
258    {
259		RequestSuggestions(obj.value,"location","","en")
260	}
261	else
262	if(obj.id=="job_category")
263    {
264		RequestSuggestions(obj.value,"category","","en")
265	}
266}
267
268
269function SuggestWord(obj,s_type,lang="en")
270{
271	RequestWordSuggestions(obj.value,"word","",lang,s_type)
272}
273
274
275function RequestWordSuggestions(selected_location,type,selected_value,lang,s_type)
276{
277	lang = typeof lang !== 'undefined' ? lang : "en";
278	
279	if (window.XMLHttpRequest)
280	{
281		xmlhttp=new XMLHttpRequest();
282	}
283	else
284	{
285		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
286	}
287	xmlhttp.onreadystatechange=function()
288	{
289		if (xmlhttp.readyState==4 && xmlhttp.status==200)
290		{
291			FillWordSuggestions(xmlhttp.responseText,type,selected_value,selected_location,lang);
292		}
293	}
294	
295	xmlhttp.open("GET","include/suggest_"+type+"2.php?q="+selected_location+"&lang="+lang+"&type="+s_type,true);
296	xmlhttp.send(null);
297
298}
299
300function RequestSuggestions(selected_location,type,selected_value,lang)
301{
302	lang = typeof lang !== 'undefined' ? lang : "en";
303	
304	if (window.XMLHttpRequest)
305	{
306		xmlhttp=new XMLHttpRequest();
307	}
308	else
309	{
310		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
311	}
312	xmlhttp.onreadystatechange=function()
313	{
314		if (xmlhttp.readyState==4 && xmlhttp.status==200)
315		{
316			FillSuggestions(xmlhttp.responseText,type,selected_value,selected_location,lang);
317		}
318	}
319	
320	xmlhttp.open("GET","include/suggest_"+type+"2.php?q="+selected_location+"&lang="+lang,true);
321	xmlhttp.send(null);
322
323}
324
325function FillWordSuggestions(text,type,selected_value,selected_location,lang)
326{
327	
328	if(text!="" && text!="no suggestion")
329	{
330		lang = typeof lang !== 'undefined' ? lang : "en";
331		
332		
333		var new_html="";
334		var splitArray = text.split("~");
335
336		var j = 0;
337	
338		var suggest_html="";
339		
340		for(j = 0; j < splitArray.length; j++)
341		{
342			var suggestion = splitArray[j].split("#");
343		
344			if(suggestion[0]=="no suggestion"||suggestion[1]=="no suggestion"||suggestion[1]=="")
345			continue;
346			
347			suggest_html+='<a class="dropdown-item" href="javascript:SelectWord(\''+suggestion[1]+'\')">'+suggestion[1]+'</a>';
348		
349		}
350				
351		document.getElementById(type+"_suggest").innerHTML=suggest_html;
352		document.getElementById(type+"_suggest").style.display="block";
353		
354	}
355}
356
357
358function clear_selections()
359{
360	document.getElementById("word_suggest").style.display="none";
361	document.getElementById("location_suggest").style.display="none";
362}
363
364function FillSuggestions(text,type,selected_value,selected_location,lang)
365{
366	
367	if(text!="" && text!="no suggestion")
368	{
369		lang = typeof lang !== 'undefined' ? lang : "en";
370		
371		
372		var new_html="";
373		var splitArray = text.split("~");
374
375		var j = 0;
376	
377		var suggest_html="";
378		
379		for(j = 0; j < splitArray.length; j++)
380		{
381			var location = splitArray[j].split("#");
382		
383			if(location[0]=="no suggestion"||location[1]=="no suggestion"||location[0]=="")
384			continue;
385			
386			suggest_html+='<a class="dropdown-item" href="javascript:SelectType(\''+location[0]+'\',\''+location[1]+'\',\''+type+'\')">'+location[1]+'</a>';
387		
388		}
389				
390		document.getElementById(type+"_suggest").innerHTML=suggest_html;
391		document.getElementById(type+"_suggest").style.display="block";
392		
393	}
394}
395
396function SelectType(location_id,location_name,type="location")
397{
398	document.getElementById(type).value=location_id;
399	document.getElementById("job_"+type).value=location_name;
400	document.getElementById(type+"_suggest").style.display="none";
401}
402
403function SelectWord(word)
404{
405	document.getElementById("job_title").value=word;
406	document.getElementById("word_suggest").style.display="none";
407}
408
409if(typeof show_login !== 'undefined') 
410{
411  $(document).ready(function()
412  {
413     $("#login-modal").modal('show');
414   });  
415}
416
417
418
419
420
421
422
423function sub_cat_select(x)
424{
425	
426	if(x=="") return;
427	
428	if (window.XMLHttpRequest)
429	{
430		xmlhttp=new XMLHttpRequest();
431	}
432	else
433	{
434		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
435	}
436	xmlhttp.onreadystatechange=function()
437	{
438		if (xmlhttp.readyState==4 && xmlhttp.status==200)
439		{
440			show_sub_cats(xmlhttp.responseText,x);
441		}
442	}
443	if(typeof loc_type !== 'undefined' && loc_type=="admin")
444	{
445		xmlhttp.open("GET","../include/suggest_category.php?location="+x+"&q=",true);
446	}
447	else
448	{
449		xmlhttp.open("GET","include/suggest_category.php?location="+x+"&q=",true);
450	}
451	xmlhttp.send(null);
452	
453}
454var up_html = new Array();
455var i_last_level = -1;
456function show_sub_cats(text,x)
457{
458	var i_level = (x.split(".").length - 1);
459
460	for(i=i_level;i<=4;i++)
461	{
462		document.getElementById("sub_categories"+i).innerHTML="";	
463	}
464	
465	var new_html="";
466	var splitArray = text.split("~");
467
468	var j = 0;
469	for(j = 0; j < splitArray.length; j++)
470	{
471		var location = splitArray[j].split("#");
472		 
473		if(location[0]=="no suggestion")
474		{
475			
476			
477		}
478		else
479		{
480			new_html += "<option value=\""+location[1]+"\">"+location[0]+"</option>";
481		}
482	}
483	
484	if(new_html!="")
485	{
486		new_html ='<select onChange="sub_cat_select(this.value)" type="text" class="form-control input-sm" id="category'+i_level
486+'" name="category'+i_level+'" style="margin-top:8px !important">'
487		+'<option value="">'+(typeof m_all !== 'undefined'?m_all:"All")+'</option>'+new_html+'</select>';
488		document.getElementById("sub_categories"+i_level).innerHTML=new_html;
489	}
490	
491	i_last_level = i_level
492}	
493
494
495
496
497
498function sub_loc_select(x)
499{
500	
501	if(x=="") return;
502	
503	
504	
505	if (window.XMLHttpRequest)
506	{
507		xmlhttp=new XMLHttpRequest();
508	}
509	else
510	{
511		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
512	}
513	xmlhttp.onreadystatechange=function()
514	{
515		if (xmlhttp.readyState==4 && xmlhttp.status==200)
516		{
517			show_sub_locs(xmlhttp.responseText,x);
518		}
519	}
520	if(typeof loc_type !== 'undefined' && loc_type=="admin")
521	{
522		xmlhttp.open("GET","../include/suggest_location.php?location="+x+"&q=",true);
523	}
524	else
525	{
526		xmlhttp.open("GET","include/suggest_location.php?location="+x+"&q=",true);
527	}
528	xmlhttp.send(null);
529	
530}
531var up_html_loc = new Array();
532var i_last_level_loc = -1;
533function show_sub_locs(text,x)
534{
535	var i_level = (x.split(".").length - 1);
536
537	for(i=i_level;i<=4;i++)
538	{
539		document.getElementById("sub_locations"+i).innerHTML="";	
540	}
541	
542	var new_html="";
543	var splitArray = text.split("~");
544
545	var j = 0;
546	for(j = 0; j < splitArray.length; j++)
547	{
548		var location = splitArray[j].split("#");
549		 
550		if(location[0]=="no suggestion")
551		{
552			
553			
554		}
555		else
556		{
557			new_html += "<option value=\""+location[1]+"\">"+location[0]+"</option>";
558		}
559	}
560	
561	if(new_html!="")
562	{
563		new_html ='<select onChange="sub_loc_select(this.value)" type="text" class="form-control input-sm" id="category'+i_level+'" name="category'+i_level+'" style="margin-top:8px !important">'
564		+'<option value="">'+(typeof m_all !== 'undefined'?m_all:"All")+'</option>'+new_html+'</select>';
565		document.getElementById("sub_locations"+i_level).innerHTML=new_html;
566	}
567	
568	i_last_level_loc = i_level
569}	
570
571$('.dropdown > a').click(function() {
572 if (!$(this).hasClass("parent-clicked")) {
573    $(this).addClass("parent-clicked");
574  } else {
575    location.href = this.href;
576  }
577});

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.