$(document).ready(function () {
	$('#link_request').click(function () {
		$('#requestWindow').modal();
	});
	
	$('#link_book').click(function () {
		$('#bookWindow').modal();
	});

	$('#send_req').click(function () {
      $("#req_msg").html('');
     $.postJSON("data.php?action=sendRequest",{
                  name: $("#req_name").val(),
                  to: $("#req_to").val(),
                  email: $("#req_email").val(),
                  captcha: $("#req_captcha").val(),
                  more: $("#req_more").val()
                 }, function(json){
       
       if (json.Result==true){
           alert(json.Text);
           $.modal.close();
       }else{$("#req_msg").html(json.Text);}
    });  
  });

	$('#send_book').click(function () {
     $("#book_msg").html('');
     $.postJSON("data.php?action=sendBooking",{
                  arrival: $("#book_arrival").val(),
                  rooms: $("#book_rooms").val(),
                  nights: $("#book_nights").val(),
                  departure: $("#book_departure").val(),
                  name: $("#book_name").val(),
                  to: $("#book_to").val(),
                  email: $("#book_email").val(),
                  phone: $("#book_phone").val(),
                  captcha: $("#book_captcha").val(),
                  more: $("#book_more").val()
                 }, function(json){
       
       if (json.Result==true){
           alert(json.Text);
           $.modal.close();
       }else{$("#book_msg").html(json.Text);}
    });  
  });



});

