
var cdPaths_array = new Array (

"/Vista/index.html","Vista",
"/Vista/Connectingtoanetworkprint.html","Connecting to a network printer",
"/Vista/NetworkingtoSamba.html","Networking to Samba",
"/Thunderbird/extensions.html","extensions",
"/Thunderbird/index.html","Thunderbird",
"/Miscelleous/phpsurveyorerror.html","PHPSurveyor error",
"/Miscelleous/Intelprocessornumbers.html","Intel processor numbers",
"/Miscelleous/GetphysicallocationfromIP.html","Get physical location from IP address",
"/Miscelleous/Defaultpasswords.html","Default passwords",
"/Miscelleous/Acrobat7comments.html","Enabling commenting in PDFs",
"/Miscelleous/Yearcalendars.html","Year calendars",
"/Miscelleous/index.html","Miscellaneous",
"/Office/ConvertinganSQLdateinExce.html","Converting an SQL date in Excel",
"/Office/ExtractingimagesfromWord.html","Extracting images from Word",
"/Office/index.html","Office",
"/index.html","Brain dump",
"/Firefox/Deletingentriesinatextfie.html","Deleting entries in a text field",
"/Firefox/extensions.html","Extensions",
"/Firefox/bluepages.html","Bluepages plugin",
"/Firefox/adblocking.html","Ad Blocking",
"/Firefox/popupads.html","Pop-up ads using Flash",
"/Firefox/Speedups.html","Speedups",
"/Firefox/Acrobatplugin.html","Acrobat plugin",
"/Firefox/WindowscannotopenWebsite.html","Windows cannot open Web site",
"/Firefox/Newtabsopeninthebackgroun.html","New tabs open in the background",
"/Firefox/index.html","Firefox",
"/Photography/filters.html","Four "must have" filters",
"/Photography/EXIF-awareapplications.html","EXIF-aware applications",
"/Photography/NikonD70EXIFbug.html","Nikon D70 EXIF bug",
"/Photography/PSPandEXIFdata.html","PSP and EXIF data",
"/Photography/CompactFlashnamingstandar.html","Compact Flash naming standards",
"/Photography/Howimportantisthemediawri.html","How important is the media write speed?",
"/Photography/Printingposters.html","Printing posters",
"/Photography/index.html","Photography",
"/PSP/index.html","Paint Shop Pro",
"/PSP/ExtractingimagesfromWord.html","Extracting images from Word",
"/PSP/Rememberthelastfiletypeus.html","Remember the last file type used in Save As",
"/PSP/WhydoesPSPstartwiththeBro.html","Why does PSP start with the Browser when I double click an image file?",
"/ITSO/Reannouncingaresidency.html","Reannouncing a residency",
"/ITSO/index.html","ITSO",
"/IBM/index.html","IBM",
"/IBM/Cantposttoausnews.austin..html","Can't post to ausnews.austin.ibm.com",
"/CityDesk/Includingafileinthelocald.html","Including a file in the local directory",
"/CityDesk/FTPstopsworking.html","FTP stops working",
"/CityDesk/Numberofarticles.html","Number of articles",
"/CityDesk/Keywordsarenotcasesensiti.html","Keywords are not case sensitive",
"/CityDesk/EquivalentofanIFstatement.html","Equivalent of an IF statement",
"/CityDesk/Intra-articleshortcuts.html","Intra-article shortcuts",
"/CityDesk/CodetoinsertanMPGmovie.html","Code to insert an MPG movie",
"/CityDesk/Differentstylesheetsforso.html","Different stylesheets for some pages",
"/CityDesk/Usingsubarticles.html","Using subarticles",
"/CityDesk/Usingastylesheet.html","Using a style sheet",
"/CityDesk/SitesIwanttoremember.html","Sites I want to remember",
"/CityDesk/index.html","CityDesk",
"/IE/CloseallIEopenwindows.html","Close all IE open windows",
"/IE/ReinstallingIE.html","Reinstalling IE 6",
"/IE/Alwaysopenanewbrowserwind.html","Always open a new browser window",
"/IE/ViewSourcewontwork.html","View Source won't work",
"/IE/RemovingtheOEMbranding.html","Removing the OEM branding",
"/IE/favicon.ico.html","favicon.ico",
"/IE/CleverIEbrowserlinkbutton.html","Clever IE browser link buttons",
"/IE/Smoothscrolling.html","Smooth scrolling",
"/IE/StopanimatedGIFs.html","Stop animated GIFs",
"/IE/index.html","Internet Explorer",
"/Explorer/Thumbnailviewwithoutfilef.html","Thumbnail view without file &amp; folder names",
"/Explorer/Associatingfileswithoutex.html","Associating files without extensions as text files",
"/Explorer/FilesecurityonXPHome.html","File security on XP Home",
"/Explorer/ASSOC-displayfileassociat.html","ASSOC - display file associations",
"/Explorer/RestoringtheShowDesktopic.html","Restoring the Show Desktop icon",
"/Explorer/RemovingtheSharedDocument.html","Removing the Shared Documents Folder",
"/Explorer/DisplayingZIPfilesasfolde.html","Displaying ZIP files as folders",
"/Explorer/index.html","Windows Explorer",
"/Windows/Loginpanel.html","Login panel",
"/Windows/MicrosoftPowerShell.html","Microsoft PowerShell",
"/Windows/NetworkMonitorCaptureUtil.html","Network Monitor Capture Utility",
"/Windows/Multi-monitorwallpapers.html","Multi-monitor wallpapers",
"/Windows/TimeServer.html","Time Server",
"/Windows/RemovingEntiresfromAddRem.html","Removing Entires from Add/Remove Programs",
"/Windows/DisabletheSharedDocuments.html","Disable the Shared Documents Folder",
"/Windows/Multi-monitorwallpaper.html","Multi-monitor wallpaper",
"/Windows/EXEandLNKcorruption.html","EXE and LNK corruption",
"/Windows/Reinstallwithoutactivatin.html","Reinstall without activating",
"/Windows/CantsendreceiveoverVPN-MT.html","Can't send/receive over VPN - MTU size",
"/Windows/CLIreference.html","CLI reference",
"/Windows/RemoteDesktopConnectionov.html","Remote Desktop Connection over the Internet",
"/Windows/Disableallstartupprograms.html","Disable all startup programs temporarily",
"/Windows/NTPupdateinterval.html","NTP update interval",
"/Windows/Webtabondesktopproperties.html","Web tab on desktop properties",
"/Windows/Safemode.html","Safe mode",
"/Windows/Shutdownwithoutloggingon.html","Shutdown without logging on",
"/Windows/HowdoIbackupOutlookExpres.html","How do I backup Outlook Express?",
"/Windows/ClearTypeWizard.html","ClearType Wizard",
"/Windows/Taskschedulerlog.html","Task scheduler log",
"/Windows/Windowsfocusandz-order.html","Windows focus and z-order",
"/Windows/Chkdskonthenextboot.html","Chkdsk on the next boot",
"/Windows/Svchost.exe.html","Svchost.exe",
"/Windows/Computerwontshutdown.html","Computer won't shut down",
"/Windows/LogontoXPwithoutapassword.html","Logon to XP without a password",
"/Windows/InstallingNetBEUI.html","Installing NetBEUI on XP",
"/Windows/MSJava.html","MS Java in Windows XP",
"/Windows/Ultimotioncodec.html","Ultimotion codec",
"/Windows/Windowskey.html","Windows key",
"/Windows/Clockautosynchronization.html","Clock auto synchronization",
"/Windows/Changethecolorsofthecomma.html","Change the colors of the command prompt",
"/Windows/Automaticupdates.html","Automatic updates",
"/Windows/index.html","Windows",
"/TemplateMods/ByPersonview.html","ByPerson view",
"/TemplateMods/TurningaNotesdatabasemodi.html","Turning a Notes database mod into a button",
"/TemplateMods/Seewherethesenderfiledano.html","See where the sender filed a note",
"/TemplateMods/Displayaniconfornoteswith.html","Display an icon for notes with return receipts",
"/TemplateMods/Blockreturnreceipts.html","Block return receipts",
"/TemplateMods/AddToandCctotheInbox.html","Add TO and CC indicators to your inbox folder",
"/TemplateMods/index.html","Lotus Notes Template Mods",
"/LotusNotes/OptimizeallimagesasGIFs.html","Optimize all images as GIFs",
"/LotusNotes/Availabilitytimerangeisin.html","Availability time range is invalid",
"/LotusNotes/StartingtheweekonaSunday.html","Starting the week on a Sunday",
"/LotusNotes/Whatthedifferenticonsmean.html","What the different icons mean in Notes",
"/LotusNotes/TurnoffPreventCopy.html","Turn off Prevent Copy",
"/LotusNotes/Swiftfile.html","Swiftfile",
"/LotusNotes/PutadatabaseonCD.html","How to put a database on CD",
"/LotusNotes/ServernamesandfilenameonW.html","Server names and filenames on Workspace icons",
"/LotusNotes/CLI.html","CLI",
"/LotusNotes/Addahotlinkpointingtoaloc.html","Add a hotlink pointing to a local file",
"/LotusNotes/Rebuildingviews.html","Rebuilding views",
"/LotusNotes/Notesicons.html","Notes icons",
"/LotusNotes/Replicatingunreadmarks.html","Replicating unread marks",
"/LotusNotes/Anchorsintra-documentdocl.html","Anchors: intra-document doclinks",
"/LotusNotes/Buttonscolumnheadingsaret.html","Buttons &amp; column headings are the wrong font",
"/LotusNotes/Dragdropattachments.html","Drag &amp; drop attachments",
"/LotusNotes/ByAttachmentsview.html","By Attachments view",
"/LotusNotes/Logoutscreen.html","Logout screen",
"/LotusNotes/Movinglistitemsandtablece.html","Moving list items and table cells easily",
"/LotusNotes/Compactingyourinbox.html","Compacting your mail database",
"/LotusNotes/KillingNotes.html","Killing Notes",
"/LotusNotes/Enteringspecialcharacters.html","Entering special characters",
"/LotusNotes/Notes6columnsortingonbyde.html","Notes 6 column sorting on by default",
"/LotusNotes/SendingreceivingfaxesviaN.html","Sending &amp; receiving faxes via Notes",
"/LotusNotes/index.html","Lotus Notes",
"/FrameMaker/OpeningFMfilesdoesntwork.html","Opening FM files doesn't work",
"/FrameMaker/Changingthedefaultactionf.html","Changing the default action for Paste",
"/FrameMaker/UsingDZbatchertoautomatec.html","Using DZbatcher to automate creating a PDF",
"/FrameMaker/Followingacrossreference.html","Following a cross reference",
"/FrameMaker/AbendMissingimagesimport-.html","Abend: Missing images import-by-ref",
"/FrameMaker/SpaceaftereServerlogo.html","Space after eServer logo",
"/FrameMaker/Whohasafileopen-nameinthe.html","Who has a file open - name in the LCK file",
"/FrameMaker/Indexmarkersdontappearint.html","Index markers don't appear in the index",
"/FrameMaker/Keyboardshortcuts.html","Keyboard shortcuts",
"/FrameMaker/Finddoesntwork.html","Find doesn't work",
"/FrameMaker/Indexbuildingblocks.html","Index building blocks",
"/FrameMaker/Cantsaveafile.html","Can't save a file",
"/FrameMaker/Framefileisinread-onlymod.html","Frame file is in read-only mode",
"/FrameMaker/NameTreeDestsnotdefined.html","Name Tree Dests not defined",
"/FrameMaker/NameTreeDestsdefinedmoret.html","Name Tree Dests defined more than once",
"/FrameMaker/Spellcheckjusttheselected.html","Spellcheck just the selected text",
"/FrameMaker/index.html","FrameMaker",
"","" ); 

