jQuery.extend({
	history : {
		hash : 0,
		save : function(val)
		{
			val = escape(val)

			if ($.browser.msie)
			{
				if (!ajax_history)
					return

				var f = ajax_history.document;
				f.open();
				f.close();
				f.location.hash = val;
			}
			else
				location.hash = val;

			$.history.hash = val;
		},
		check : function()
		{
			var l = ($.browser.msie ? ajax_history.document.location.hash : location.hash).replace(/^#/, '');
			if (!$.browser.msie)
				l = escape(l)

			if ($.history.hash != l)
				$.history.reload(unescape($.history.hash = l));
		},
		arrival : function()
		{
			return !($.browser.msie ? ajax_history.document.location.hash : location.hash).replace(/^#/, '')
		},
		reload : function(hash) {}
	}
});

$(function() {
	$("body").prepend('<iframe id="ajax_history" style="display:none" ></iframe>');
	setInterval($.history.check, 250);
})
