window.addEvent('domready', function(){

	//alert("Mootools 1.1 is ready!");



	$('Search').addEvent('click', function(e)
	{
		/**
		 * Prevent the submit event
		 */
		new Event(e).stop();

		var url = "index.php?option=com_musicadvisor&format=raw&view=didyoumean";

		/**
		 * This empties the log and shows the spinning indicator
		 */
		var text = $('didyoumean');

		//var searchword = $('search_searchword');

		var myRequest = new Ajax(url, {
		method: 'post',
		update: text,
		async: false,
		onComplete: function() {
				//text.removeClass('ajax-loading');
			},
		onRequest: function() {
			//text.empty().addClass('ajax-loading');
		},
		onFailure: function(xhr) {
			text.setText('...');
		}
		});

		myRequest.request(Object.toQueryString({ phrase: $('search_searchword').getValue()}));

		//myRequest.request();
		alert(Object.toQueryString({ phrase: $('search_searchword').getValue()}));

	});
});