cdPaths_array.pop();  
cdPaths_array.pop();

var publishPath = "";
var siteMap = new Menu(cdPaths_array);


function Menu(cdPaths_array) {
    this.cdPaths_array = cdPaths_array;
    this.menuItemHash = new Hash(); 
    this.sectionHash = new Hash();
    this.children = null;
    this.html = "";
    
    
    
    this.createSiteMap =  function createSiteMap(path) { 
    
          var currentPath=unescape(location.pathname);
          currentPath=currentPath.replace(/\\/gi,"/"); 
          var publishPathLength= currentPath.indexOf(path);        
          if (publishPathLength > 0)
          {
            publishPath = currentPath.substring(0, publishPathLength);
          }

        var siteMapHTML = ""
        siteMapHTML += "<div id=\"siteMap\"><ul>"; 
        // loop through sectionHash and call render on the toplevel items
        for (index in this.sectionHash.items) {
            var section = this.sectionHash.items[index];
            var sectionPath = section.getPath(); 
            var parentKey = sectionPath.substring(0,sectionPath.lastIndexOf("/"));
            // if path = "" then this is the home section
            if (parentKey == "") {
                 // render the home section
                 siteMapHTML += section.renderAsHTML();
            } else {
                var temp = parentKey.substring(0,parentKey.lastIndexOf("/"));
                if (temp == "") {
                    // render this toplevel section
                    siteMapHTML += section.renderAsHTML();
                }  
            }
         }
        siteMapHTML += "</ul></div>" 
        this.html = siteMapHTML;  
        return siteMapHTML;
    } 
    this.initMenu = function initMenu() { 
        // we will be using a Hash() with the path as the key
        var menuItem = null;
        var index = 0
        for (index = 0; index < cdPaths_array.length; index += 2) {
            menuItem = new MenuItem(cdPaths_array[index], cdPaths_array[index + 1]);
            this.menuItemHash.setItem(cdPaths_array[index], menuItem); 
        }
        // loop through the menuItemHash and grab all section items
        // a section is identified by having its filename containing "index"
         for (index in this.menuItemHash.items) {
            var menuItem = this.menuItemHash.items[index];
            var path = menuItem.getPath();
            if (path.indexOf("index") >= 0) {
                //this is a section 
                //add it to the sectionHash
                // remove index from path and use as key 
                var sectionKey = path.substring(0,path.lastIndexOf("/")); 
                this.sectionHash.setItem(sectionKey, menuItem); 
            } 
         }  
         // to avoid confusion remove the sectionItems from the menuItemHash
         for (index in this.sectionHash.items) {
            var key = this.sectionHash.items[index].getPath();
            this.menuItemHash.removeItem(key);            
         }  
         // loop through the items in the menuItemHash
         // locate the item's parent
         // add the menuItem object to the parent menuItem object 
         for (index in this.menuItemHash.items) { 
            var menuItem = this.menuItemHash.items[index];
            var itemPath = menuItem.getPath(); 
            var parentKey = itemPath.substring(0,itemPath.lastIndexOf("/"));
            var parent = this.sectionHash.getItem(parentKey);
            parent.add(menuItem); 
         } 
         // loop through the sectionHash
         for (index in this.sectionHash.items) {
            var section = this.sectionHash.items[index];
            var sectionPath = section.getPath(); 
            var parentKey = sectionPath.substring(0,sectionPath.lastIndexOf("/"));
            // if path = "" then this is the home section
            if (parentKey == "") {
                //alert("this is a toplevel section");  
                // do nothing this is a toplevel section
            } else {
                var temp = parentKey.substring(0,parentKey.lastIndexOf("/"));
                if (temp == "") {
                //alert("this is a toplevel section"); 
                // do nothing this is a toplevel section
                }  else {
                   // this is a subsection 
                   var temp = parentKey.substring(0,parentKey.lastIndexOf("/"));
                    var parent = this.sectionHash.getItem(temp);
                    parent.add(section);
                }
            }
         }
         
         
    }  
    
    this.initMenu(); 
      
         
}
// end of Menu Object

