function menuInit(){

    // Create the list that will be converted into a menu below
    // With one div element with id 'nav' I get a consistent menu
    // across any set of pages that uses this function
    $('.nav').html('	<li><a href="home.html">Home</a></li>' +
    '<li><a href="gallery.html">Gallery</a>' +
    '	<ul>' +
    '		<li><a href="gallery_fig.html">Figurative</a></li>' +
    '		<li><a href="gallery_abstract.html">Abstract</a></li>' +
	'		<li><a href="gallery_squares.html">Geometric</a></li>' +
	'       <li><a href="gallery_black_and_white.html">Black and White</a></li>'+
    '       <li><a href="gallery_recent.html">Abstract II</a></li>'+
    '       <li><a href="gallery_things.html">Things I Know</a></li>'+
    '       <li><a href="gallery_trees.html">Trees</a></li>'+
    '       <li><a href="gallery_cells.html">Cells</a></li>'+
    '       <li><a href="gallery_alleys.html">Alleys</a></li>'+
	'	</ul>' +
    '</li>' +
    '<li><a href="artist.html">Artist</a>' +
    '	<ul>' +
    '		<li><a href="statement.html">Statement</a></li>' +
    '		<li><a href="bio.html">Bio</a></li>' +
    '		<li><a href="cv.html">CV</a></li>' +
    '	</ul>	' +
    '</li>' +
    '<li><a href="news.html">News</a></li>' +
    '<li><a href="http://www.correalicegallery.blogspot.com/">Blog</a></li>' +
    '<li><a href="contacts.html">Contact</a></li>');
    // Use superfish to convert list to menu
    // http://users.tpg.com.au/j_birch/plug-ins/superfish
    $('.nav').superfish({
        delay: 400
    });
    $('.nav li:has(ul)').find('a:first').addClass('sub');
    $('.nav ul li:has(ul)').find('a:first').removeClass('sub').addClass('subsub');
    
    setCurrent();
}

function setCurrent(){
    $('.nav a').each(function(){
        var elem = $(this);
        //var ref = elem.find('a').attr('href');
        var ref = elem.attr('href');
        var currentPath = location.pathname; /* get file name portion of URL */
        var currentFile = currentPath.substring(currentPath.lastIndexOf('/') + 1);
        var refFile = ref.substring(ref.lastIndexOf('/') + 1);
        var targetSameAsCurrent = refFile == currentFile;
        //console.log(currentFile + " " + refFile + " " + (refFile == currentFile));
        if (targetSameAsCurrent) {
            elem.addClass('selected');
        }
        else {
            elem.addClass('unselected');
        }
    }); // end each	
}

function makeBigLinks(target){
    var hoverClass = 'hoverBigLink';
    
    $(target).each(function(){
        var elem = $(this);
        var ref = elem.find('a').attr('href');
        var currentPath = location.pathname; /* get file name portion of URL */
        var currentFile = currentPath.substring(currentPath.lastIndexOf('/') + 1);
        var refFile = ref.substring(ref.lastIndexOf('/') + 1);
        var targetSameAsCurrent = refFile == currentFile;
        //console.log(currentFile + " " + refFile + " " + (refFile == currentFile));
        if (targetSameAsCurrent) {
            elem.addClass('menuSelected');
            elem.removeClass('menuItem');
        }
        else {
            elem.hover(function(){
                //console.log("in hover " + ref);
                elem.addClass(hoverClass);
                status = ref;
            }, function(){
                //console.log("exit hover");
                elem.removeClass(hoverClass);
                status = '';
            }); // end hover
            elem.click(function(evt){
                location = ref;
            }); // end click
            elem.css('cursor', 'pointer');
        }
    }); // end each
} // end makeBigLinks

