$(document).ready(function() {

var currUrl = window.location.pathname;
var currDir = currentDirectory;
var fullCurrDir = accountRoot + currDir;

//if(currUrl.indexOf("index.html") < 0){
//currUrl = currUrl + "index.html";
//}

// add class to parent nav
$("#prevnav").addClass('nav');

// get lists that do not have an li
 var emptyLists = $('ul:not(:has(li))');
  emptyLists.each(function(){
    id = $(this).attr("id");

    if(id == 'prevnav'){
      $("#currnav").addClass('nav');
    }else{
     $("#currnav").addClass('sn1');
     $("#currnav").addClass('sn1 navexpand');
    }
   
}); // end emptylist check

// find the parent list item link
var currentParentListItem = $('#prevnav a[href="'+currDir+'"]');
//testing for /index.html if no link is matched
if(currentParentListItem.length == 0)
{
	currentParentListItem = $('#prevnav a[href="'+currDir+'/index.html"]');
	if(currentParentListItem.length == 0)
	{
		currentParentListItem = $('#prevnav a[href="'+currDir+'/"]');
		if(currentParentListItem.length == 0)
		{
			currentParentListItem = $('#prevnav a[href="'+fullCurrDir+'"]');
			if(currentParentListItem.length == 0)
			{
				currentParentListItem = $('#prevnav a[href="'+fullCurrDir+'/index.html"]');
				if(currentParentListItem.length == 0)
				{
					currentParentListItem = $('#prevnav a[href="'+fullCurrDir+'/"]');
				}
			}
		}
	}
}

// get the list item links parent ( the <li> )
cpli = currentParentListItem.parent();


//move this list item to the top of the list
//cpli.prependTo(cpli.parent());

//append current nav to parent

cpli.append($("#currnav"));

}); // end document ready

