Story and Section Nav Scripts
These scripts (setflips, flipblock, flipsect, and setflipsect) are what I call my section and story nav list scripts. They are generated by a template in Bricolage (the CMS I use to generate this site) and updated every time a story is published within their scope. For example. Every time I create a new subsection within the Scripting section of this site, /includes/scriptingnavlist/scriptingnavlist.php is updated with information about the new subsection.
The two sets of scripts are very similar, because they do very similar tasks, but have subtle diffrences in their output. Rather than complicate my life by tryig to make one really big script that does everything, I chose to make two simillar smaller sets of scripts that are easier to work with.
The function Setflips is called by an onload event handler. It goes through and sets up the titlesarray, and compares the names in that array with the title of the current page. If the two match, the block that corresponds with the loop number is set to display.
If after looping through all the titles in the array, there is no match, as shown by the displayed flag being set to 0, block1 is set to display. This default behavior exists because section index pages also display a list of stories within the section, and their titles never match the titles array.
Blocks of Four
When a user clicks on any of the arrow links that surround each block of links, they invoke the Flip function. Flip then goes through and turns off all blocks that don't match the number passed to it via an onclick event handler, and turns on the block that matches.