jQuery(document).ready(function() {
								
	$(".ReplyButton").click(function(){
		var QuestionId = $(this).attr("id").substring($(this).attr("id").lastIndexOf("-")+1);
		$(".reply-form-wrap").hide();		
		$("#reply-form-wrap-"+QuestionId).show();
		
			jQuery("#ReplyForm-"+QuestionId).validate({
				onkeyup: false,
				rules: {
					ReplierName: {
						required: true
					},
					Comment: {
						required: true	
					},
					SpamPrevention: {
						required: true,
						remote: {
							url:"includes/ajax-captcha.php",
							type:"post"
						}
					}		
				},
				messages: {
		
				},
			errorPlacement: function(error, element) {
			error.appendTo( element.nextAll("p") );
			}
			});
		
		return (false);
	});
	
	$(".cancel-reply").click(function() {
		var QuestionId = $(this).attr("id").substring($(this).attr("id").lastIndexOf("-")+1);									  	
		$("#reply-form-wrap-"+QuestionId).hide();	
		return (false);
	});
	

	jQuery("#AskUsForm").validate({
		onkeyup: false,
		rules: {
			
			Email: {
				required: true,
				email: true
			},
			Subject:{
				required: true	
			},
			Question: {
				required: true	
			},
			SpamPrevention: {
				required: true,
				remote: {
					url:"includes/ajax-captcha.php",
					type:"post"
				}
			}		
		},
		messages: {
			FirstName: {
				required: "Please fill First Name."
			},
			LastName: {
				required: "Please fill Last Name."
			},
			Email: {
				required: "Please enter your email, this will be confidential.",
				email: "Please enter a valid email."
			},
			Subject: {
				required: "Please fill subject."	
			},
			Question: {
				required: "Please fill your question."	
			}
		},
	errorPlacement: function(error, element) {
	error.appendTo( element.nextAll("p") );
	}
	});
	
	

});
