var quiz_type="virtual";$(document).ready(function(){var a="",b="";$("#results_button").click(function(){var f=0,e=0,d=0;if($('input[@type="radio"]:checked').length==4){$('input[@type="radio"]:checked').each(function(){switch($(this).val()){case"a":f+=1;break;case"b":e+=1;break;case"c":d+=1;break}});var c=false;if(f>=3){$("#answer1").show();c=true}if((f==1)||(f==2)||(e>=2)){$("#answer2").show();c=true}if(!(c)){$("#answer3").show();c=true}$("#quContainer").css("height",$("#QBoxContainer").height());$("#QBoxContainer").slideUp("slow",function(){$("#RBoxContainer").slideDown("slow");$.post("/QuizSvc/Quiz/Step1",{question1:$('input[name="question1"]:checked').val(),question2:$('input[name="question2"]:checked').val(),question3:$('input[name="question3"]:checked').val(),question4:$('input[name="question4"]:checked').val(),quiztype:quiz_type},function(g){a=g.status},"json")})}else{}});jQuery(document).ajaxError(function(f,e,c,d){});$("#step2").validate({rules:{entrant_name:"required",entrant_phone:"required",entrant_company:"required",entrant_email:{required:true,email:true}},messages:{entrant_name:"Please enter your name",entrant_phone:"Please enter your phone number",entrant_company:"Please enter your company name",entrant_email:"Please enter a valid email address"},submitHandler:function(c){if(a.length>3){$("#submit_button").fadeOut("fast",function(){$("#submit_button").attr("src","/QuizSvc/QuestionnaireImages/ajax-loader.gif").fadeIn("fast");$.post("/QuizSvc/Quiz/Step2",{entrant_name:$("#entrant_name").val(),entrant_phone:$("#entrant_phone").val(),entrant_company:$("#entrant_company").val(),entrant_email:$("#entrant_email").val(),uqid:a},function(d){b=d.code;if(b=="200"){$("#RBoxContainer").slideUp("slow",function(){$("#SuccessRBox").slideDown("slow")})}else{$("#RBoxContainer").slideUp("slow",function(){$("#SuccessRBox h2").text("Thank you for entering, unfortunately there was an issue with the server, please try again later.");$("#SuccessRBox").slideDown("slow")})}},"json")})}}});$("#submit_button").click(function(){$("#step2").submit()})});
