$(document).ready(function () {
    //check login info display member-nav if logged in, otherwise display public
	var loggedin = window.ISLOGGEDIN;
	if (loggedin == 1) {
		$("#member-nav").css({
			"display": "block"
		});
		$("#utility-nav").css({
			"display": "none"
		});
	}

    //change shoping cart buttons -- depends on client
	/*var $cart = $(".cartSummaryItem");
	if($cart.text() == "Shopping cart is empty."){
		$cart.html('<a href="/OrderRetrievev2.aspx" class="nav-cart">Shopping Cart</a>');	
		$cart.addClass("defaultcart");
	}else{
		$cart.removeClass("defaultcart");
	}*/

    
	
	
	
	//---Highlight Nav Items---//
	var pathArray = window.location.pathname.split( '/' ); //create an array based upon the pathname(/example/page would become pathArray[example,page])
	var firstPathArray = "/"+pathArray[1];//get just the first item in the path array (The parent page if you will)
	var mainNav = $("#nav li a");
	
	//cycle through each link on the main nav. If the href equals the first part of the pathname add the class current
	for (var i=0; i<mainNav.length; i++){
		var href = $(mainNav[i]).attr("href");
		if(href == firstPathArray){
			$(mainNav[i]).parent().addClass("selected");	
		}
	}	
	
	var path = window.location.pathname;

    $("#nav li a").each(function () {
    var href = this.attributes.href.value;
    if (href.indexOf(path) != -1) {
    $(this).parent("li").addClass("selected-title");
    var parentLI = $(this).parent("li").parents("li").addClass("selected-title");
    }
    });




});
