
$(document).ready(function(){

	if ( ! isIE ) {

	// Home Nav States -----------------------------------
	
	$('#content.home li').mouseenter(function () {
		$(this).css({'background-color':'#503612'});
		$(this).find('a').css({'color':'#fff'});
	});
	$('#content.home li').mouseleave(function () {
		$(this).css({'background-color':''});
		$(this).find('a').css({'color':''});
	});
	
	$('#content.home li').click(function () {
		window.location( $(this).find('a').attr('href'));
	});
	
	// Sub Page Nav States ------------------------------------
	
	// Hide Tier2 Navs
	
	$('ul.tier2').hide();
	
	// Mouse Enter/Leave/Click
	
	// Tier1
	$('#content.sub ul.tier1 li').mouseenter(function () {
		$(this).css({'background-color':'#503612'});
		$(this).css({'color':'#fff'});
		$(this).find('a').css({'color':'#fff'});
	});
	$('#content.sub ul.tier1 li').mouseleave(function () {
		//if ( location.href.search($(this).find('a').attr('href')) != -1 ) {
		if ( location.href == $(this).find('a').attr('href') ) {
			return false;
		}
		/*if ( $(this).next().is('.tier2') && $(this).next().css('display') == 'block') {
			return false;
		}*/
		$(this).css({'background-color':'transparent'});
		$(this).css({'color':'#6D6F71'});
		$(this).find('a').css({'color':'#6D6F71'});
	});
	
	$('#content.sub ul.tier1 li').click(function () {
		//$('ul.tier2').hide('fast');
		/*if ( $(this).next().is('.tier2')) {
			$(this).next().show('fast');
		} else {*/
			window.location = $(this).find('a').attr('href');
		//}
	});
	
		$('#content.sub ul.tier1 li a').click(function (event) {
			event.preventDefault();
		});
	
	// Tier2
	$('#content.sub ul.tier2 li').mouseenter(function () {
		$(this).css({'background-color':'transparent'});
		$(this).css({'color':'#E08E1E'});
		$(this).find('a').css({'color':'#E08E1E'});
	});
	$('#content.sub ul.tier2 li').mouseleave(function () {
		//if ( location.href.search($(this).find('a').attr('href')) == -1 ) {
		if ( location.href == $(this).find('a').attr('href') ) {
			$(this).css({'background-color':'transparent'});
			$(this).css({'color':'#6D6F71'});
		}
	});
	
	$('#content.sub ul.tier2 li').click(function () {
		window.location( $(this).find('a').attr('href'));
	});
		$('#content.sub ul.tier2 li a').click(function (event) {
			event.preventDefault();
		});
	
	// Displaying active state for current page -----------------------------
	
	// Tier1
	$('#content.sub ul.tier1 li').change(function () {
		//if ( location.href.search($(this).find('a').attr('href')) != -1 ) {
		if ( location.href == $(this).find('a').attr('href') ) {
			$(this).mouseenter();
			if ( $(this).next().is('.tier2')) {
				$(this).next().show();
			}
		}
	});
	$('#content.sub ul.tier1 li').change();
	
	// Tier2
	$('#content.sub ul.tier2 li').change(function () {
		//if ( location.href.search($(this).find('a').attr('href')) != -1 ) {
		if ( location.href == $(this).find('a').attr('href') ) {
			$(this).mouseenter();
			if ( $(this).parent().is('.tier2')) {
				$(this).parent().show();
				$(this).parent().prev().mouseenter();
			}
		}
	});
	$('#content.sub ul.tier2 li').change();
	
	} // if !isIE
	
	// Unique Styles for some pages while id/class do not change --------------------------------------------------
	
	if ( location.href.search('resources') != -1 ) {
		$('div#content').css({'background':'#fff url(pub/images/content_bg_resources.jpg) no-repeat center bottom'});
	}
	
	if ( location.href.search('contact') != -1 ) {
		$('div#content').css({'background':'#fff url(pub/images/content_bg_contact.gif) no-repeat right bottom'});
	}
	
	// Text Replacement ----------------------------------------------------
	
	aReplace = new Array();
	//aReplace.push( "#headbar_phone");
	//aReplace.push( "#headbar_email");
	
	hsParseTags();
});
