// DOM BASED NAVIGATION
// Brulant
// Sean Hecking 
// Updated: 6-20-07
// sean.hecking@brulant.com

// Dynamic navigation based on URL page path location
// Changing page names or altering the navigation will break script

//sets the left nav divs on page load
window.onload = function() {

	var docloc = document.location.href;

	//PROGRAMS AND SERVICES NAV
	//check to see which nav to use
	if(document.getElementById('a11_0')) {

		//Grab ULs  on load
		var a11_0 = document.getElementById("a11_0");
		var a11_1 = document.getElementById("a11_1");
		var a11_2 = document.getElementById("a11_2");
		var a11_3 = document.getElementById("a11_3");
		var a21_0 = document.getElementById("a21_0");
		var a21_1 = document.getElementById("a21_1");
		var a21_2 = document.getElementById("a21_2");
		var a21_3 = document.getElementById("a21_3");
		
		//close the ULs on load
		a11_0.style.display="none";
		a11_1.style.display="none";
		a11_2.style.display="none";
		a11_3.style.display="none";
		a21_0.style.display="none";
		a21_1.style.display="none";
		a21_2.style.display="none";
		a21_3.style.display="none";

		//SETS NAV		
		// Community Services Section
		if (docloc.indexOf('community_services')!=-1){
			a11_0.className='nav_3_active';
			return
		}
		if (docloc.indexOf('ncjw_montefiore_hospice')!=-1){
			a11_0.className='nav_3_active';
			a11_1.className='nav_4_active';
			return
		}
		if (docloc.indexOf('certified_homecare')!=-1){
			a11_0.className='nav_3_active';
			a11_2.className='nav_4_active';
			return
		}
		if (docloc.indexOf('private_duty')!=-1){
			a11_0.className='nav_3_active';
			a11_3.className='nav_4_active';
			return
		}
		// Nursing Care Section
		if (docloc.indexOf('nursing_care')!=-1){
			a21_0.className='nav_3_active';
			return
		}
		if (docloc.indexOf('long_term')!=-1){
			a21_0.className='nav_3_active';
			a21_1.className='nav_4_active';
			return
		}
		if (docloc.indexOf('post_hospital')!=-1){
			a21_0.className='nav_3_active';
			a21_2.className='nav_4_active';
			return
		}
		if (docloc.indexOf('dementia')!=-1){
			a21_0.className='nav_3_active';
			a21_3.className='nav_4_active';
			return
		}
	
	}
	
	//VOLUNTEERS AND AUXILIARY NAV
	//check to see which nav to use
	if(document.getElementById('d2_0')) {
		
		//Grab ULs on load
		var d2_0 = document.getElementById("d2_0");
		var d3_0 = document.getElementById("d3_0");
		
		//Close the ULs on load
		d2_0.style.display="none";
		d3_0.style.display="none";
		
		//SETS NAV
		//Auxiliary Leadership
		if (docloc.indexOf('auxiliary_leadership')!=-1){
			d2_0.className='nav_3_active';
			return
		}
		//About Volunteering
		if (docloc.indexOf('about_volunteering')!=-1){
			d3_0.className='nav_3_active';
			return
		}
		
	}
	
	//ABOUT US NAV
	//check to see which nav to use
	if(document.getElementById('e1_0')) {
		
		//Grab ULs on load
		var e1_0 = document.getElementById("e1_0");
		var e2_0 = document.getElementById("e2_0");
		var e2_1 = document.getElementById("e2_1");
		
		//Close the ULs on load
		e1_0.style.display="none";
		e2_0.style.display="none";
		e2_1.style.display="none";
		
		//SETS NAV
		//leadership about
		if (docloc.indexOf('leadership_about')!=-1){ e1_0.className='nav_3_active'; return}
		//SETS MULTIPLE NAVS
		//leadership about continued
		if (docloc.indexOf('executive_staff')!=-1){ e1_0.className='nav_3_active'; return }
		if (docloc.indexOf('board_of_directors')!=-1){ e1_0.className='nav_3_active'; return }
		if (docloc.indexOf('foundation_board')!=-1){ e1_0.className='nav_3_active'; return }
		if (docloc.indexOf('housing_board')!=-1){ e1_0.className='nav_3_active'; return }

		//mission vision
		if (docloc.indexOf('mission_vision')!=-1){e2_0.className='nav_3_active'; return}
		//history
		if (docloc.indexOf('history')!=-1){e2_0.className='nav_3_active'; return}
		
		//strategy
		if (docloc.indexOf('strategy')!=-1){ e2_0.className='nav_3_active'; e2_1.className='nav_4_active'; return}
		
	}
	
	//JOIN US NAV
	//check to see which nav to use
	if(document.getElementById('g1_0')) {
		
		//Grab ULs on load
		var g1_0 = document.getElementById("g1_0");
		
		//Close the ULs on load
		g1_0.style.display="none";
		
		//SETS NAV
		//leadership about
		if (docloc.indexOf('join_our_team')!=-1){ g1_0.className='nav_3_active'; return}
	}
}

