//starting Date:03-09-2021
var DeepSea = {};
var Utils = {};
Utils.Path = '';
Utils.mobileDeviceFlag = false;
var questionId = 0, startTime = 0, scoredMarks = 0, totalMarks = 10, resId = 0, level = 1, label = '';
var ctx, canvas, ctx2, optionCanvas;
var startAngle = -Math.Pi / 2, rno, numerator = 0, denomenator = 0; startPoint = 0;
var optionHeight, optionWidth;
DeepSea.ansArr = [];
DeepSea.numArr = [2, 3, 4, 5, 6, 8, 10, 12]
DeepSea.ansString = "";
DeepSea.CakeMakinFlag = false;
DeepSea.sameDenomFlag = true;
ans = 0;
startPoint = 0;
ctr = 0;

$(document).ready(function () {
	$(".se-pre-con").fadeOut("slow");
	if ((navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) && !(window.location.href.includes('http')))
		Utils.mobileDeviceFlag = true;
	//if(Utils.mobileDeviceFlag) 
	//Utils.Path=Android.getMediaPath("DeepSea"); 
	setTimeout(function () {
		DeepSea.init();
	}, 100);
});
//shows coverPage
DeepSea.init = function () {
	$("#coverPage").show();
	$("#gamePage").hide();
	$("#endPage").hide();
	$(".header").not("#logo").css("visibility", "hidden");
	//	document.body.style.backgroundImage = "url(" + Utils.Path + "images/skin/GameCover.png";
	DeepSea.setAllImages();
	DeepSea.initializeVariables();
	DeepSea.createBirdDivs();
}

DeepSea.initializeVariables = function () {
	DeepSea.ansArr = [];
	DeepSea.arcArr = [];
	DeepSea.fractionArr = [];
	DeepSea.numerArr = [];
	DeepSea.denomArr = [];
	DeepSea.questionArr = [];
	DeepSea.addition = 0;
	DeepSea.questionCtr = 0;
}
DeepSea.createBirdDivs = function () {
	var parentDiv = document.getElementById("outerDiv");
	for (i = 0; i < 30; i++) {
		birdDiv = document.createElement("div");
		birdDiv.setAttribute("id", "birdDiv" + i);
		birdDiv.setAttribute("class", "nopadding col-xs-12 col-md-12 col-lg-12 col-sm-12");
		parentDiv.appendChild(birdDiv);

		container = document.createElement("div");
		container.setAttribute("id", "container" + i);
		container.setAttribute("class", "nopadding col-xs-1 col-md-1 col-lg-1 col-sm-1 containers");
		pos = Math.floor(Math.random() * 70);
		container.style.left = pos + "vw";
		birdDiv.appendChild(container);

		imgDiv = document.createElement("div");
		imgDiv.setAttribute("id", "imgDiv" + i);
		imgDiv.setAttribute("class", "nopadding col-xs-12 col-md-12 col-lg-12 col-sm-12 birdDivs");
		container.appendChild(imgDiv);

		birdImg = document.createElement("IMG");
		birdImg.setAttribute("id", "birdImg" + i);
		birdImg.setAttribute("class", "birdImages nopadding col-xs-12 col-md-12 col-lg-12 col-sm-12 img-responsive");
		birdImg.setAttribute("src", Utils.Path + "images/" + DeepSea.questions[i].Image);
		imgDiv.appendChild(birdImg);

		textDiv = document.createElement("div");
		textDiv.setAttribute("id", "textDiv" + i);
		textDiv.setAttribute("class", "textDivs nopadding col-xs-12 col-md-12 col-lg-12 col-sm-12");
		container.appendChild(textDiv);
		$("#textDiv" + i).text(DeepSea.questions[i].Bird_name);

	}
}

//set sources to images
DeepSea.setAllImages = function () {
	document.getElementById("homeImage").src = Utils.Path + "images/skin/Home.png";
	document.getElementById("logoImage").src = Utils.Path + "images/skin/logo.png";
	document.getElementById("playImg").src = Utils.Path + "images/skin/Play.png";
	//document.getElementById("reloadImg").src = Utils.Path + "images/skin/playAgain.png";
	//document.getElementById("creditImg").src = Utils.Path + "images/skin/Credit.png";
	//document.getElementById("replayImg").src = Utils.Path + "images/skin/playAgain.png";
	//document.getElementById("checkImg").src = Utils.Path + "images/skin/Done.png";
	//document.getElementById("nextImg").src = Utils.Path + "images/skin/Next.png";
	//document.getElementById("dontUseImg").src = Utils.Path + "images/skin/dontUse.png";
	//document.getElementById("swapImg").src = Utils.Path + "images/skin/swap.png";

	//document.getElementById("gameOver").innerHTML = DeepSea.hardcodedData.gameOver;
}


DeepSea.playGame = function () {
	$("#coverPage").hide();
	$("#gamePage").show();
	$(".header").css("visibility", "hidden");

}

