function toggleEmployeesVisibility() { if ($('#employeesVisibility').attr('checked')) $('div.employees').show(); else $('div.employees').hide(); } function toggleHighlightSupervisor() { if ($('#highlightSupervisor').attr('checked')) $('span.employeesupervisor').css('font-weight', 'bold'); else $('span.employeesupervisor').css('font-weight', 'normal'); } function toggleOrgchartPathVisibility() { if ($('#orgchartPathVisibility').attr('checked')) { $('span.orgchartPath').css('visibility', 'visible').show(); } else { if ($('#orgchartPathIndentation').attr('checked')) $('span.orgchartPath').show().css('visibility', 'hidden'); else $('span.orgchartPath').hide(); } } function printAction() { window.print(); } function bindEvents() { $('#employeesVisibility').click(toggleEmployeesVisibility); $('#highlightSupervisor').click(toggleHighlightSupervisor); $('#orgchartPathVisibility').click(toggleOrgchartPathVisibility); $('#printButton').click(printAction); } function initialSetup() { toggleEmployeesVisibility(); toggleHighlightSupervisor(); toggleOrgchartPathVisibility(); } function pageLoad() { bindEvents(); initialSetup(); } $(window).load(pageLoad);