/*** HashThat! ***/
var questions = new Array(20);
var ans1 = new Array(20);
var ans2 = new Array(20);
var ans3 = new Array(20);
var ans4 = new Array(20);
var correct = new Array(20);

questions[0] = "Who developed the cuneiform form of writing?";
ans1[0] = "The Green";
ans2[0] = "The Indians";
ans3[0] = "The Sumerians";
ans4[0] = "The Hebrews";
correct[0] = 3;

questions[1] = "What is cryptography?";
ans1[1] = "The art of deception";
ans2[1] = "The art of manipulation";
ans3[1] = "The art of secrecy";
ans4[1] = "The art of non-repudiation";
correct[1] = 3;

questions[2] = "What are the three pillars of cryptography?";
ans1[2] = "Privacy, Data Integrity, Authentication";
ans2[2] = "Integrity, manipulation, authorization";
ans3[2] = "Privacy, repudiation, authorization";
ans4[2] = "Confidentiality, security, manipulation";
correct[2] = 1;

questions[3] = "What is data integrity?";
ans1[3] = "Allowing tampering of data.";
ans2[3] = "Checking the identity of the source.";
ans3[3] = "Enforcing strictly no data tampering.";
ans4[3] = "Checking if encryption algorithm can be broken.";
correct[3] = 3;

questions[4] = "What is encryption?";
ans1[4] = "Converting ciphertext to plain text";
ans2[4] = "Converting plaintext to ciphertext ";
ans3[4] = "Wiretapping and eavesdropping";
ans4[4] = "None of the above";
correct[4] = 2;

questions[5] = "Who should care about cryptography?";
ans1[5] = "Doctors.";
ans2[5] = "Businessmen.";
ans3[5] = "You.";
ans4[5] = "All of the above.";
correct[5] = 4;

questions[6] = "What is the worst mistake you can make while encrypting a message?";
ans1[6] = "Choosing an easily breakable key";
ans2[6] = "Not being up to date with the latest technology";
ans3[6] = "Letting the key slip accidentally";
ans4[6] = "Not using one time pad ";
correct[6] = 3;

questions[7] = "What is the cipher used by the Hebrews called?";
ans1[7] = "Beale cipher";
ans2[7] = "Polyalphabetic cipher";
ans3[7] = "Symmetric cipher";
ans4[7] = "ATBASH cipher";
correct[7] = 4;

questions[8] = "Where is cryptography believed to have originated?";
ans1[8] = "Egypt";
ans2[8] = "China";
ans3[8] = "UK";
ans4[8] = "Rome";
correct[8] = 1;

questions[9] = "What is Julius Caesars contribution to cryptography?";
ans1[9] = "Polybius square";
ans2[9] = "Skytale";
ans3[9] = "Caesar Cipher";
ans4[9] = "ATBASH Cipher";
correct[9] = 3;

questions[10] = "Who broke the vignere cipher?";
ans1[10] = "Friedrich Kasiski";
ans2[10] = "Alberti";
ans3[10] = "Marian Rejewski";
ans4[10] = "Joseph Mauborgne";
correct[10] = 1;

questions[11] = "Who among the following invented the Enigma?";
ans1[11] = "Charles Babbage";
ans2[11] = "Arthur Scherbius";
ans3[11] = "Vernam Gilbert";
ans4[11] = "Len Adleman";
correct[11] = 4;

questions[12] = "Who was involved in decrypting the PURPLE?";
ans1[12] = "Entienne Bazeries";
ans2[12] = "Charles Babbage";
ans3[12] = "William Friedman";
ans4[12] = "Arthur Scherbius";
correct[12] = 3;

questions[13] = "What is the art of hiding information in pictures and audio clips called?";
ans1[13] = "Authentication";
ans2[13] = "Steganography";
ans3[13] = "Decryption";
ans4[13] = "Non-repudation";
correct[13] = 2;

questions[14] = "Which is a cryptographic protocol?";
ans1[14] = "SSH";
ans2[14] = "MD-5";
ans3[14] = "Public Key Cryptography";
ans4[14] = "SHA-1";
correct[14] = 1;

questions[15] = "Who invented PGP?";
ans1[15] = "Adi Shamir";
ans2[15] = "Phil Zimmermann";
ans3[15] = "Leonard Adleman";
ans4[15] = "Taher Elgamal";
correct[15] = 2;

questions[16] = "Who did the Enigma belong to?";
ans1[16] = "British";
ans2[16] = "Americans";
ans3[16] = "Germans";
ans4[16] = "French";
correct[16] = 3;

questions[17] = "M-134 is also known as";
ans1[17] = "Enigma";
ans2[17] = "PURPLE";
ans3[17] = "Strip Cipher";
ans4[17] = "SIGABA";
correct[17] = 4;

questions[18] = "What is the scientific name for deciphering codes?";
ans1[18] = "Cryptanalysis";
ans2[18] = "Decryptography";
ans3[18] = "Codebreaking";
ans4[18] = "Decoding";
correct[18] = 1;

questions[19] = "What was UKs contribution to cryptography during the wars?";
ans1[19] = "Deciphering the Babington plot";
ans2[19] = "Solution to the enigma";
ans3[19] = "Manufacturing an unbreakable cipher";
ans4[19] = "Decrypting the messages about Pearl Harbor attack";
correct[19] = 2;


var tTkindex, val;

function check()
{
	var again = '<a href="#" onclick="javascript:quiz(); return false;">One more!</a>';
	if (val == correct[tTkindex])
		document.getElementById("quizinfo").innerHTML = "Congratulations! You answered the question correctly."+again;
	else
		document.getElementById("quizinfo").innerHTML = "Sorry, the correct answer is: " + eval("ans" + correct[tTkindex] + "[" + tTkindex + "]") + again;
}

function quiz()
{
	tTkindex = Math.floor(Math.random() * questions.length);
	val = 1;  
	
	var qanda = '<strong>' + questions[tTkindex] + '</strong><br /><br />';
	qanda = qanda + '<input type="radio" name="tt" onclick="val = 1" checked="checked" />' + ans1[tTkindex] + '</input><br />';
	qanda = qanda + '<input type="radio" name="tt" onclick="val = 2" />' + ans2[tTkindex] + '</input><br />';
	qanda = qanda + '<input type="radio" name="tt" onclick="val = 3" />' + ans3[tTkindex] + '</input><br />';
	qanda = qanda + '<input type="radio" name="tt" onclick="val = 4" />' + ans4[tTkindex] + '</input><br /><br />';
	qanda = qanda + '<button type="submit" id="search_b" onclick="check()" >Check</button>';
	qanda = qanda + '</div>';
	
	if(document.getElementById("quizinfo"))
	{
		document.getElementById("quizinfo").innerHTML = "";	 
		document.getElementById("quizq").innerHTML = qanda;	 
	}
}

xAddEventListener(window,"load",quiz,false);
