$(document).ready(function(){
	$("dl.faq dd").hide();
	$("dl.faq dt a").click(function(){
		$(this).parent().next("dd:first").toggle();
	});
	$("div.questionnaireholder input:radio").click(function(){
		if($(this).val()=="no" || $(this).val()=="a" || $(this).val()=="b"){
			$(this).parent().parent().find("span.questionnairewarn").hide();
			$(this).parent().children("span.questionnairewarn").show();
		} else {
			$(this).parent().parent().find("span.questionnairewarn").hide();
		}
	});
	$("form#questionnaire").submit(function(ev){
		var hasErrors=0;
		$("div.questionnaireholder").each(function(){
			if($("input:radio:checked",this).length==0){
				hasErrors++;
			}
		});
		if($("input[name=Accredited]:radio:checked",this).length==0){
			hasErrors++;
		}
		if(jQuery.trim($("input[name=qname]",this).val()).length==0){
			$("input[name=qname]",this).val("")
			hasErrors++;
		}
		if(jQuery.trim($("input[name=qemail]",this).val()).length==0){
			$("input[name=qemail]",this).val("");
			hasErrors++;
		}
		if(jQuery.trim($("input[name=qphone]",this).val()).length==0){
			$("input[name=qphone]",this).val("");
			hasErrors++;
		}
		if(hasErrors>0){
			alert("All fields are required. Please check the questionnaire, complete all of the responses and try again. If you need assistance, send an e-mail to invest@ponziocapital.com or call toll-free (800) 520-2124.");
			ev.preventDefault();
			return false;
		}
	});
});