$(document).ready(function(){

	//pretty url fix
	var window_loc = String(window.location);
	var windowAnchorIdx = window_loc.indexOf('#',0);
	if (windowAnchorIdx > -1){
		window_loc = window_loc.substring(0,windowAnchorIdx);
	}	
	if (window_loc.charAt(window_loc.length-1) == '/'){
		window_loc = window_loc.substring(0,window_loc.length-1);	
	}
	
	//runs a regular expression on all hrefs beginning with a #
	//if the href already has a prefix ie it is inlinking to an anchor in another page or pretty urls are being used (do not apply the fix)	
	$("a:regex([href,/^\#/])").each(function(){		
		var hrefAnchorElement = $(this);
		var curAnchorLink = hrefAnchorElement.attr("href");
		hrefAnchorElement.attr("href", window_loc + curAnchorLink);			
	});	
});
