/*
 * forms plugin
 */
$(document).ready(function(){

     if ($("input[name='presence']:checked").val() == "1") {
        $("input[name='formKey']").val("contact/" + $("#formType").val() + "/coming");
     }
     else if ($("input[name='presence']:checked").val() == "0") {
        $("div[id^='extendedFormElements']").css("display","none");
        $("input[name='formKey']").val("contact/" + $("#formType").val() + "/notcoming");
     } else {
        $("div[id^='commonFormElements']").css("display","none");
        $("div[id^='extendedFormElements']").css("display","none");
        $("#formSubmit").css("display","none");
     }


   $("input[name='presence']").click(
      function() {
         if ($("input[name='presence']:checked").val() == "1") {
            $("#formSubmit").show("fast");
            $("div[id^='commonFormElements']").show("fast");
            $("div[id^='extendedFormElements']").show("fast");

            $("input[name='formKey']").val("contact/" + $("#formType").val() + "/coming");
         }
         else {
            $("#formSubmit").show("fast");
            $("div[id^='commonFormElements']").show("fast");
            $("div[id^='extendedFormElements']").hide("fast");

            $("input[name='formKey']").val("contact/" + $("#formType").val() + "/notcoming");
         }
      }
   );
 
});


