﻿// Jennifer Angeloro Photography

//global variable storing the currently open subnav
var v_currentlyOpenSubNav = null;
//global variable storing the currently chosen main nav
var v_currentlyChosenMainNav = null;
//global variable storing the current page--set on f_thisPage--a string
var v_currentPage = null;

//this function moves the navigation up and down on the onClick event on the arrow button
function f_toggleNav(imageClicked)
{
    var buttonId = imageClicked.id;
    var navDiv = document.getElementById(buttonId + "-div");

    if (imageClicked.v_expanded == null) //if it's null, the variable hasn't been accessed yet
        imageClicked.v_expanded = false; //so set it to be false, because the nav is hidden at first.

    //div up: top: 640px; and img src="img/down-arrow.png"
    //div down: top: 710px; and img src="img/up-arrow.png"
    
    if (imageClicked.v_expanded == true) // if it is currently expanded
    {
        //collapse it
        navDiv.className = "collapsed-nav";
        imageClicked.v_expanded = false;
        //make the image source the down arrow
        imageClicked.src = "img/down-arrow.png";
    }
    else // else it's currently collapsed
    {
        //so expand it
        navDiv.className = "expanded-nav";
        imageClicked.v_expanded = true;
        //make the image source the up arrow
        imageClicked.src = "img/up-arrow.png";
    }
}

//this function shows the proper div when the navigation link is hovered over
function f_showSubNav(menuHoveredOver)
{
    //get the current menu and sub menu
    var v_mainNavId = menuHoveredOver.id;
    var v_subNavDiv = document.getElementById (v_mainNavId + "-sublinks-div");

    //is any menu currently open?
    if (v_currentlyOpenSubNav != null)
    {
        //yes, close it
        v_currentlyOpenSubNav.className = "subDivHidden";
    }

    //does this menu have a sub nav?
    if (v_subNavDiv != null)
    {
        //yes, currently invisible?
        if (v_subNavDiv.className == "subDivHidden")
        {
            //yes it is, so show it
            v_subNavDiv.className = "subDivVisible";
            //set this as currently visible sub nav
            v_currentlyOpenSubNav = v_subNavDiv;
        }     
    }
    
}

//this function opens a new window with the Pictage information from the form on find-your-photos.html

function f_findPhotos()
{
    var v_pictageUrl = "http://www.pictage.com/client/search.do?search=" + document.getElementById("eventnum").value;
    window.open( v_pictageUrl );
}


