	if ($.cookie('navItem') == null) {
		$.cookie('navItem', '', { expires: 2 });
	}

$(document).ready(function() {
	var navItem = $.cookie('navItem');
	/*if ((location.href.indexOf("index.html") != -1)&&(navItem != "protectYourFamily")) {
		window.location = "index.html";
	}*/
	changeNav(navItem, true);
	// add Google Analitics Tagging
	// raise your voice
	/*
	var globalTrackPage="";
	if (location.href.indexOf("raise-your-voice.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Parent/nav/Raise Your Voice");
			globalTrackPage="Parent/nav/Raise Your Voice";                       
		} catch(err) {}
	}
	else if (location.href.indexOf("raise-your-voice.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Nurse/nav/Raise Your Voice");
			globalTrackPage="Nurse/nav/Raise Your Voice";                        
		} catch(err) {}
	}
	// contact us
	else if (location.href.indexOf("contact-us.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Parent/contact us");
			globalTrackPage="Parent/contact us";
		} catch(err) {}
	}
	else if (location.href.indexOf("contact-us.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Nurse/contact us");
			globalTrackPage="Nurse/contact us";
		} catch(err) {}
	}
	// about voices
	else if (location.href.indexOf("about-voices.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Parent/About Voices of Meningitis");
		} catch(err) {}
	}
	else if (location.href.indexOf("about-voices.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Nurse/About Voices of Meningitis");
		} catch(err) {}
	}
	// additional resources
	else if (location.href.indexOf("additional-resources.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Parent/Additional Resources");
		} catch(err) {}
	}
	else if (location.href.indexOf("additional-resources.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Nurse/Additional Resources");
		} catch(err) {}
	}
	// press
	else if (location.href.indexOf("press.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Parent/Press");
		} catch(err) {}
	}
	else if (location.href.indexOf("press.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Parent/Press");
		} catch(err) {}
	}
	// references
	else if (location.href.indexOf("references.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Parent/References");
		} catch(err) {}
	}
	else if (location.href.indexOf("references.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			var pageTracker = _gat._getTracker("UA-442708-4");
			pageTracker._trackPageview("Nurse/References");
		} catch(err) {}
	}*/
});

