There were two problems:
- your code was never getting called except on initial page load. You need to call it from your click events that change the visibility of the items you are checking.
- you had a timer on your toggle, so the item you were hiding/showing wasn't hidden/shown immediately... but the check to see if it was visible would have been done before that was finished. You should use a callback on the toggle to call your code checking visibility
$('#NHS').click(function () {
$('#NHS-Content').toggle(400, foo);
...
function foo() {
if ($('#NHS-Content').is(':visible') || $('#PE-Conten ...
If you are interested, I cleaned up your code quite a bit (went from 41 to 21 lines) in this example with some minor changes to the dom: