var RapidLocation = {};
RapidLocation.HistoryObserver = {

	/**
	 * @desc Interval seconds
	 */
	delay: 0.2,

	/**
	* @desc Interval timer
	*/
	interval: null,

	/**
	* @desc true if started otherwise false
	*/
	started: false,

	/**
	* start()
	*
	* @desc Start interval timer
	*/
	start: function ()
	{
		if (this.started) return;
		this.interval = new PeriodicalExecuter(RapidLocation.HistoryObserver.dispatch, this.delay);
		this.started = true;
	},

	/**
	 * stop()
	 *
	 * @desc Stop interval timer
	 */
	stop: function ()
	{
		if (! this.started) return;
		this.interval.stop();
		this.started = false;
	},

	/**
	 * dispatch()
	 *
	 * @desc Called by interval timer when isModfied()
	 */
	dispatch: function() 
	{
		/*
		RapidHistory.update();

		if (RapidHistory.isModified())	
		{
			
			RapidHistory.hash.each(function(pair) {

//														 var_dump(pair.key);
				//var registry = RapidHistory	

			});
			
		}
		*/
		var_dump('moo');
	}

};

RapidLocation.History = {
	title: null,
	link: null,
	currentURL: null,
	previousURL: null,
	previousReplace: null,
	defaultReplace: 'replace',

	start: function (hash)
	{
		/*
		if (window.navigator.userAgent.indexOf("MSIE 7") != -1)
			console.log('start history');

		console.log('start history all');

		console.log(hash);
		*/
	},

	load: function ()
	{
		this.title = payload.title;
		this.link = payload.link;
		this.previousURL = this.currentURL = payload.currentURL;
		this.defaultReplace = payload.defaultReplace;
	}
		
};

RapidLocation.Bookmark = {

	start: function ()
	{
		var hash = window.location.hash.substring(1);
		var jump = hash.indexOf('rf:') == 0;

		if (jump)
		{

				var _url = hash.substring(3); // minus rf:

				url = (_url.indexOf(':') > -1) ? _url.split(':')[0] : _url;

				window.location = url;
		} else
		{
			RapidLocation.History.start(hash);

		}
	}

};


