jQuery(document).ready(function() { 



			// fade out the form after it is submitted
			checkForm();
			
			// bind 'myForm' and provide a simple callback function 
			jQuery('#comments_form').ajaxForm( {
			beforeSubmit: validForm, 
			success: fadeForm
			}); 
			
			
			
			function checkForm() {
			jQuery("#comments_form").validate({
				  
			 
					messages: {
					author: "Your name is required" ,
					email: "Please enter a e-mail address" ,
					user_agreement: "You must agree to the user agreement terms to participate",   
					text: "This field is required"
					
					},	  
									  
									  
					errorPlacement: function(error, element) { 
					if ( element.is(":radio") ) 
					error.appendTo( element.parent().next().next() ); 
					else if ( element.is(":checkbox") ) 
					error.insertBefore ( element.next() ); 
					else 
					error.appendTo( element.parent() ); 
					}
					
						
						
						
						});
									
						};
			
			
						function validForm() {
						
						
						checkForm();
						jQuery("#comments_form").valid();
						
						if (jQuery("#comments_form").valid() == false ) {
						
						return false;
						
						}
						
						};

						function fadeForm() {
						
						jQuery("#comments_form").fadeOut(500);
						jQuery("#post_a_comment").fadeOut(500, function() {
						
						jQuery("#comment_posting_indicator").show("fast");
						jQuery("#comment_posting_indicator").fadeOut(500);
						jQuery("#comment_posting_approval").show(1200);	
						
						
						});
								
						
						};


       
        }); //end jquery document ready