function changeNav(navItem, isInitFunction) {
	var currentURL = location.href;
	
	if (!isInitFunction) {
		if (currentURL.indexOf("protect-your-school.html") != -1) {
			$.cookie('navItem', 'protectYourFamily');
			location.href = location.href.replace("protect-your-school.html", "protect-your-family-talk-to-expert.html");
		} else if (currentURL.indexOf("protect-your-family-talk-to-expert.html") != -1)  {
			$.cookie('navItem', 'protectYourStudent');
			location.href = location.href.replace("protect-your-family-talk-to-expert.html", "protect-your-school.html");						
		} else if (currentURL.indexOf("protect-your-family-talk-to-your-child.html") != -1)  {
			$.cookie('navItem', 'protectYourStudent');
			location.href = location.href.replace("protect-your-family-talk-to-your-child.html", "protect-your-school.html");						
		} 
		if (navItem == "protectYourStudent") {
			if (currentURL.indexOf("get-the-facts-the-basics.html") != -1)  {
				location.href = location.href.replace("get-the-facts-the-basics.html", "get-the-facts-the-basics-for-school-nurse.html");
			} else if (currentURL.indexOf("get-the-facts-teen-at-risk.html") != -1) {
				location.href = location.href.replace("get-the-facts-teen-at-risk.html", "get-the-facts-teen-at-risk-for-school-nurse.html");
			} else if (currentURL.indexOf("get-the-facts-vaccination.html") != -1) {
				location.href = location.href.replace("get-the-facts-vaccination.html", "get-the-facts-vaccination-for-school-nurse.html");
			} else if (currentURL.indexOf("site-map.html") != -1) {
				//location.href = location.href.replace("site-map.html", "site-map-for-school-nurse.html");				
			} else if (currentURL.indexOf("protect-your-family-resource.html") != -1) {
				location.href = location.href.replace("protect-your-family-resource.html", "protect-your-students-resource.html");
			}
			/*else if (currentURL.indexOf("index.html") != -1) {
				location.href = location.href.replace("index.html", "hear-the-stories-for-school-nurse.html");
			} else if (currentURL.indexOf("index.html") != -1) {
				location.href = location.href.replace("index.html", "hear-the-stories-for-school-nurse.html");
			} */
		} else if (navItem == "protectYourFamily") {
			if (currentURL.indexOf("get-the-facts-the-basics-for-school-nurse.html") != -1)  {
				location.href = location.href.replace("get-the-facts-the-basics-for-school-nurse.html", "get-the-facts-the-basics.html");
			} else if (currentURL.indexOf("get-the-facts-teen-at-risk-for-school-nurse.html") != -1) {
				location.href = location.href.replace("get-the-facts-teen-at-risk-for-school-nurse.html", "get-the-facts-teen-at-risk.html");				
			} else if (currentURL.indexOf("get-the-facts-vaccination-for-school-nurse.html") != -1) {
				location.href = location.href.replace("get-the-facts-vaccination-for-school-nurse.html", "get-the-facts-vaccination.html");				
			} else if (currentURL.indexOf("site-map-for-school-nurse.html") != -1) {
				//location.href = location.href.replace("site-map-for-school-nurse.html", "site-map.html");				
			} else if (currentURL.indexOf("protect-your-students-resource.html") != -1) {
				location.href = location.href.replace("protect-your-students-resource.html", "protect-your-family-resource.html");
			} else if (currentURL.indexOf("request-material-by-email.html") != -1) {
				location.href = location.href.replace("request-material-by-email.html", "protect-your-family-talk-to-expert.html");				
			} 
		}
	}	
	
	var changeContent = "";
    if (currentURL.indexOf("protect-your-family-talk-to-expert.html") != -1
	|| currentURL.indexOf("protect-your-family-talk-to-your-child.html") != -1) {
		navItem = "protectYourFamily";
	} else if (currentURL.indexOf("protect-your-school.html") != -1) {
		navItem = "protectYourStudent";
	}
	
	var getTheFactsTheBasicsLink = $("#get-the-facts-the-basics-link");
	var hearTheStoryLink = $("#nav li:first a");
	//sitemapLink(navItem); // use only 1 sitemap - 2009-07-09
	
	if ($("#optionRadio2").length > 0){		
		if(navItem == "protectYourStudent") {
			$("#optionRadio2")[0].checked = true;
			getTheFactsTheBasicsLink.attr("href","get-the-facts-the-basics-for-school-nurse.html");
			hearTheStoryLink.attr('href','index.html');
			$.cookie('navItem', 'protectYourStudent');		
			changeContent = '<a href="protect-your-school.html" title="Protect Your School">Protect Your School</a><ul class="StudentsSubNav" ><li id="protect-your-students" ><a href="protect-your-school.html" title="What You Can Do">What You Can Do</a></li><li id="protect-your-students-resource" ><a href="protect-your-students-resource.html" title="Resources">Resources</a></li></ul>';
			
		} else if (navItem == "protectYourFamily") {
			$("#optionRadio1")[0].checked = true;
			getTheFactsTheBasicsLink.attr("href","get-the-facts-the-basics.html");	
			hearTheStoryLink.attr('href','index.html');
			$.cookie('navItem', 'protectYourFamily');		
			changeContent = '<a href="protect-your-family-talk-to-expert.html" title="Protect Your Family">Protect Your Family</a><ul><li id="protect-your-family-talk-to-expert"><a href="protect-your-family-talk-to-expert.html" title="Talk to an Expert">Talk to an Expert</a></li><li id="protect-your-family-talk-to-your-child"><a href="protect-your-family-talk-to-your-child.html" title="Talk to Your Child">Talk to Your Child</a></li><li id="protect-your-family-resource" ><a href="protect-your-family-resource.html" title="Resources">Resources</a></li></ul>';
		}
		
		if (changeContent != "") {
			$('#changeNavWrap').html(changeContent);
		}
	}
	
	// add Google Analitics Tagging
	
	// raise your voice
	if (currentURL.indexOf("raise-your-voice.html")!= -1 && ($("#optionRadio1")[0].checked == true)) {
		try { 
			pageTracker._trackPageview("/Parent/nav/Raise Your Voice");
			YWATracker.setAction("/Parent/nav/Raise Your Voice") ;
			YWATracker.submit_action();
			globalTrackPage="/Parent/nav/Raise Your Voice";
		} catch(err) {}
	}
	else if (currentURL.indexOf("raise-your-voice.html")!= -1 && ($("#optionRadio2")[0].checked == true)) {
		try { 
			pageTracker._trackPageview("/Nurse/nav/Raise Your Voice");
			YWATracker.setAction("/Nurse/nav/Raise Your Voice") ;
			YWATracker.submit_action();
			globalTrackPage="/Nurse/nav/Raise Your Voice";
		} catch(err) {}
	}
	// contact us
	else if (currentURL.indexOf("contact-us.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			pageTracker._trackPageview("/Parent/contact us");
			YWATracker.setAction("/Parent/contact us") ;
			YWATracker.submit_action();
			globalTrackPage="/Parent/contact us";
		} catch(err) {}
	}
	else if (currentURL.indexOf("contact-us.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			pageTracker._trackPageview("/Nurse/contact us");
			YWATracker.setAction("/Nurse/contact us") ;
			YWATracker.submit_action();
			globalTrackPage="/Nurse/contact us";
		} catch(err) {}
	}
	// about voices
	else if (currentURL.indexOf("about-voices.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			pageTracker._trackPageview("/Parent/About Voices of Meningitis");
			YWATracker.setAction("/Parent/About Voices of Meningitis") ;
			YWATracker.submit_action();
		} catch(err) {}
	}
	else if (currentURL.indexOf("about-voices.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			pageTracker._trackPageview("/Nurse/About Voices of Meningitis");
			YWATracker.setAction("/Nurse/About Voices of Meningitis") ;
			YWATracker.submit_action();
		} catch(err) {}
	}
	// additional resources
	else if (currentURL.indexOf("additional-resources.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			pageTracker._trackPageview("/Parent/Additional Resources");
			YWATracker.setAction("/Parent/Additional Resources") ;
			YWATracker.submit_action();
		} catch(err) {}
	}
	else if (currentURL.indexOf("additional-resources.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			pageTracker._trackPageview("/Nurse/Additional Resources");
			YWATracker.setAction("/Nurse/Additional Resources") ;
			YWATracker.submit_action();
		} catch(err) {}
	}
	// press
	else if (currentURL.indexOf("press.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			pageTracker._trackPageview("/Parent/Press");
			YWATracker.setAction("/Parent/Press") ;
			YWATracker.submit_action();
		} catch(err) {}
	}
	else if (currentURL.indexOf("press.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			pageTracker._trackPageview("/Nurse/Press");
			YWATracker.setAction("/Nurse/Press") ;
			YWATracker.submit_action();
		} catch(err) {}
	}
	// references
	else if (currentURL.indexOf("references.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			pageTracker._trackPageview("/Parent/References");
			YWATracker.setAction("/Parent/References") ;
			YWATracker.submit_action();
		} catch(err) {}
	}
	else if (currentURL.indexOf("references.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			pageTracker._trackPageview("/Nurse/References");
			YWATracker.setAction("/Nurse/References") ;
			YWATracker.submit_action();
		} catch(err) {}
	}

        else if (currentURL.indexOf("index.html")!= -1 && (navItem == "protectYourFamily")) {
		try {
			pageTracker._trackPageview("/Parent/nav/home/I'm a parent");
			YWATracker.setAction("/Parent/nav/home/I'm a parent") ;
			YWATracker.submit_action();
		} catch(err) {}
	}

        else if (currentURL.indexOf("index.html")!= -1 && (navItem == "protectYourStudent")) {
		try {
			pageTracker._trackPageview("/Nurse/nav/home/I'm a school nurse");
			YWATracker.setAction("/Nurse/nav/home/I'm a school nurse") ;
			YWATracker.submit_action();
		} catch(err) {}
	}
}

