$().ready(function() {

	 $.validator.addMethod("isHuman", function(value, element) {
    	return this.optional(element) || value == '10';
		},"Please enter correct answer");

     // SET CONTACT FORM UP FOR VALIDATION
     $("#thecontactform").validate({
    	rules : {
        verification : { isHuman : true }
    	}
	});

	  
	 // ADD MASK FOR PHONE INPUT 
	 $("#phone").mask("(999) 999 - 9999",{placeholder:" "});
	 
	 // HIDE THE STUFF WE DON'T WANT TO SHOW UNTIL A USER CLICKS ON SOMETHING
	 $("#fs-skillednursing, #p-onbehalfof-other, #p-howhear-magazine, #p-howhear-senior-pub, #p-howhear-other").hide();
	 
     $("#skilled-nursing-care").click(function(){
          if ($("#skilled-nursing-care").is(":checked"))
          {
          	$("#fs-skillednursing").show("fast");
          }
          else
          {     
          	$("#fs-skillednursing").hide("fast");
          }
     });	 
	 
     $("#onbehalfof").change(function()
     {
          switch ($(this).val())
          {
               case 'other':
               $("#p-onbehalfof-other").toggle();
               break;
				
               default:
               $("#p-onbehalfof-other").hide();
          }
     });
	 
	 $("#howhear").change(function()
     {
          switch ($(this).val())
          {
               case 'other-magazine':
                    $("#p-howhear-magazine").toggle();
     				$("#p-howhear-senior-pub, #p-howhear-other").hide();
               break;
				
               case 'other-senior-pub':
                    $("#p-howhear-senior-pub").toggle();
     				$("#p-howhear-magazine, #p-howhear-other").hide();
               break;
				
               case 'other-other':
                    $("#p-howhear-other").toggle();
     				$("#p-howhear-magazine, #p-howhear-senior-pub").hide();
               break;								
				
               default:
               	$("#p-howhear-magazine, #p-howhear-senior-pub, #p-howhear-other").hide();
          }
     });

});
