
$(document).ready(function() {


 
	$("div.hlist li").filter(function() {
	  var currentURL = window.location.toString().split("/");
	  var MenuLink = $("a",this).attr("href").split("/");
	  return MenuLink[MenuLink.length-1] == currentURL[currentURL.length-1];
	}).addClass("active");
	if($("div.hlist li").hasClass("active") == false) {
	  $("div.hlist li:first").addClass("active");
  }


     //scroll top
   	$('a[href*=#top]').click(function(){$('html,body').animate({scrollTop: 0},400)});

  
  // Add icons to special links
  	var filetypes = /\.(zip|exe|pdf|doc*|xls*|ppt*|mp3)$/i; 
	
	$('#main a[href]').each(function(){  
     var href = $(this).attr('href');  
     if ((href.match(/^https?\:/i)) && (!href.match(document.domain))){  
         $(this).click(function() {  
             var extLink = href.replace(/^https?\:\/\//i, '');
         });
		 $(this).addClass('externalLink');
	}
	 else if (href.match(/^mailto\:/i)){  
		 $(this).click(function() {  
			 var mailLink = href.replace(/^mailto\:/i, '');  
		 });  
	 }  
	 else if (href.match(filetypes)){  
		 $(this).click(function() {  
			 var extension = (/[.]/.exec(href)) ? /[^.]+$/.exec(href) : undefined;  
			 var filePath = href.replace(/^https?\:\/\/(www.)duhaime\.org\//i, '');
		 }); 
		 $(this).addClass(extension); 
		}
	});
  
});
