   /***************************************************************************/
   /** Slideshow viewing
   /***************************************************************************/
   function setup_slideshow(){
      var myFile     = document.location.toString();
      var arr        = myFile.split('#');
      var id         = "";
      var firstID    = "f"+$("div.slideshow ul li img").attr("id");

      if (!myFile.match('#') || arr[1]== NaN) {
         id = firstID;
      }else{
         // should probably do a validity check on given id, but let's worry about that later
         id = arr[1];
      }
      document.location = arr[0] + '#' + id;
      show_image(id);

      // fix the issue with the url
      $("a[href='"+arr[0]+"']").bind("click", function(){show_first_image();});
      $("a[href='"+arr[0]+"']").attr({href: "javascript:void(0);"});

      // as part of the setup, set up the next and prev buttons
      $("span.previous a").bind("click", function(){flip_photo("p");});
      $("span.next a").bind("click", function(){flip_photo("n");});
      $("div.slideshow ul li img").bind("click", function(){flip_photo("n");});
      setupKeyNav();

      // setup back button support
      $.history.init(show_image);
   }

   /***************************************************************************/
   function setupKeyNav(){
      if( document.captureEvents ) {
         //non IE
         if( Event.KEYUP ) {
         //NS 4, NS 6+, Mozilla 0.9+
            document.captureEvents( Event.KEYUP );
         }
      }
      // when a key is pressed, run the alertkey function
      document.onkeyup = alertkey;
   }

   /***************************************************************************/
   /** process the key event
   /***************************************************************************/
   function alertkey(e) {
      if( !e ) {
         if( window.event ) {
            e = window.event;
         } else {
            return;
         }
      }

      if( typeof( e.which ) == 'number' ) {
         //NS 4, NS 6+, Mozilla 0.9+, Opera
         e = e.which;
      } else if( typeof( e.keyCode ) == 'number'  ) {
         //IE, NS 6+, Mozilla 0.9+
         e = e.keyCode;
      } else if( typeof( e.charCode ) == 'number'  ) {
         //also NS 6+, Mozilla 0.9+
         e = e.charCode;
      } else {
         return;
      }
    
      // left arrow
      if (e==37){
         flip_photo("p");
      }else if (e==39){
         flip_photo("n");
      }
   }


   /***************************************************************************/
   function show_first_image(){
      var myFile     = document.location.toString();
      var arr        = myFile.split('#');
      var firstID    = "f"+$("div.slideshow ul li img").attr("id");
      document.location = arr[0] + '#' + firstID;
      show_image(firstID);
   }

   /***************************************************************************/
   function show_image(id){
      $("div.slideshow ul li").hide();
      $("div.slideshow ul li img#"+id.substring(1)).parent().show();
   }

   /***************************************************************************/
   function flip_photo(direction){
      var myFile     = document.location.toString();
      var arr        = myFile.split('#');
      var id         = arr[1].substring(1);
      var newID      = 0;
      if(direction == "n"){
         newID = $("div.slideshow ul li img#"+id).parent().next("li").children("img").attr("id");
         if (newID == undefined){
            newID = $("div.slideshow ul li:first img").attr("id");
         }
      }else{
         newID = $("div.slideshow ul li img#"+id).parent().prev("li").children("img").attr("id");
         if (newID == undefined){
            newID = $("div.slideshow ul li:last img").attr("id");
         }
      }
      newID = "f"+newID;
      document.location = arr[0] + '#' + newID;
      show_image(newID);
   }


   /***************************************************************************/
   /** Subnav Styling
   /***************************************************************************/

   var bcSepImg   = new Image();
   var bcSepImgR  = new Image();
   var bcSepImgL  = new Image();
   var bcEndImg   = new Image();
   var bcEndImgR  = new Image();
   var glSepImg   = new Image();
   var glSepImgL  = new Image();
   var scriptroot = "http://www.sinnick.com/";
   bcSepImg.src   = scriptroot + "images/bc_separator.gif";
   bcSepImgR.src  = scriptroot + "images/bc_separator_rightrollover.gif";
   bcSepImgL.src  = scriptroot + "images/bc_separator_leftrollover.gif";
   bcEndImg.src   = scriptroot + "images/bc_end.gif";
   bcEndImgR.src  = scriptroot + "images/bc_separator_endrollover.gif";
   glSepImg.src   = scriptroot + "images/gl_separator.gif";
   glSepImgL.src  = scriptroot + "images/gl_separator_leftrollover.gif";

   /***************************************************************************/
   function setup_subnav(){
      setup_breadcrumbs()
      setup_global_links();
   }

   /***************************************************************************/
   function setup_breadcrumbs(){
      var cssOff     = { 'background-image' : 'url('+bcSepImg.src+')' };
      var cssOffLast = { 'background-image' : 'url('+bcEndImg.src+')' };
      var cssOn      = { 'background-image' : 'url('+bcSepImgR.src+')' };
      var cssOnLast  = { 'background-image' : 'url('+bcEndImgR.src+')' };
      var cssPrevOn  = { 'background-image' : 'url('+bcSepImgL.src+')' };

      var overFn  = function (){
         $(this).css(cssOn);
         $(this).parent().prev("li").children("a").css(cssPrevOn);
      };
      var offFn   = function (){
         $(this).css(cssOff);
         $(this).parent().prev("li").children("a").css(cssOff);
      };
      var overLastFn  = function (){
         $(this).css(cssOnLast);
         $(this).parent().prev("li").children("a").css(cssPrevOn);
      };
      var offLastFn   = function (){
         $(this).css(cssOffLast);
         $(this).parent().prev("li").children("a").css(cssOff);
      };

      $("#breadcrumb a").css(cssOff);
      $("#breadcrumb a").hover(overFn, offFn);
      $("#breadcrumb a:last").css(cssOffLast);
      $("#breadcrumb a:last").hover(overLastFn, offLastFn);
   }

   /***************************************************************************/
   function setup_global_links(){
      var cssOff  = { 'background-image' : 'url('+glSepImg.src+')' };
      var cssOn   = { 'background-image' : 'url('+glSepImgL.src+')' };
      var overFn  = function (){$(this).css(cssOn);};
      var offFn   = function (){$(this).css(cssOff);};

      $("#global a").css(cssOff);
      $("#global a").hover(overFn, offFn);
   }
