$(function(){
	
				//prevent users from typing in more than 1000 characters
				$('#yourQuestion').keyup(function(){
					if($('#yourQuestion').val().length > 1000){
						$('#yourQuestion').val($('#yourQuestion').val().substr(0, 1000));
					}
					
				});
				
				//ask a question
				$("#submitButton").click(function(){					   				   
					$(".error").hide();
					var hasError = false;
					var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
									
					var emailAddress = $("#email").val();
					if(emailAddress == '') {
						$("#email").after('<span class="error">Please enter your e-mail address.</span>');
						hasError = true;
					} else if(!emailReg.test(emailAddress)) {	
						$("#email").after('<span class="error">Please enter a valid email address.</span>');
						hasError = true;
					}
									
					var userQuestion = $("#yourQuestion").val();
					if(userQuestion == '' || userQuestion == 'Type in your question for the expert') {
						$("#yourQuestion").after('<span class="error">Please enter your question.</span>');
						hasError = true;
					}
					
					var captcha = $("#vCode").val();
					if(captcha == '') {
						$("#vCode").after('<span class="error">Please enter the validation code.</span>');
						hasError = true;
					} else if(captcha != '') {
						var code = $("#vCode").val();
						var hashcode = $("#cCode").val();
						$.post("/_inc/dspCaptchaCheck.cfm", {validationCode:code, captchaCode:hashcode},
						function(data){
							if(jQuery.trim(data) == "true") {
								var hasError = false;
								
								$("#askAQuestion li.buttons").append('<img src="/images/global/loading.gif" alt="Loading" id="loading" />');
								
								$.post("/_inc/dspAskQuestion.cfm", $("#askAQuestion").serialize(),
									function(data){
									$("#askAQuestion").slideUp("normal", function() {				   								
									$("#askAQuestion").before('<h5 class="question">Thank you for interest.</h5><p>We will respond within 3 business days. If you would like to speak to someone immediately, please call 1.800.TRIPWIRE.</p>');											
									});
								}
								);
								return false;
							} else {
								var hasError = true;
								$("#vCode").after('<span class="error">Please enter the correct validation code.</span>');
							}
						});
						return false;
					}
									
					return false;
			});	});
