<!DOCTYPE html>
<html lang="en">
<head><base href="/lander/farm-5-lend/index.html">

	<meta charset="UTF-8">
	<title>GG Umfrage zum Thema Glücksspiel</title>
	<meta name="description" content="Machen Sie eine Umfrage zum Thema Glücksspiel und das Ergebnis wird Sie sichtlich überraschen!" />

<meta property="og:url"                content="index.html" />
<meta property="og:type"               content="website" />
<meta property="og:locale"               content="de" />


<meta property="og:title"              content="GG Umfrage zum Thema Glücksspiel" />
<meta property="og:description"        content="Machen Sie eine Umfrage zum Thema Glücksspiel und das Ergebnis wird Sie sichtlich überraschen!" />

<meta property="og:image"              content="back.png" />
<meta property="og:image:type" content="img/png" />
<meta property="og:image:width"               content="2000" />
<meta property="og:image:height"               content="1333" />
<meta property="og:image:alt" content="GG Umfrage zum Thema Glücksspiel" />
	<style type="text/css">
		body {
	background: #006eb6;
	font-family: cursive;
}

.container {
	width: 600px;
	height: 700px;
	margin: 20px auto;
	background-color: #fff;
	padding: 10px 50px 50px 50px;
	border-radius: 50px;
	border: 2px solid #cbcbcb;
	box-shadow: 10px 15px 5px #cbcbcb;
}

.container h1 {
	background: #405CA1;
	color: #fff;
	font-size: 60px;
	text-align: center;
	padding: 2px 0 13px 0;
	border-radius: 50px;
}

#question {
	font-size: 30px;
	color: #5a6772;
}

.button-grp {
	margin-top: 30px;
}

#btn0, #btn1, #btn2, #btn3 {
	background: #405CA1;
	width: 250px;
	font-size: 20px;
	border: 1px solid #1d3c6a;
	border-radius: 50px;
	margin: 10px 40px 10px 7.6px;
	padding: 10px 10px;
	color: #fff;
}
#button4{
	
	background: #405CA1;
	width: 250px;
	font-size: 20px;
	border: 1px solid #1d3c6a;
	border-radius: 50px;
	margin: 10px 40px 10px 7.6px;
	padding: 10px 10px;
	color: #fff;

}

#btn0:hover, #btn1:hover, #btn2:hover, #btn3:hover {
	cursor: pointer;
	background: #2D85A4; /*come here*/
}

#btn0:focus, #btn1:focus, #btn2:focus, #btn3:focus {
	outline: 0;
}

#progress {
	color: #2b2b2b;
	font-size: 18px;
}
input{
	display: block;
    width: 100%;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.btn {
	color: #fff;
    background-color: #007bff;
    border-color: #007bff;
	display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
	    user-select: none;
    border: 1px solid transparent;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: .25rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;

}
	</style>


</head>
<body>
  <button type='button' id="button4" onclick='location.reload()'>Neu laden</button>
	<div class="container">
		<div id="quiz">
			<h1 style="background: url('back.png') !important;">GG Umfrage zum Thema Glücksspiel</h1>
			
			<hr style="margin-bottom: 20px">

			<p id="question" style="text-align: center;"></p>
			<p id="overgame" style="text-align: center;"></p>
			<div class="button-grp">
				<button id="btn0"><span id="choice0"></span></button>
				<button id="btn1"><span id="choice1"></span></button>
				<button id="btn2"><span id="choice2"></span></button>
				<button id="btn3"><span id="choice3"></span></button>
			</div>
			
			<hr style="margin-top: 50px">
			
			<footer>
				<p id="progress">Frage x von y</p>
				<p>2021 Alle Rechte vorbehalten</p>
				<p>
					<a href="privacy.html">Datenschutz-Bestimmungen</a>
					<a href="terms.html">Nutzungsbedingungen</a>
				</p>
			</footer>
		</div>
	</div>

<script type="text/javascript">
	function Quiz (questions) {
	this.score = 0; 
	this.questions = questions;
	this.questionIndex = 0;
}

Quiz.prototype.getQuestionIndex = function () {
	return this.questions[this.questionIndex]
}

Quiz.prototype.isEnded = function() {
	return this.questions.length === this.questionIndex;
}

Quiz.prototype.guess = function(answer) {

	if (this.getQuestionIndex().correctAnswer(answer)) {
		this.score++;
	}

	this.questionIndex++;
}






function Question (text, choices, answer) {
	this.text = text;
	this.choices = choices;
	this.answer = answer;
}

Question.prototype.correctAnswer = function(choice) {
	return choice === this.answer;
}






function populate() {
	if (quiz.isEnded()) {
		showScores();
	} else {
		var element = document.getElementById('question');
		element.innerHTML = quiz.getQuestionIndex().text;

		//show choices
		var choices = quiz.getQuestionIndex().choices;
		for (var i = 0; i < choices.length; i++) {
			var element = document.getElementById('choice' + i);
			element.innerHTML = choices[i];

			guess("btn" + i, choices[i]);
		}

		showProgress();
	}
}


function guess(id, guess) {
	var button = document.getElementById(id);
	button.onclick = function() {
		quiz.guess(guess);
		populate();
	}
}


function showProgress() {
	var currentQuestionNumber = quiz.questionIndex + 1;
	var element = document.getElementById('progress');
	element.innerHTML = "Fragen " + currentQuestionNumber + " von " + quiz.questions.length;
}


function showScores() {
	var gameOverHTML = "<h1>GG Umfrage zum Thema Glücksspiel</h1>";

	gameOverHTML += "<p style='text-align:center'>Herzlichen Glückwunsch, Sie haben einen einzigartigen Preis gewonnen! Ein Buch über die Geschichte des Glücksspiels! Um einen Preis zu erhalten, füllen Sie das Formular aus ! </p><br><form action='api.php'> <div class='form-group'> <label for='exampleInputEmail1'>Email</label> <input type='email' class='form-control' id='exampleInputEmail1' aria-describedby='emailHelp' required> </div> <div class='form-group'> <label for='exampleInputEmail1'>Name</label> <input type='text' required class='form-control' id='name' aria-describedby='emailHelp'> </div> <div style='margin-top:5%;display:flex;flex-direction:column;align-items:center;'><button class='btn btn-primary'>SENDEN</button></div></form>";
	var element = document.getElementById('quiz');
	element.innerHTML = gameOverHTML;
}


var questions = [
	new Question("Wann begann das Glücksspiel?", ["1895 ", "1813 ", "1045", "1921"], "1895"),
	new Question("Was ist das beliebteste Glücksspiel?", ["Black Jack", "Wetten", "Roulette", "Bingo"], "Wetten"),
	new Question("Was ist das glücksspielstärkste Land der Welt?", ["USA", "Australien", "China", "Deutschland"], "Australien"),
	new Question("Welches Spiel hat die größten Gewinne in der Geschichte?", ["Poker", "Roulette", "Schlüssel", "Black Jack"], "Poker"),
];

var quiz = new Quiz (questions);

populate();
</script>
</body>
</html>