// definition of MenuItem

function MenuItem(path_str, title_str) {
    this.path_str = path_str;
    this.title_str = title_str; 
    this.children_array = null; 
    this.numChildren = 0;    
    this.getTitle = function getTitle() {
        return this.title_str;
    } 
    this.getPath = function getPath()  {
        return this.path_str;
    }  
    this.renderAsHTML = function renderAsHTML() {
        var itemHTML = ""
        if(this.numChildren > 0) { 
             
            // this is a section heading 
            //start li for item
            itemHTML += "<li><a class=\"sectionheading\" href=\"" + publishPath + this.getPath() + "\">" + this.getTitle();
            // start ul for children
            itemHTML += "</a><ul>";
            // loop through children and render each
            for (var index = 0; index < this.children_array.length; index++) {
                var child = this.children_array[index];
                itemHTML += child.renderAsHTML();
            }
            //finish ul for children
            itemHTML += "</ul>";
            //finish li for item
            itemHTML += "</li>";
        } else { 
        
           // this is a menu link  
           itemHTML += "<li><a class=\"navlink\" href=\"" + publishPath + this.getPath() + "\">" + this.getTitle() + "</a></li>";
        } 
        return itemHTML;
    }  

    this.add = function add(child) { 

        
        if (child != null) {
            if (this.numChildren < 1) {
                this.children_array = new Array();
                this.children_array[0] = child;
                this.numChildren++; 
            } else {
                this.children_array[this.children_array.length] = child; 
                this.numChildren++;  
            }
            
        }
        
     
    }
}   
// end of MenuItem definition

// define Hash()

function Hash() { 
    this.length = 0; 
    this.items = new Array(); 
    for (var i = 0; i < arguments.length; i += 2) { 
        if (typeof(arguments[i + 1]) != 'undefined') { 
            this.items[arguments[i]] = arguments[i + 1]; 
            this.length++; 
        } 
    } 

    this.removeItem = function(in_key) { 
        var tmp_value; 
        if (typeof(this.items[in_key]) != 'undefined') { 
            this.length--; 
            var tmp_value = this.items[in_key]; 
            delete this.items[in_key]; 
        } 
        
        return tmp_value; 
    } 
    
    this.getItem = function(in_key) { 
        return this.items[in_key]; 
    } 
    
    this.setItem = function(in_key, in_value) { 
        if (typeof(in_value) != 'undefined') { 
            if (typeof(this.items[in_key]) == 'undefined') { 
                this.length++; 
            } 
        
            this.items[in_key] = in_value; 
        } 
        
        return in_value; 
    } 
    
    this.hasItem = function(in_key) { 
        return typeof(this.items[in_key]) != 'undefined'; 
    } 
}

