(function($) {
	$.log = function(message) {	// Logging
		if(window.console) { console.debug(message); } else { alert(message); }
	};
	$.track = function(options){			// URL Trackign
		var defaults = {
			remove_duplicates: false // number = sensitivity threshold (must be 1 or higher)
		}; 
		var options = $.extend(defaults, options||{});		
		var recent_urls = JSON.parse($.cookie("recent_urls")||"[]");		
		var past_recent_urls = recent_urls.slice();
		if(options.remove_duplicates == true){
			for(var i = recent_urls.length -1; i >=0; i-- ){
				if(recent_urls[i].url == document.location.href) recent_urls.splice(i, 1);
			};
		};		
		if(recent_urls.length >= 10) recent_urls.pop();	
		recent_urls.unshift({url:document.location.href,title:$("title").text()});
		$.cookie("recent_urls", JSON.stringify(recent_urls), {path: '/', expires: 1 });
		
		return past_recent_urls;  //return urls before track called
	};
})(jQuery);
