$(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");	
		}
	}	
	
	//Add Class to Even TR Elements
	$("table.alt tr:odd").children().addClass("odd");
	
	//remove newsletter input values
	$('.newsletter-signup input.cat_textbox').focus(function(){
			$(this).val('');
	});
	//duplicate link for products
	$('.catalog-image a').each(function(){
		var productlink = $(this).attr('href');
		$(this).parent().parent().wrap('<a href='+productlink+'/>');		

	});
	
	//newsletter box box
		$('#FullName').focus(function() {
		$('#FullName').css('color', '#666');
		if(this.value == 'Enter Full Name')
		{ this.value = ''; }
		})
		$(this).val('');
		$('#FullName').blur(function() {
		if(this.value == '')
		{ this.value = 'Enter Full Name'; }
		});
		$('#EmailAddress').focus(function() {
		$('#EmailAddress').css('color', '#666');
		if(this.value == 'Enter Email Address')
		{ this.value = ''; }
		})
		$(this).val('');
		$('#EmailAddress').blur(function() {
		if(this.value == '')
		{ this.value = 'Enter Email Address'; }
		});
//duplicate a tag
	$('.merchandise .product-image a').each(function(){
		var productlink = $(this).attr('href');
		
		$(this).parent().parent().wrap('<a href='+productlink+'/>');		

	});
	
	$('.soup .volume').each(function(){
		
		$(this).text(' /12oz serving');		

	});
	$('.food-orders').attr('title', '303-654-9700');
	$('.food-orders[title]').qtip({ style: { name: 'cream', tip: true } });
	
$('.weekly-menu-item .closed').each(function(){
	var closed = $(this).html();
	if (closed == '1') {
		//alert('closed');
		$(this).siblings('.weekly-menu-description').hide();
		$(this).siblings('.closed-message').show();
	}


});




});
