var RotateHomeImages = {
	id:			'home-properties',
	url:		'properties/random',
	frequency:	12,
	fade:		2,
	pauseTime:	'',
	updater:	'',
	
	// INIT
	init: function()
	{
		
		// IF TRAVEL PARTNERS
		var loc = new String(window.location);
		if (loc.indexOf('travelpartners') != -1)
		{
			this.url = this.url + '/travelpartners';
		} // travelpartners
		
		this.updater = new Ajax.PeriodicalUpdater(this.id, this.url, {
			method:		'get',
			frequency:	this.frequency,
			onSuccess: function() 
			{
				RotateHomeImages.updater.url = RotateHomeImages.url + "?rand=" + Math.random();
				Element.setOpacity(RotateHomeImages.id, 0.0);
				Effect.Appear(RotateHomeImages.id, { duration: RotateHomeImages.fade });
				//setTimeout("Effect.Fade('" + RotateHomeImages.id + "', { duration: " + RotateHomeImages.fade + " });", ((RotateHomeImages.frequency-1)*1000));
			} // onSuccess
		});
	}, // init
	
	/**
	 * PAUSE
	 * For pausing rotation.
	 * When unpausing, delays a sec.
	 *
	 */
	pause: function(paused)
	{
		var _self = this;
		if (paused == false)
		{
			this.pauseTime = setTimeout(function(ms){
				_self.updater.start();
			}, 1000);
		} // if
		else
		{
			clearTimeout(this.pauseTime);
			this.updater.stop();
		} // else
	} // pause
};
Event.observe(window, 'load', function() { RotateHomeImages.init(); });