﻿
function trap()
{
    /* trap() is called by all .htm files at this site
    * (except sonalAtomsAudio.htm).
    * It ensures that they are never displayed directly.
    * Instead, the corresponding .html file is displayed.
    * (This displays them in a frame to the right of the global menu)
    *
    * The <title> of this .htm file is set to the title of the .html file.
    *
    * Adapted from the break-out-of-frames script at
    * http://www.javascriptkit.com/script/cut36.shtml (see below).
    * Note that if top.location.href changes, this script gets called again,
    * resulting in a visible blink of the left menu if it was already being displayed!
    * So, when referencing an external file from an .htm file,
    * always reference the .html version directly.  
    */

    var loc = top.location.href;
    var nameIndex = loc.lastIndexOf("/") + 1;
    var name = loc.substring(nameIndex);
    var suffixIndex = loc.lastIndexOf(".");
    var suffix = loc.substring(suffixIndex);

    if(name == "contents.htm")
    {
        top.location.href = loc.replace("contents.htm", "index.html");
    }
    else if(suffix == ".htm")
    {
        top.location.href = loc.replace(".htm", ".html");
    }
    document.title = top.document.title;
}

function unTrap()
{
    /*
     * Break-out-of-frames script
     * By JavaScript Kit (http://javascriptkit.com)
     * Over 400+ free scripts here!
     * Above notice MUST stay entact for use
     *
     * unTrap() is called by all .html files at this site.
     * It ensures that they cannot be included in higher level frames.
     */

    if(window != top)
        top.location.href = location.href;
}

function setImage(imageNameString, image)
{
    /*
    * Called by mouseover and mouseout events to set the image
    * Note that imageNameString must be enclosed in quotes at the calling point.
    * e.g. setImage('labrys', butterfly). 
    */
    document.images[imageNameString].src = image.src
}

function signature(dateString)
{
    /*
     * Called as the last line in the <body> of an .htm file to set its copyright.
     *
     * Example (inside an .htm file):     
     *          <script type="text/javascript">signature('January 2009')</script>
     *      </body>    ...
     */

    /*
     * document.write("<p class='signature'>&copy; copyright James Ingram, www " + dateString + "</p>");
     */
    document.write("<p class='signature'>ji, www " + dateString + "</p>");
}





