function showBookBox(caterer_id)
{
	var myVerticalSlideAct = new Fx.Slide('box_form', { duration: 500 });
	myVerticalSlideAct.addEvent('complete', function() {
		var req = new Request.HTML({url:'/index.php?page=mainbook&func=init&caterer_id='+caterer_id, 
			onSuccess: function(html) {
				$('box_form').set('html', '');
				$('box_form').adopt(html);
				var myVerticalSlideIn = new Fx.Slide('box_form', { duration: 500 });
				myVerticalSlideIn.slideIn();
				if($('or_btn_start')) {
				    $('or_btn_start').addEvent('click', function(e){
					sendBook();
    				    });
				}

				location.href='#book_form';
			},
			onFailure: function() {
				$('box_form').set('text', 'The request failed.');
			}
		});
		req.send();
	});
	myVerticalSlideAct.slideOut();

}

function sendBook()
{
	var params  = "page=mainbook&func=book&";
		params += "&or_name="+encodeURIComponent($('or_name').value);
		params += "&or_email="+encodeURIComponent($('or_email').value);
		params += "&or_tel="+encodeURIComponent($('or_tel').value);
		params += "&or_time="+$('or_time').value;
		params += "&or_person="+$('or_person').value;
		params += "&or_smoking="+ ($('or_smoking').checked ? 'on' : 'off');
		params += "&caterer_id="+$('or_caterer').value;
		params += "&p="+$('hiddenpage').value;
	var myVerticalSlideAct = new Fx.Slide('box_form', { duration: 500 });
	myVerticalSlideAct.addEvent('complete', function() {

		var req = new Request.HTML({url:'/index.php?page=mainbook&func=book&'+params, 
			onSuccess: function(html) {
				$('box_form').set('html', '');
				$('box_form').adopt(html);
				var myVerticalSlideIn = new Fx.Slide('box_form', { duration: 500 });
				myVerticalSlideIn.slideIn();
				
				if ($('or_btn_start'))
				{
					$('or_btn_start').addEvent('click', function(e){
						sendBook();
					});
				}
				if ($('or_btn_end'))
				{
					$('or_btn_end').addEvent('click', function(e){
						resetBook();
					});
				}

			},
			onFailure: function() {
				$('box_form').set('text', 'The request failed.');
			}
		});
		req.send();
	});
	myVerticalSlideAct.slideOut();

}

function resetBook()
{
	var myVerticalSlideAct = new Fx.Slide('box_form', { duration: 500 });
	myVerticalSlideAct.addEvent('complete', function() {
		var req = new Request.HTML({url:'/index.php?page=mainbook&func=search', 
			onSuccess: function(html) {
				$('box_form').set('html', '');
				$('box_form').adopt(html);
				var myVerticalSlideIn = new Fx.Slide('box_form', { duration: 500 });
				myVerticalSlideIn.slideIn();
				//location.href='#book_form';
			},
			onFailure: function() {
				$('box_form').set('text', 'The request failed.');
			}
		});
		req.send();
	});
	myVerticalSlideAct.slideOut();
}
