var originalFontSize;
var h = window.location.host.toLowerCase();
	
     $(document).ready(function(){
	 $("*").find("a[href='"+window.location.href+"']").each(function(){
       $(this).addClass("current")
     })
	 
	$("a[href^='http']:not([href*='" + h + "']), a[href$='.pdf']").attr("target", "_blank");
	$('a[href^="http://"]').addClass('externalLink');
	$("img").parent().removeClass('externalLink');
	$('a[href^="mailto:"]').addClass('emailLink');
	$('a[href*=.pdf]').attr({"target":"_blank"});
	$('a[href*=.pdf]').addClass('pdfLink');
	$('a[href*=.eps]').addClass('epsLink');
	$('a[href*=.jpg]').addClass('jpgLink');
	$('a[href*=.jpeg]').addClass('jpgLink');
    $("li:last-child").addClass('last');
    $("li:first-child").addClass('first');
	$("#localNav ul:first-child").addClass('p7TMM');
	$('.stripeMe tr:even').addClass('alt');
	$('#maincontent table tr td[colspan=3]').addClass('headerRow');
	$('input.clearme').focus(function() {
    	$(this).val("");
  	});
	
	// wrap up the special characters in sup tags
	var myhtml = document.body.innerHTML;
	myhtml = myhtml.replace(/\u00ae/gi,'<sup>&reg;</sup>');
	myhtml = myhtml.replace(/\u2122/gi,'<sup>&trade;</sup>');
	//document.body.innerHTML = myhtml;

	// Reset Font Size
	originalFontSize = $('html').css('font-size');
	getCookieSetFont();
  
  
	$(".resetFont").click(function(){
		$('html').css('font-size', originalFontSize);
		clearFontCookie();
	});
  
  // Increase Font Size
  $(".increaseFont").click(function(){
  	var currentFontSize = $('html').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
	$('html').css('font-size', newFontSize);
	setFontCookie();
	return false;
  });
  
  // Decrease Font Size
  $(".decreaseFont").click(function(){
  	var currentFontSize = $('html').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
	$('html').css('font-size', newFontSize);
	setFontCookie();
	return false;
  });
});

function setFontCookie()
{
	var currentFontSize = $('html').css('font-size');
	$.cookie("fontsize", parseFloat(currentFontSize, 10), { path: '/'} );
}

function getCookieSetFont()
{
	var newFontSize =  $.cookie("fontsize") + "px";
	if (newFontSize != "nullpx")
		$('html').css('font-size', newFontSize);
}

function clearFontCookie()
{
	$.cookie("fontsize", parseFloat(originalFontSize, 10), { path: '/'} );
}


