// ready, set, go... 
$(function() { 
		   // Easing functions borrowed from http://gsgd.co.uk/sandbox/jquery/easing/ 
		   $.easing.easeOutCubic = function(x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }; 
		   $.easeInOutCirc = function(x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; } 
		   
		   // remove noscripts 
		   $('.noscript').remove(); 
		   
		   // ie7 minimum for fancy stuff 
		   var lowIE = false; 
		   if (jQuery.browser.msie) { 
		   	if (parseInt(jQuery.browser.version) < 7) { 
				lowIE = true; 
				} 
			} 
			
			if (!lowIE) { 
			
			// smooth scrolling 
			//$('#banner').click( function() { $.scrollTo($("#content"), 400, { easing:'easeInOutCirc' }); }); 
			$.localScroll({ duration:500, easing:'easeInOutCirc' }); 
			
			// highlight form input containers when focused 
			$("form ul li").contents().find(".field").each(function() { if($(this)[0].type == 'radio' || $(this)[0].type == 'checkbox' || $(this)[0].type == 'file') { $(this) .click(function() {$(this).parents("li").addClass("selected")}) .focus(function() {$(this).parents("li").addClass("focused")}) .blur(function() {$(this).parents("li").removeClass("focused")}); } else if($(this)[0].className.match('addr')) { $(this) .focus(function() {$(this).parents("li").addClass("focused")}) .blur(function() {$(this).parents("li").removeClass("focused")}); } else { $(this) .focus(function() {$(this).parents("li").addClass("focused")}) .blur(function() {$(this).parents("li").removeClass("focused")}); } }); 
			
			// footnote links 
			if ($("#content a[href]").not($("#content #sidebar a[href]")).length > 0) { $("#footnote") .before("<h2 class=\"printOnly\">Footnote links (for printed copy)</h2>") .before("<ol id=\"footnotes\" class=\"printOnly\"></ol>") .before("<hr>"); var footnote = 1; $("#content a[href]").not($("#content #sidebar a")).each(function() { $(this).after("<sup class=\"printOnly\">"+footnote+"</sup>"); 

//link = $(this)[0].pathname;
link = $(this).attr("href"); 
																																																																																									if (link.indexOf("#") == 0) { 
	link = document.location.href + link; // anchor link on current page 
} else if (link.indexOf("mailto:") >= 0) { 
	link = "Email address: " + link.substring(7); // email address 
} else if ((link.indexOf("http") && link.indexOf("https")) < 0) { 
	if (link.indexOf("/") == 0) { 
		link = "http://" + document.domain + link; // root-relative link 
	} else { link = "http://" + document.domain + "/" + link; // page-relative link 
	} 
} 
																																																																																									$("#footnotes").append("<li>"+link+"</li>"); footnote++; }); 
			} 
			// open non-web documents in a new window without browser chrome (except the outreach page - too many)
			$("body[class!=outreach] #content a[href$='.doc'], body[class!=outreach] #content a[href$='.pdf'], body[class!=outreach] #content a[href$='.xls'], body[class!=outreach] #content a[href$='.ppt'], body[class!=outreach] #content a[href$='.dot'], body[class!=outreach] #content a[href$='.pot']").each(function() {
																																													$(this).click(function () { 
																																																			window.open( $(this).attr("href"), $(this).text(),'height=500,width=700,left=100,top=75,resizable=yes,scrollbars=yes,toolbar=no,status=no' ); 
return false; }); 

$(this).after(" <small class=\"noprint\">(opens in a new window)</small>"); 
}); 
			
			// add striping to tables and highlight a row on rollover 
			$("#content tr") .mouseover(function() { $(this).addClass("highlight"); }) .mouseout(function() { $(this).removeClass("highlight"); }); $("#content tr:even").addClass("alt"); } 
			
			// figure out server 
			var server = window.location.protocol + "//" + window.location.host; 
			
			// section menu highlighting 
			var $currentAnchor = null; $('#section ul a').each(function(){ var href = $(this).attr('href'); if( window.location.href.indexOf( server + href ) >= 0 && href.length > 1 ) { $(this).addClass("current"); if ($currentAnchor != null) { $currentAnchor.removeClass("current"); 
																																																																				// remove current from parent section 
																																																																				} $currentAnchor = $(this); } }); 
			// handler to swap input hint text when focused 
			var swapValues = []; $(".swap_value").each(function(i){ swapValues[i] = $(this).val(); $(this).focus(function(){ if ($(this).val() == swapValues[i]) { $(this).val(""); } }).blur(function(){ if ($.trim($(this).val()) == "") { $(this).val(swapValues[i]); } }); }); // form validation 
			$.formValidator = $("#support-form form").validate({ errorClass: "error", errorPlacement: function(error, element) { error.appendTo( element.parent().get(0) ); }, highlight: function(element, errorClass) { $(element).parents("li").addClass(errorClass); }, unhighlight: function(element, errorClass) { $(element).parents("li").removeClass(errorClass); 
																																																																																							  } 
																																																																																							  }); 
			}); 