$(function() { 
	/*nav + subnav*/
	var folderpath = location.pathname.substring(0).toLowerCase();
	
	var pagefilename = folderpath.substring(folderpath.lastIndexOf('/')+1).toLowerCase();
	var defaultfilename = "default.asp";
	
	//remove default.asp if it exists in folderpath
	if (pagefilename == defaultfilename) {
		folderpath = location.pathname;
		folderpath = folderpath.substring(0,folderpath.lastIndexOf('/')+1).toLowerCase();
	}
	
	$('#subnav div.menu ul a[href="' + folderpath + '"]').addClass('selected');
	$('#nav a[href="' + folderpath + '"]').addClass('selected');


	 // check to see if the explandable class is on div.expandable...if so, do sub UL expansion, else treat it as default.
	 if ( $('div.menu').hasClass('expandable')) {
		 $('#subnav div.menu ul li ul').hide();		 
		 if (folderpath) { 
		 	$('#subnav ul li a[href$="' + folderpath + '"]').addClass('selected');
			$('#subnav div.menu > ul > li > a.selected').siblings('ul').slideDown();
			$('#subnav div.menu > ul > li > ul > li > a.selected').parents('ul').show();
		 	}
		 }
	
	/*Add style to programs link if you are in a program page - only happens if you are 2 folders deep in the folder structure
	
	if (location.pathname.match(/\/\w+\/\w+\//)[0].toLowerCase()) {
		$('#nav a[href=/health/programs.asp]').addClass('selected');
	}*/

	/*End nav + subnav*/
	
	
	/*style note better*/
	$('div.note').wrapInner($("<div class='innerwrap'></div>"));
	
	/*zebra stripes for tablees with stripe class*/
	$('table.stripe tr:even td').addClass('even'); 
	
	/*Dropdown Nav*/
	$('#nav li.programs').removeClass('programs').addClass('programsjs');
	
	
	$('#nav li.programsjs').hoverIntent({
		sensitivity: 3,
		interval: 50,
		over: dropdown,
		timeout: 500,
		out: dropdown
	}); 
	
	$("li.programsjs div#drop a").focus(function () {
         $(this).parents('li.programsjs').addClass('hover');
    });
	$("li.programsjs div#drop a").blur(function () {
         $(this).parents('li.programsjs').removeClass('hover');
    });

});

function dropdown(){ $(this).toggleClass('hover');}
//function hidedropdown(){ $(this).removeClass('hover');} 
