// JavaScript Document

$(document).ready(function() {
  $("#surveyform").livequery("submit", function() {
    $("#add_entry").hide("slow", function() {
      var str = $("#surveyform").serialize();
      $.post('/survey.html', str, function(data){
        $("#add_entry").html(data);
      });
    });
    $("#add_entry").show("slow");
    return false;
  });
});

$(document).ready(function() {
   $("#form2").livequery("submit", function() {
    $("#add_entry").hide("slow", function() {
      var str = $("#form2").serialize();
      $.post('/guestbook.html/', str, function(data){
    //$.post("/guestbook.html/", {"name": $("#id_name").val(), "state": $("#id_state").val(), "comment": $("#id_comment").val()}, function(data) {
        $("#add_entry").html(data); 
      });
    });
    $("#add_entry").show("slow");
    return false;
  });
});


$(document).ready(function() {
   $("#reserveform").livequery("submit", function() {
    $("#reserve_entry").hide("slow", function() {
    $.post("/reserve.html", {"name": $("#id_name").val(), "email": $("#id_email").val()}, function(data) {
      $("#reserve_entry").html(data); 
      });
    });
    $("#reserve_entry").show("slow");
    return false;
  });
});

$(document).ready(function() {
   $("#contactusform").livequery("submit", function() {
    $("#contactus").hide("slow", function() {
    $.post("/contactus.html", {"name": $("#id_name").val(), "email": $("#id_email").val(), "topic": $("#id_topic").val(), "message": $("#id_message").val()}, function(data) {
      $("#contactus").html(data); 
      });
    });
    $("#contactus").show("slow");
    return false;
  });
});

$(document).ready(function(){
 $("#add_entry").hide();
 $("#search_entry").hide();
 $("#show_add").click(function () {
   $("#search_entry:visible").hide('slow');
   //$("#search_entry:hidden").show('slow');
   $("#add_entry:visible").hide('slow');
   $("#add_entry:hidden").show('slow');
  });
});

$(document).ready(function(){
 $("#add_entry").hide();
 $("#search_entry").hide();
 $("#search").click(function () {
   $("#search_entry:visible").hide('slow');
   $("#search_entry:hidden").show('slow');
   $("#add_entry:visible").hide('slow');
   //$("#add_entry:hidden").show('slow');
  });
});

// Show Shipping Address Form
$(document).ready(function(){
	if (! $("#id_s_check").is(":checked")) {
		$("#shipping_section").hide();
	}
	$("#id_s_check").click(function(){
		$("#shipping_section").toggle();
	});
});

