
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function showDiscovery(theDiv) {
	$("#sections .section:visible").hide();
	// show the subpage
	$("#" + theDiv).slideDown("slow");
}


function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}

function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}



$(document).ready(function() {

		$('ul.sf-menu').supersubs({
				minWidth:5,
				maxWidth:30,
				extraWidth:1
			}).superfish();
		
		$(document).pngFix();

		
		$("#commthumbNav img").hover(
				// over
				function(){
					$(this).css("border-color","#FFFFFF");
					var id = $(this).attr('id');
					id = id.replace(/thumb_/, "");
					document.getElementById("map_flash").showRollover(id);
				},
				
				// out
				function(){
					$("#commthumbNav img").css("border-color","#3f0000");
					var id = $(this).attr('id');
					id = id.replace(/thumb_/, "");
					document.getElementById("map_flash").hideRollover(id);
				}
		);
	
	
		// Run Cufon for Fonts
		Cufon.set('fontFamily', 'dearJoe four');
		Cufon.replace('#titleImg h1', {textShadow: '2px 2px rgba(0,0,0,0.2)'});
			
		Cufon.set('fontFamily', 'Sabon LT Std');
		Cufon.replace('h2');


		$("a.rollover").hover(
				
				// over
				function(){
					// store the original image src
					$(this).children(":first-child").attr( "originalsrc" , $(this).children(":first-child").attr("src") );
					
					// add -over to the image unless it is already -over
					if (!$(this).children(":first-child").attr("src").match(/-over/) ) {
						$(this).children(":first-child").attr( "src", $(this).children(":first-child").attr("src").replace(/\./, "-over.") );
					}
					
				},
				
				// out
				function(){
					// replace the original src
					$(this).children(":first-child").attr(
						"src", $(this).children(":first-child").attr("originalsrc")
					);
					
					$(this).children(":first-child").attr(
						"originalsrc", null
					);
				}
			);
		
		
	$("a.adPop").hover(
				// over
				function(){
					// Change DIV Color
					
					$(this).nextAll('div').css('backgroundColor', '#683b0a');
					
				},
				
				// out
				function(){
					// Replace DIV Color
					$(this).nextAll('div').css('backgroundColor', '#997e5c');
				}
			);
		
		
	// link tracking
	$("a").each(function(){
		var href = $(this).attr('href');
		if ( href.match(/^http/) ) {
			$(this).click(function() {
				var hrefClean = href.substring(7);
				pageTracker._trackEvent('Click Outgoing Link', hrefClean);
            });
			return;
		} else if (href.match(/\.pdf$/)) {
			$(this).click(function() {
				pageTracker._trackEvent('Download PDF', href);
            });
			return;
		} else if (href.match(/^mailto:/)) {
			$(this).click(function() {
				var hrefClean = href.substring(7);
				pageTracker._trackEvent('Email Someone', hrefClean);
            });
			return;
		}
	});
			



			
});


window.onload = function() {
		// preload
		$("a.rollover img").each(
			function() {
				if (!$(this).attr("src").match(/-over/) ) {
					$("<img>").attr( "src", $(this).attr("src").replace(/\./, "-over.") );
				}
			}
		);
}
