window.addEvent('domready', function() {
	// You can skip the following two lines of code. We need them to make sure demos
	// are runnable on MooTools demos web page.
	if (!window.demo_path) window.demo_path = '';
	var demo_path = window.demo_path;
	// --
		
	//We can use one Request object many times. 
	//onChange="if(this.selectedIndex != 0) 

	/*/$('makeRequest').addEvent('click', function() {
		req.send();
	});*/
	$('choix_d').addEvent('change', function()
		{
               // alert('http://jos.lesbonsreflexes.local/services/deroulant/commune/'+this.value);
			   
			   if(this.value != 0 )
			   {
                	var req = new Request.HTML(
					{
						url:'/services/commune/'+this.value, 
						onSuccess: function(html)
									{
										//Clear the text currently inside the results div.
										$('result').set('text', '');
										//Inject the new DOM elements into the results div.
										$('result').adopt(html);
									} // end function
									,
						//Our request will most likely succeed, but just in case, we'll add an
						//onFailure method which will let the user know what happened.
						onFailure: function()
						{
							$('result').set('text', 'Erreur...');
						} // end function
					} // end var
				); // end new request
				req.send();
				} // end if
			} // end function
	); // end add event
	/*$('choix_c').addEvent('change', function()
		{
               // alert('http://jos.lesbonsreflexes.local/services/deroulant/commune/'+this.value);
			   
			   if(this.value != 0 )
			   {
				   alert('ici'); 
                	var req = new Request.HTML(
					{
						url:'/services/deroulant/commune/'+this.value, 
						onSuccess: function(html)
									{
										//Clear the text currently inside the results div.
										$('result').set('text', '');
										//Inject the new DOM elements into the results div.
										$('result').adopt(html);
									} // end function
									,
						//Our request will most likely succeed, but just in case, we'll add an
						//onFailure method which will let the user know what happened.
						onFailure: function()
						{
							$('result').set('text', 'Erreur...');
						} // end function
					} // end var
				); // end new request
				req.send();
				} // end if
			} // end function
	); // end add event */
}); // end dom ready