$(document).ready(function(){

    /* set up graphics for secondary banners */
    banners = {
    	'why-massage':'banner_1.jpg',
    	'back-pain':'banner_1.jpg',
    	'chronic-pain-illness':'banner_1.jpg',
    	'repetitive-stress':'banner_1.jpg',
    	
    	'special-populations':'banner_2.jpg',
    	'elder':'banner_2.jpg',
    	'infants-children':'banner_2.jpg',
    	'pregnancy':'banner_2.jpg',
    	
    	'chair-massage':'banner_3.jpg',
    	'about-jan':'banner_4.jpg',
    	'blog':'banner_5.jpg',
    	'plan-your-visit':'banner_6.jpg',
    	'rates':'banner_6.jpg'
    };
    
    $("#tagline").hide();
    
    $.each( banners, function(k, v) {
    	$("." + k + " > #graphic").html('<img src="/images/' + v + '" />');
    });
    
    $("#graphic").fadeIn(1250);


    
    $("#hcard-Jan-Hanseth .url, #hcard-Jan-Hanseth .fn, #hcard-Jan-Hanseth .email").hide();
    $(".street-address").append("&nbsp;&nbsp;|&nbsp;");
    $("#footer > .vcard > .tel").prepend("&nbsp;[&nbsp;").append("&nbsp;]&nbsp;");
    
    
    /* this nav wrangling lets me have the same nav HTML everywhere. */
    
    /* add colons to beginning of tertiary items */
    $("#nav > li > ul > li").prepend("<strong>:</strong>&nbsp;");
    
    /* hide tertiary navs by default */
    $("#nav > li > ul").hide();
    
    
    
    /*  determine current directory and highlight the second-level
        nav item that is linking to it
    */
    var dir = jQuery.url.segment(0);  
    $("#nav > li > a[href*='" + dir + "']").addClass("selected");
    
    /* show the third-level navs, and make them blue */
    $("li > ul:has(li > a[href*='" + dir + "'])").show();
    $("li > ul:has(li > a[href*='" + dir + "']) > li > a").addClass("subnav");
    
    /* bold the current third-level nav, if we have one */
    var filename = jQuery.url.attr("file");
    $("li > a[href*='" + filename + "']").addClass("selected");
  
  /*
    $("#SignUp").onSubmit(function() {
        alert("add validation, jan!");
    });
    */
    
    
    /* obfu email addr */
    $('a.email').each(function(){
			e = this.rel.replace('/','@');
			this.href = 'mailto:' + e;
			$(this).html(e);
		});

});
