I have been encouraged to come up with a display of only those legend items that are currently in use. After considerable reluctance I decided to try it, and the project wasn't nearly as difficult as I had imagined.
The advvorecast2.php script contains routines similar to those needed for this project. The php strpos() function was all that was necessary after I borrowed the 'fetchUrlWithoutHanging()' routine from there. The display required tweaking, as did the text. There is no longer any reason to toggle the legend.
One potential show-stopper for those who are sticklers for w3c validation is that because the NWS uses duplicate color ID's, the script more often than not fails validation because of this. Checking the NWS page where the alerts map appears, their main page
www.weather.gov, shows 314 validation errors, so they're obviously not too concerned with the standards. Nevertheless
on my page I have loaded my failsafe footer, 'footer-invalid.php' where no W3C compliant stickers or links appear. Personal choice, I guess.
The attached 'wxusalerts-all.zip' contains 'wxusalerts-all.php' and 'wxusalerts-all.css' in order to differentiate this script from the original. Renaming 'wxusalerts-all.php' to 'wxusalerts.php' prior to uploading both files to your site is all that should be necessary in order to swap the new script into your menu system.