/*
* tweaks.js -- Makes little tweaks to the Greenstone interface
*
* Copyright (C) 2004 by Deryck Hodge <hodgedg@auburn.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/

// To help older browsers, run all functions from one onload command
function wrapAll() {
        return wrapNav(), hideHome(), oneLogo()
}       

// Hide the home link when on the home page.
function hideHome() {
        if (document.getElementsByTagName('H3').item(0)) {
                aboutText = document.getElementsByTagName('H3').item(0).firstChild
                if (aboutText.nodeValue == 'About Vincentiana') {
                        homelink = document.getElementById('home')
                        homelink.style.display = 'none'
                }
        }
}        

// Only show the smaller logo on document pages
function oneLogo() {
        if (navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 0) {
                if (document.getElementById('logo_thumb')) {
                        tdCell = document.getElementsByTagName('TD').item(1) 
                        tdCell.removeChild(logo_thumb)  
                }
        }
        else {
                if (document.getElementsByTagName('TD').item(1).childNodes.length > 14 && document.getElementsByTagName('TD').item(1).childNodes.length < 17) {
                        anchor = document.getElementsByTagName('A').item(4)
                        parent = anchor.parentNode
                        parent.removeChild(anchor)
                }
        }
}

/*************************************************************
    Don't want to loose this code, but I'm not using
    it for now.  It creates a text based title.  Currently,
    using an image for title.  (Not sure it would work with 
    the most recent changes.)
**************************************************************/

// Split title and wrap in <div>s
// function wrapTitle() {
//         h2Tags = document.getElementsByTagName('H2').item(0)
//         if (h2Tags.firstChild.nodeName == 'A') {
//                 aTags = h2Tags.firstChild
//                 colTitle = aTags.firstChild.nodeValue
//         }
//         else {
//                 colTitle = h2Tags.firstChild.nodeValue
//         }
//         mainTitle = colTitle.slice(0, 27)
//         subTitle =  colTitle.slice(28)
//         // Have to build wrapper twice because of IE
//         if (navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 0) {
//                 mainTitleWrap = document.createElement('<h2 class="maintitle">')
//                 subTitleWrap = document.createElement('<h2 class="subtitle">')
//         }
//         else {
//                 mainTitleWrap = document.createElement('H2')
//                 mainTitleWrap.setAttribute('class', 'maintitle')
//                 subTitleWrap = document.createElement('H2')
//                 subTitleWrap.setAttribute('class', 'subtitle')
//         }                
//         // Now append text to wrappers
//         mainTitleText = document.createTextNode(mainTitle)
//         mainTitleWrap.appendChild(mainTitleText)
//         subTitleText = document.createTextNode(subTitle)
//         subTitleWrap.appendChild(subTitleText)
//         // Now wrappers replace the original text
//         h2Parent = h2Tags.parentNode
//         h2Parent.replaceChild(mainTitleWrap, h2Tags)
//         h2Parent.appendChild(subTitleWrap)
// }


