$(document).ready(function () {
	var OSName = "";

	if (navigator.appVersion.indexOf("Mac")!=-1) {
		OSName="MacOS";
	}

	// popups (site map, dept. and services, etc)
	var cluetipOptions = {
		positionBy: 	'fixed',
		activation: 	'click',
		width: 			950,			// full width of site
		topOffset: 		15,
		leftOffset: 	15,
		sticky: 		true,
		closePosition: 	'title',
		cursor: 		'pointer',
		cluezIndex:		2000,
		fx: {             
			open:		'fadeIn',		// can be 'show' or 'slideDown' or 'fadeIn'
			openSpeed:	'500'
		}
	};

	cluetipOptions.topOffset = 12;
	cluetipOptions.leftOffset = -940;

	$('#departments').cluetip(cluetipOptions);

	// cluetipOptions.leftOffset = -940;
	// $('#hd-home #departments').cluetip(cluetipOptions);

	cluetipOptions.topOffset = -230;
	cluetipOptions.leftOffset = -949;

	$('.site-map').cluetip(cluetipOptions);

	//Menu dropdowns
	// $("#audienceMenu h4").click(function(){
	// 	$("#audienceMenu").toggleClass("active");
	// });
	// 
	// $("#searchMenu h4").click(function(){
	// 	$("#searchMenu").toggleClass("active");
	// });

	$("#breadCrumb .branch a:first-child:not(.leaf a)").after("<span class='down-arrow'/>");
	$("#breadCrumb .branch").hover(
		function() { 
			$(this).find('.down-arrow').addClass("over");
			//do nothing
		},

		function() {
			$(this).find("ul").css("left", "-999em");
			$('.down-arrow').removeClass("over");
		}
	);
	
	$(".down-arrow").click(function() {
		var ddm = $(this).parent().find("ul");
		zIndexWorkaround(1000);
		if(ddm.css("left") != "auto") { ddm.css({
			"left": "auto",
			"z-index": 1000
			}); }
		else { ddm.css("left", "-999em"); }
	});

	// Fix for Windows font smoothing looking like poo-poo
	if (OSName=="MacOS") {
		$('.feature.panel h2, .feature.panel h3').css('font-weight','normal');
	}
});
