$(document).ready(function() { var resettabs = true; // if page is loaded and no tab active, make first tabactive if ($("#simloket_tabs")) { $("#simloket_tabs li").each(function(index) { if($(this).hasClass('simloket_tab_active') == true){ resettabs = false; $("div.simloket_tab_content").hide(); var id = $(this).attr("id"); var split = id.split("_"); $(this).addClass("simloket_tab_active"); $("#simloket_tabs_content_" + split[2]).show(); return false; } else{ $(this).removeClass("simloket_tab_active"); } }); var id_first = $("#simloket_tabs li:first").attr("id"); if (id_first && resettabs === true) { $("#simloket_tabs li:first").addClass("simloket_tab_active"); var onderdeel_type = id_first.split("_", 3); $("#simloket_tabs_content_" + onderdeel_type[2]).show(); } // when tab is clicked $("#simloket_tabs li").bind( "click", function() { // remove active tab and hide content $("#simloket_tabs li").removeClass( "simloket_tab_active"); $("div.simloket_tab_content").hide(); // make clicked tab active and show content var id = $(this).attr("id"); var split = id.split("_"); $(this).addClass("simloket_tab_active"); $("#simloket_tabs_content_" + split[2]).show(); return false; }) } $("#sc_other_governments_options").hide(); display_extra_search_fields(); }); function display_extra_search_fields() { if ($("#sc_other_governments").is(':checked')) { $("#sc_other_governments_options").toggle(); } $("#sc_other_governments").click(function() { $("#sc_other_governments_options").toggle('fast'); $("#sc_waterschappen").attr('checked','checked'); $("#sc_provincies").attr('checked','checked'); $("#sc_rijksoverheid").attr('checked','checked'); }); }