mpog-search.js
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(function(){
function show_institutions_fields() {
jQuery(".institution_fields").show();
jQuery(".software_fields").hide();
jQuery(".community_fields").hide();
}
function show_software_fields() {
jQuery(".institution_fields").hide();
jQuery(".software_fields").show();
jQuery(".community_fields").hide();
}
function show_community_fields() {
jQuery(".institution_fields").hide();
jQuery(".software_fields").hide();
jQuery(".community_fields").show();
}
function display_search_fields_on_page_load() {
var active_search = jQuery(".search_type input[checked='checked']").val();
switch(active_search) {
case "Community": show_community_fields(); break;
case "Software": show_software_fields(); break;
case "Institution": show_institutions_fields(); break;
default: show_community_fields();
}
}
function set_events() {
display_search_fields_on_page_load();
jQuery("#type_Community").click(show_community_fields);
jQuery("#type_Software").click(show_software_fields);
jQuery("#type_Institution").click(show_institutions_fields);
}
jQuery(document).ready(set_events);
})();