////////////////////////////////// LOAD MENU FOR SPECIFIC SECTIONS /////////////////////////////////////

var pathToIms = "./";

// global main navigation menu array
var the_sections_alt = new Array('Home - Introduction, Mailing List and Contact Details',
                                 'Walks - Upcoming Walks and Guides, Previous Walks and Adventures',
                                 'The Walkers - the regulars',
                                 'FAQs, Reviews and Useful Links',
                                 'Explore the Photo Galleries');

var the_sections_names = new Array('Home',
                                 'Walks',
                                 'Walkers',
                                 'FAQs',
                                 'Photos');

var the_sections_link = new Array('index.html',
                                  'walks.html',
                                  'walkers.html',
                                  'faqs.html',
                                  'galleries.html');
var the_sections_normalimages = new Array(pathToIms + 'ims/homenormal.jpg',
                                          pathToIms + 'ims/walksnormal.jpg',
                                          pathToIms + 'ims/walkersnormal.jpg',
                                          pathToIms + 'ims/faqsnormal.jpg',
                                          pathToIms + 'ims/photonormal.jpg');
var the_sections_currentimages = new Array(pathToIms + 'ims/homecurrent.jpg',
                                           pathToIms + 'ims/walkscurrent.jpg',
                                           pathToIms + 'ims/walkerscurrent.jpg',
                                           pathToIms + 'ims/faqscurrent.jpg',
                                           pathToIms + 'ims/photocurrent.jpg');
var the_sections_overimages = new Array(pathToIms + 'ims/homeover.jpg',
                                        pathToIms + 'ims/walksover.jpg',
                                        pathToIms + 'ims/walkersover.jpg',
                                        pathToIms + 'ims/faqsover.jpg',
                                        pathToIms + 'ims/photoover.jpg');
var the_sections_image_widths = new Array('40',
                                          '42',
                                          '82',
                                          '145',
                                          '87');

var numNavMenus = the_sections_alt.length;


// global sub navigation menus within sections
var subsection_Home = new Array("Welcome","Mailing List","Contact Us","Disclaimer");
var subsection_Home_Short = new Array("Welcome","Mailing List","Contact Us","Disclaimer");
var subsection_Home_Links = new Array("index.html","newsletter.html","contact.html","disclaimer.html");

var subsection_Walks = new Array("Upcoming Walks","Past Walks","Liz and Mikes'<br>Adventures","Routes/Maps");
var subsection_Walks_Short = new Array("Upcoming","Previous","Adventures","Routes/Maps");
var subsection_Walks_Links = new Array("walks.html","prevwalks.html","adventures.html","routes.html");

var subsection_Walkers = new Array("Regular Walkers");
var subsection_Walkers_Short = new Array("Regulars");
var subsection_Walkers_Links = new Array("walkers.html");

var subsection_FAQs = new Array("FAQs","Reviews","Useful Links");
var subsection_FAQs_Short = new Array("FAQs","Reviews","Links");
var subsection_FAQs_Links = new Array("faqs.html","reviews.html","links.html");

var subsection_Photos = new Array("Photo Galleries");
var subsection_Photos_Short = new Array("Galleries");
var subsection_Photos_Links = new Array("galleries.html");

var the_subsections_names = new Array(subsection_Home,subsection_Walks,subsection_Walkers,subsection_FAQs,subsection_Photos);
var the_subsections_names_short = new Array(subsection_Home_Short,subsection_Walks_Short,subsection_Walkers_Short,subsection_FAQs_Short,subsection_Photos_Short);
var the_subsections_links = new Array(subsection_Home_Links,subsection_Walks_Links,subsection_Walkers_Links,subsection_FAQs_Links,subsection_Photos_Links);


function setupNavMenus(curPage){
        for(var i=0; i<numNavMenus; i++){
                  if(i==curPage){
                       document.write("<td align='left' valign='bottom' width='" + the_sections_image_widths[i] + "'><a href='" + the_sections_link[i] + "' ><img name='" + the_sections_names[i] + "' src='" + the_sections_currentimages[i] + "' alt='" + the_sections_alt[i] + "' border='0'></a></td>");
                  }
                  else{
                       document.write("<td align='left' valign='middle' width='" + the_sections_image_widths[i] + "'><a href='" + the_sections_link[i] + "' onMouseOver=\"imageSwap(" + the_sections_names[i] + ",'" + the_sections_overimages[i] + "')\" onMouseOut=\"imageSwap(" + the_sections_names[i] + ",'" + the_sections_normalimages[i] + "');\"><img name='" + the_sections_names[i] + "' src='" + the_sections_normalimages[i] + "' alt='" + the_sections_alt[i] + "' border='0'></a></td>");
                  }
                  if(i<numNavMenus-1){
                          //document.write("&nbsp;&nbsp;¦&nbsp;&nbsp;");
                  }
                  if(i<numNavMenus){
                     document.write("<td width='10' align='left' valign='middle'><img src='" + pathToIms + "ims/split.jpg'></td>");
                  }
        }

}

function setupSubNavMenus(curSection,curPage){
       var subsection_NamesToUse = the_subsections_names[curSection];
       var subsection_LinksToUse = the_subsections_links[curSection];
       var loopLength = subsection_NamesToUse.length;

       for(var i=0; i<loopLength; i++){
                  if(i==curPage){
                     // print this element in the highlighted style
                     document.write("<tr><td align='right'><a href='" + subsection_LinksToUse[i] + "' class='subnavcurrent'>" + subsection_NamesToUse[i] + "</a></td></tr>");
                  }
                  else{
                     // print this element as normal
                     document.write("<tr><td align='right'><a href='" + subsection_LinksToUse[i] + "' class='subnavlink'>" + subsection_NamesToUse[i] + "</a></td></tr>");
                  }

       }
}

// this function will always have fixed values:
function writeQuickFind(){
         document.write("<option value='#' class='dropformheading'>QuickFind...</option>");
         //document.write("<option value='' class='dropformheading'></option>");
         for(var i=0; i<numNavMenus; i++){
             document.write("<option value='#'></option>");

             var subsectioncount = the_subsections_names_short[i].length;
             document.write("<option value='" + the_sections_link[i] + "' class='dropformheading'>" + the_sections_names[i] +  "</option>");

             for(j=0; j<subsectioncount; j++){
                 document.write("<option value='" + the_subsections_links[i][j] + "' class='dropform'>" + the_subsections_names_short[i][j] +  "</option>");
             }
         }
}
////////////////////////////////// END LOAD MENU ///////////////////////////////////////////////////////

function doPreload(){
        preloadImages(the_sections_overimages);
}

function preloadImages(the_images_array) {
        for(loop = 0; loop < the_images_array.length; loop++)
        {
           var an_image = new Image();
                an_image.src = the_images_array[loop];
        }
}


function imageSwap(daImage, daSrc){
        var objStr,obj;
        // Check to make sure that images are supported in the DOM.
        if(document.images){
           // Check to see whether you are using a name, number, or object
           if (typeof(daImage) == 'string') {
               // This whole objStr nonesense is here solely to gain compatability
               // with ie3 for the mac.
               objStr = 'document.' + daImage;
               obj = eval(objStr);
               obj.src = daSrc;
           }
           else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
               daImage.src = daSrc;
           }
        }
}