var motor =
{
	//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
	preLoadingInit : function ()
	{
		this.bind_postLoadingInit = this.postLoadingInit.bindAsEventListener(this);
		document.observe("dom:loaded",this.bind_postLoadingInit);
	},
	//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
	postLoadingInit : function ()
	{
		document.stopObserving("dom:loaded", this.bind_postLoadingInit);
		motor.afficheTemps("term");
		$('what').observe("change", this.ecouteurSelectWhat);
	},
	//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
	ecouteurSelectWhat : function ()
	{
		var selection = $F("what");

		$('option-capacity').show();

		if(selection == "location-vacances") // location
		{
			motor.afficheTemps ("term");
		}else if(selection == "derniere-minute") // Derniere minute
		{
			motor.cacheTemps();
			$('option-capacity').hide();
		}else if(selection == "promotion") // Promo
		{
			motor.afficheTemps ("term");
			$('option-capacity').hide();
		}else if(selection == "week-end") // Week end
		{
			motor.afficheTemps ("dterm");
		}
	  
	},	
	//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~},
	cacheTemps : function ()
	{
		$('option-temps-1').hide();
		$('option-temps-2').hide();
	},
	//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~},
	afficheTemps : function (type)
	{
		$('option-temps-1').show();
		$('option-temps-2').show();
		if(type == "term")
		{
			$(type).show();
			$('dterm').hide();
		}
		else if(type == "dterm")
		{
			$(type).show();
			$('term').hide();
		}

	},
    //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
    nop : null
};
motor.preLoadingInit();



