$(document).ready(function () {
	
	var link;
	$('#content a[@href^="http://"]').each(function(){
		link=$(this).html();
		$(this).html(link+'<span class="externallink">&nbsp;</span>');
		//console.log($(this).html());
	})
	
	$('#content a[@href$=".pdf"]').each(function(){
		link=$(this).html();
		$(this).html('<span class="pdflink">&nbsp;</span>'+link);
		//console.log($(this).html());
	})
	
	$('#content a[@href^="mailto:"]').each(function(){
		link=$(this).html();
		$(this).html('<span class="mailto"></span>'+link);
		//console.log($(this).html());
	})
	
	$('a:contains("Google Maps")').each(function(){
		$(this).parent().after('<div class="googlemap"><iframe width="100%" height="100%" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+$(this).attr('href')+'"></iframe></div>');
		$(this).parent().hide();
	});
	
	$('a:contains("YouTube")').each(function(){
		$(this).parent().after('<div class="youtube"><object width="425" height="344"><param name="movie" value="'+$(this).attr('href')+'"></param><embed src="'+$(this).attr('href')+'" type="application/x-shockwave-flash" width="425" height="344"></embed></object></div>');
		$(this).parent().hide();
	});
	
	$('tr:first').css('font-weight','bold');
	
	$('tr:even').css('background-color','#fdfdfd');
	
	
     $('#rightmenu li a').hover(function(){
     	$(this).addClass('active');
     	//console.log($(this).attr('id'));
     }, function() {
     	$(this).removeClass('active');
     });
     	
	var path = location.pathname.substring(1);
	var path2=location.pathname;
	// Set your homepage here, eg. /index.php or /
	var home = "./";
	// Check the home link against the path and set the navigation accordingly. 
	if (path == home || path2 == "/") {
		// Note that the jQuery selector matches *only* the home link
		var nav=$('a[@href="' + home + '"]');
	} else {
		var nav=$('a[@href$="' + path + '"]');
	}
	
	nav.addClass('active');
	
	$('.active').attr('src','uploads/i/h'+$(this).attr('id')+'.gif');

});