function setNavigation(toggleType)
{   
    if (toggleType == "1" ){
		pageTracker._trackPageview("/Parent/nav/home/I'm a parent");
		YWATracker.setAction("/Parent/nav/home/I'm a parent") ;
		YWATracker.submit_action();
        $.cookie('navItem', "protectYourFamily");
    }
    else if (toggleType == "2" ) {
		pageTracker._trackPageview("/Nurse/nav/home/I'm a school nurse");
		YWATracker.setAction("/Nurse/nav/home/I'm a school nurse") ;
		YWATracker.submit_action();
        $.cookie('navItem', "protectYourStudent");

    }
}
/*
function setPageCookie()
{
    var type="parent";
    var typeFromQueryString = querySt("type");
    if (typeFromQueryString != "parent"){
        type="protectYourFamily";
    }
    else if (typeFromQueryString != "nurse")
    {
        type="protectYourStudent";
    }
    $.cookie('navItem', type);
}*/

function querySt(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return ft[1];
        }
    }
    return "";
}

function sitemapLink(navItem) {
	var sitemapLink = $("#sitemapLink");
	if(navItem == "protectYourStudent") {
		$("#optionRadio2")[0].checked = true;
		$.cookie('navItem', 'protectYourStudent');
		sitemapLink.attr("href", "site-map-for-school-nurse.html");
	} else if (navItem == "protectYourFamily") {
		$("#optionRadio1")[0].checked = true;
		$.cookie('navItem', 'protectYourFamily');
		sitemapLink.attr("href", "site-map.html");
	} 
}

