window.addEvent('domready',function(){
	//submit 
	$('orders').addEvent('submit',function(event){
		event.stop();
		if ($('hdd').style.display=='block'){
			var size = $$('hdd').getSize();
			$('hdd').setStyles({'display':'none'});
	    	$('hdm').setStyles({'display':'block','z-index':'1000'});
	    	$('hdm').empty().addClass('loading');

	    	var frequest = new Request.HTML({
				update: $('hdm'),
				url:'/ajax.form.php',
				onComplete: function(){
					$('hdm').removeClass('loading');
				}
	    	}).post($('orders'));
    	}
	});
});

//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;
//	// --
//	$('orders').addEvent('submit', function(e) {
//		//Prevents the default submit event from loading a new page.
//		e.stop();
//		//Empty the log and show the spinning indicator.
//		var log = $('hdd').empty().addClass('loading');
//		//Set the options of the form's Request handler. 
//		//("this" refers to the $('myForm') element).
//		this.set('send', {onComplete: function(response) { 
//			log.removeClass('loading');
//			log.set('html', response);
//		}});
//		//Send the form.
//		this.send();
//	});
//});
