/* --------------- STUDIO CONNECTIONS EXTERNAL JAVASCRIPT FILE -------------- */
/*                                                                            */
/*    Description: Mini page header and navigation system for subpages        */
/*                 with automatic page heading and submenu generator.         */
/*                 Relies on the existence of the "MiniMenu" array.           */
/*         Client: Cloud Studios - info@cloudstudios.com                      */
/*        Website: www.cloudstudios.com                                       */
/*         Author: Colin Abrahams - colin@studioconnections.net.au            */
/*      Copyright: 2008 Colin Abrahams, Studio Connections                    */
/*       Location: Wyong, NSW, Australia                                      */
/*        Version: SC-5.8                                                     */
/*   Last Updated: 2008-11-25                                                 */


// Determine Contents Page name and location
PageAddr = document.location.href;
PagePath = PageAddr.substring(0, PageAddr.lastIndexOf("/"));
PageRoot = PagePath.substring(0, PagePath.lastIndexOf("/"));
ContName = PageRoot.substr(PageRoot.lastIndexOf("/") + 1);
ContAddr = PageRoot + "/Intro/" + ContName + ".html";

// Extract current page name from document title
// Standard SC document title format: websitename + " - " + pagetitle
PageTitl = document.title;
h = PageTitl.indexOf("-");
PageName = h > 0 ? PageTitl.substr(h + 2) : PageTitl;

// Find this item number in MiniMenu array
ItemNo = -1;
if (top.Upper && top.MiniMenu) {
  for (i = 0; i < top.MiniMenu.length; i++) {
    if(escape(document.location.href) == escape(top.MiniMenu[i].Addr)) {
      ItemNo = i;
      break;
    }
  }
}

document.write('<div class="MiniHeader">'
             + '<table border="0" cellspacing="0" cellpadding="0"><tr>');

// Page title
document.write('<td width="284"><div id="MiniTitle"><b>'
             + ContName + ' -&gt; ' + PageName + '</b></div></td>');

// MiniMenu
document.write('<td width="155" align="center"><div class="MiniMenu">');
if (document.getElementById) {
  document.write('<span class="MiniBDL">&nbsp;</span>');
}
if (ItemNo > 0 && top.MiniMenu[ItemNo - 1].SubP == ContAddr) {
  document.write('<a '
               + 'onmouseover="window.BTSel ? BTSel(this) : null" '
               + 'onmouseout= "window.BTOut ? BTOut(this) : null" '
               + 'onmousedown="window.BTDep ? BTDep(this) : null" '
               + 'onclick="return window.BTClick ? BTClick(this) : true" '
               + 'title="' + top.MiniMenu[ItemNo - 1].Desc + '" '
               + 'href="' + top.MiniMenu[ItemNo - 1].Addr
               + '"><span>Prev</span></a>'
               + '<span class="MiniSep">&nbsp;&nbsp;&nbsp;</span>');
}
document.write('<a '
             + 'onmouseover="window.BTSel ? BTSel(this) : null" '
             + 'onmouseout= "window.BTOut ? BTOut(this) : null" '
             + 'onmousedown="window.BTDep ? BTDep(this) : null" '
             + 'onclick="return window.BTClick ? BTClick(this) : true" '
             + 'title="Go to ' + ContName + ' Contents Page" '
             + 'href="' + ContAddr
             + '"><span>Contents</span></a>');
if (ItemNo >= 0 && ItemNo < top.MiniMenu.length - 1
  && top.MiniMenu[ItemNo + 1].SubP == ContAddr) {
  document.write('<span class="MiniSep">&nbsp;&nbsp;&nbsp;</span><a '
               + 'onmouseover="window.BTSel ? BTSel(this) : null" '
               + 'onmouseout= "window.BTOut ? BTOut(this) : null" '
               + 'onmousedown="window.BTDep ? BTDep(this) : null" '
               + 'onclick="return window.BTClick ? BTClick(this) : true" '
               + 'title="' + top.MiniMenu[ItemNo + 1].Desc + '" '
               + 'href="' + top.MiniMenu[ItemNo + 1].Addr
               + '"><span>Next</span></a>');
}
if (document.getElementById) {
  document.write('<span class="MiniBDR">&nbsp;</span>');
}
document.write('</div></td>');

document.write('<td width="284"></td>');

document.write('</tr></table></div>\n');

// Extra vertical space for print version or when extended CSS not supported
document.write('<div class="SpaceV">&nbsp;</div>\n');
