//startingDate: 02-06-2019
var Time={};
var Utils = {};
Utils.Path='';
Utils.mobileDeviceFlag=false;
var questionId=0,startTime=0,scoredMarks=0,totalMarks=0,resId=0,level=1,label='';
var totalJsonQueCount=580,wordType="sentence";
Time.totalQuestions=5;
Time.level=0;
Time.sttString="";
$(document).ready(function()
{
	$(".se-pre-con").fadeOut("slow");
	if(navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i))
		Utils.mobileDeviceFlag=true;
	/* if(Utils.mobileDeviceFlag) 
		Utils.Path=Android.getMediaPath("Time");  */
		document.body.style.backgroundImage = "url("+Utils.Path+"images/skin/Date-N-time_Cover.png"+")";
	setTimeout(function()
	{
		Time.init();
	},200);
});

Time.init=function()
{
	$("#coverPage").show();
	$("#gamePage,#lastPage").hide();
	$(".header").not("#logoDiv").css("visibility","hidden");
	Time.createStars();
	Time.initializeVariables();
	Time.setAllImages();
}

Time.createStars=function()
{
	var newImage,newDiv,i,numberOfStars=5;
	for(i=1;i<=Math.floor(numberOfStars);i++)
	{
		newDiv= document.createElement("div");
		newDiv.setAttribute("id","starDiv"+i); 
		newDiv.setAttribute("class","nopadding stars col-xs-2 col-md-2 col-lg-2 col-sm-2"); 

		newImage= document.createElement("img");
		newImage.setAttribute("id","starImg"+i); 
		newImage.setAttribute("class","img-responsive nopadding col-sm-12 col-lg-12 col-md-12 col-xs-12"); 
		newImage.setAttribute("src",Utils.Path+"images/skin/star1.png");
		$(newDiv).append(newImage);
		$("#starDiv").append(newDiv);
	}
$("#starDiv").css("visibility","hidden");
};
Time.initializeVariables=function()
{
	Time.amPmArr=["AM","PM"];
	Time.quarterArr=[15,45];
	Time.questionCtr=0;
	Time.recordClickFlag=false;
	Time.sttArr=[];
	Time.ansArr=[];
	Time.ans1=' ';
	Time.solSet=[];
	Time.ttsArr=[];
	Time.attemptFlag=false;
	Time.ansFoundFlag=false;
	Time.objArr=[];
	Time.correctCounter=0;
	Time.seconds=0;
	Time.activityFlag=false;
	Time.possibilityArr=[];
}
Time.setAllImages=function()
{
	document.getElementById("clockDiv").style.backgroundImage = "url("+Utils.Path+'images/skin/Digital-Clock.png'+")";
	document.getElementById("calendarDiv").style.backgroundImage = "url("+Utils.Path+'images/skin/Calendar.png'+")";
	document.getElementById("table").style.backgroundImage = "url("+Utils.Path+'images/skin/table.png'+")";
	document.getElementById("home").src=Utils.Path+"images/skin/Home.png";
	document.getElementById("logo").src=Utils.Path+"images/skin/logo.png";
	document.getElementById("sound").src=Utils.Path+"images/skin/Sound.png";
	document.getElementById("playImg").src=Utils.Path+"images/skin/Play.png";
	document.getElementById("next").src=Utils.Path+"images/skin/Skip.png";
	document.getElementById("mike").src=Utils.Path+"images/skin/Mic.png";
	document.getElementById("nextButton").src=Utils.Path+"images/skin/Next.png";
	//document.getElementById("replayImg").src=Utils.Path+"images/skin/replay.png";
	document.getElementById("teddy").src=Utils.Path+"images/skin/Taddy_Normal.png";
	document.getElementById("lastPara").innerHTML=Time.hardCodedData.gameOver;
	$("#play").addClass("animated bounceInLeft");
}
Time.playGame=function()
{
	document.body.style.backgroundImage = "url("+Utils.Path+"images/skin/Bg.png"+")";
	$("#coverPage,#lastPage").hide();
	$("#gamePage,#clockDiv,#question,#teddyDiv").show();
	//$(".header").css("visibility","visible"); 
	  var newStyle = "<style>"+
	"@font-face {  "+
	 "font-family: 'loopy';"  +
	"src: url('fonts/LOOPY___.ttf') format('truetype');"+
	"}  </style>";
	$("head").append(newStyle);    
	$("#timeSpan").css("font-family","loopy");  
	Time.findQuestionAndAnswer();

}

Time.findQuestionAndAnswer=function()
{
	var numArr=[],i,obj={};
	for(i=0;i<5;i++)
	{
		obj={};
		Time.rno=Math.floor(Math.random()*Time.questionArr.length);
		while(numArr.includes(Time.rno))
			Time.rno=Math.floor(Math.random()*Time.questionArr.length);
		numArr.push(Time.rno);
		Time.findValues();
		obj.question=Time.questionArr[Time.rno].question;
		obj.sound=Time.questionArr[Time.rno].sound;
		obj.ans=Time.ansWord;
		obj.hr=Time.randHr;
		obj.min=Time.randMin;
		obj.amPm=Time.amPm;
		obj.month=Time.month;
		obj.date=Time.date;
		obj.day=Time.day;
		obj.questionId=Time.questionArr[Time.rno].questionId;
		Time.objArr.push(obj);
		Time.possibilityArr.push(Time.ttsArr);
	}
	console.log(Time.objArr);
	Time.setQuestion();
}

Time.findValues=function()
{
	var d,hour,minute,rno,monthNo,dayNo,dateNo,question,randomChoice,date,randTts;
	Time.activityFlag=false;
	Time.randHr=Math.floor(Math.random()*12+1);
	randomChoice=Math.floor(Math.random()*2);
	if(randomChoice==0)
	{
		randQuarter=Math.floor(Math.random()*Time.quarterArr.length);
		Time.randMin=Time.quarterArr[randQuarter];
	}
	else
		Time.randMin=Math.floor(Math.random()*5)*10;
	rno=Math.floor(Math.random()*Time.amPmArr.length);
	Time.amPm=Time.amPmArr[rno];
	//document.getElementById("hr").innerHTML=hour;
	//document.getElementById("colon").innerHTML=":";
	//document.getElementById("min").innerHTML=minute;
	//document.getElementById("ap").innerHTML=" "+Time.amPm;
	monthNo=Math.floor(Math.random()*Time.monthArr.length);
	Time.month=Time.monthArr[monthNo];
	if(monthNo<5)
	{
		if(monthNo==0)
			Time.date=Math.floor(Math.random()*28+1);
		else
			Time.date=Math.floor(Math.random()*30+1);
	}
	else	
		Time.date=Math.floor(Math.random()*31+1);
	dayNo=Math.floor(Math.random()*Time.daysArr.length);
	Time.day=Time.daysArr[dayNo];
	//document.getElementById("year").innerHTML=2019;
	//document.getElementById("month").innerHTML=Time.month;
	//document.getElementById("date").innerHTML=date;
	//document.getElementById("day").innerHTML=Time.day;
	//question=Time.questionArr[Time.rno].question;
	//questionId=Time.questionArr[Time.rno].questionId;
	//document.getElementById("questionDiv").innerHTML=question;
	if(((((Time.randHr>=6 && Time.randHr<7) ||(Time.randHr==7 && Time.randMin==0)) || ((Time.randHr>=9 && Time.randHr<10) ||(Time.randHr==10 && Time.randMin==0))) && Time.amPm=="AM") || ((((Time.randHr>=8 && Time.randHr<9) ||(Time.randHr==9 && Time.randMin==0)) || ((Time.randHr>=10 && Time.randHr<11) ||(Time.randHr==11 && Time.randMin==0))) && Time.amPm=="PM"))  
		Time.activityFlag=true;
	Time.findAnswer();	
}

Time.setQuestion=function()
{
	var d;
	Time.attemptFlag=false;
	//Time.questionCtr++;
	totalMarks=0;
	d=new Date();
	startTime=d.getDate()+"-"+(d.getMonth()+1)+"-"+d.getFullYear()+" "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();

	var question,answer,hour,min,amPm,year,month,date,day;
	$("#mike").removeClass("blink_me");
	$("#mike").prop('src',Utils.Path+"images/skin/Mic.png");
	question=Time.objArr[Time.questionCtr].question;
	answer=Time.objArr[Time.questionCtr].answer;
	hour=Time.objArr[Time.questionCtr].hr;
	if(hr<10)
		$("#timeSpan").css("margin-left","2.2vw");
	else
		$("#timeSpan").css("margin-left","1.7vw");	
	min=Time.objArr[Time.questionCtr].min;
	amPm=Time.objArr[Time.questionCtr].amPm;
	if(amPm=="AM" && (hour>=6 && hour<8))
		document.getElementById("windowDiv").style.backgroundImage = "url("+Utils.Path+'images/skin/Window_Morning_1.png'+")";
	else
	if((amPm=="AM" && (hour>=8 && hour<12)) || amPm=="PM" && hour<5)
		document.getElementById("windowDiv").style.backgroundImage = "url("+Utils.Path+'images/skin/Window_Afternoon.png'+")";
	else 
	if((amPm=="PM" && (hour>=5 && hour<7)))
		document.getElementById("windowDiv").style.backgroundImage = "url("+Utils.Path+'images/skin/Window_Evening.png'+")";
	else
		document.getElementById("windowDiv").style.backgroundImage = "url("+Utils.Path+'images/skin/Window_Night.png'+")";

	year=Time.objArr[Time.questionCtr].year;
	month=Time.objArr[Time.questionCtr].month;
	date=Time.objArr[Time.questionCtr].date;
	day=Time.objArr[Time.questionCtr].day;
	questionId=Time.objArr[Time.questionCtr].questionId;
	document.getElementById("hr").innerHTML=hour;
	document.getElementById("colon").innerHTML=":";
	if(min<10)
		document.getElementById("min").innerHTML="0"+min;
	else
		document.getElementById("min").innerHTML=min;
	document.getElementById("ap").innerHTML=" "+amPm;
	document.getElementById("year").innerHTML=2019;
	document.getElementById("month").innerHTML=month;
	if(date<10)
		document.getElementById("date").innerHTML="0"+date;
	else
		document.getElementById("date").innerHTML=date;
	document.getElementById("day").innerHTML=day;
	document.getElementById("questionDiv").innerHTML=question;
	Time.playSound();
	Time.startTimer();

}
//noResponse timer
Time.startTimer=function()
{
	if(Time.noResponseTimer)
	{
		clearInterval(Time.noResponseTimer);
		Time.noResponseTimer=null;
		Time.seconds=0;
	}	
	Time.noResponseTimer=setInterval(function() 
	{
		Time.seconds++;
		if(Time.seconds>=7)
		{
			document.getElementById("playSound").src=Utils.Path+"sounds/instructions/please_ans_the_ques.mp3";
			document.getElementById("playSound").play();
			clearInterval(Time.noResponseTimer);
			if(Time.timeOut)
			{
				clearTimeout(Time.timeOut);
				Time.timeOut=null;
			}
			Time.timeOut=setTimeout(function()
			{
				Time.seconds=0;
				Time.startTimer();
			},2000);
		}
	},1000);
}	


Time.endGame=function()
{
	clearInterval(Time.noResponseTimer);
	clearTimeout(Time.timeOut);
	$('#responseBoxDiv').hide();
	$("#gamePage").hide();
	$("#lastPage").show();
	Time.giveStars();
	if(Utils.mobileDeviceFlag) 
		Android.StudentCertification(Time.correctCounter,Time.totalQuestions,"3");
}
//creates stars according to the score of game
Time.giveStars=function()
{
	var fractionVar,i,numberOfStars=Time.correctCounter; 
	for(i=1;i<=Math.floor(numberOfStars);i++)
		document.getElementById("starImg"+i).setAttribute("src",Utils.Path+"images/skin/star2.png");
	$("#starDiv").css("visibility","visible");
	if(numberOfStars!=0)
	{
		document.getElementById("playSound").src=Utils.Path+"sounds/instructions/"+Time.sounds[(numberOfStars-1)].sound;
		document.getElementById("playSound").play();
	}
};

Time.findAnswer=function()
{
	Time.solSet=[];
	Time.sttArr=[];
	var dateArr=[],answer,remainder,division,rno;
	switch(Time.rno)
	{
		case 0:Time.solSet.push(Time.month);
				break;
		case 1:{
					answer=Time.date+" "+Time.month;
					Time.solSet.push(answer);
					remainder=Time.date%10;
					division=Time.date/10;
					if((remainder>0 && remainder<4) && Math.floor(division)!=1)
					{
						switch(remainder)
						{
							case 1: answer=Time.date+"st"+" "+Time.month;
									break;
							case 2:answer=Time.date+"nd"+" "+Time.month;
									break;		
							case 3:answer=Time.date+"rd"+" "+Time.month;
									break;
						}
						Time.solSet.push(answer);
					}
					else
					{
						answer=Time.date+"th"+" "+Time.month;
						Time.solSet.push(answer);
					}
					break;		
				}
		case 2:Time.solSet.push(Time.day);
				break;
		case 3:{
					Time.solSet.push(Time.randHr+' '+Time.randMin+' '+Time.amPm);// document.getElementById("timeSpan").innerHTML;
				   	Time.solSet.push(Time.randHr+''+Time.randMin+' '+Time.amPm);
				   	//Time.solSet.push(Time.randHr+' '+Time.randMin);
					if(Time.randHr==12)
				   	{
				   		//Time.solSet.push(0+""+0+' '+Time.randMin);
				   		if(Time.amPm=="PM" && Time.randMin==0)
				   		{
				   			answer="noon";
							Time.solSet.push(answer);
						}
						else if(Time.amPm=="AM" && Time.randMin==0)
						{
				   			answer="midnight";
							Time.solSet.push(answer);
						}
				   	}
				   	switch(Time.randMin)
				   	{
				   		case 0: answer=Time.randHr+" "+"o' clock";
				   				Time.solSet.push(answer);
				   				answer=Time.randHr+" "+Time.amPm;
				   				Time.solSet.push(answer)
				   				break;
				   		case 10:answer=10+" "+"minutes past"+" "+Time.randHr+" "+Time.amPm;	
				   				Time.solSet.push(answer);	
				   				break;
				   		case 15:answer=15+" "+"minutes past"+" "+Time.randHr+" "+Time.amPm;
				   				Time.solSet.push(answer);	
				   				answer="quarter past"+" "+Time.randHr+" "+Time.amPm;
				   				Time.solSet.push(answer);
				   				break;		
				   		case 20:answer=20+" "+"minutes past"+" "+Time.randHr+" "+Time.amPm;
				   				Time.solSet.push(answer);	
				   				break;
				   		case 30:answer=30+" "+"minutes past"+" "+Time.randHr+" "+Time.amPm;
				   				Time.solSet.push(answer);	
				   				answer="half past"+" "+Time.randHr+" "+Time.amPm;
				   				Time.solSet.push(answer);
				   				break;
				   		case 40:if(Time.randHr==12)
				   					answer=20+" "+"minutes to"+" "+1+" "+Time.amPm;
				   				else
				   					answer=20+" "+"minutes to"+" "+(Time.randHr+1)+" "+Time.amPm;
				   				Time.solSet.push(answer);	
				   				break;
				   		case 45:if(Time.randHr==12)
				   				{
				   					answer=15+" "+"minutes to"+" "+1+" "+Time.amPm;
				   					ans1=0+" "+45+" "+Time.amPm;
				   				}
				   				else
				   				{	
				   					answer=15+" "+"minutes to"+" "+(Time.randHr+1)+" "+Time.amPm;
				   					ans1=Time.randHr+" "+45+" "+Time.amPm;
				   				}
				   				Time.solSet.push(answer);
				   				Time.solSet.push(ans1);	
				   				if(Time.randHr==12)
				   					answer="quarter to"+" "+1+" "+Time.amPm;
				   				else
				   					answer="quarter to"+" "+(Time.randHr+1)+" "+Time.amPm;
				   				Time.solSet.push(answer);
				   				break;
				   		case 50:if(Time.randHr==12)
				   					answer=10+" "+"minutes to"+" "+(Time.randHr+1)+" "+Time.amPm;
				   				else
				   					answer=10+" "+"minutes to"+" "+1+" "+Time.amPm;
				   				Time.solSet.push(answer);	
				   				break;						
				   	}	
				   	break;		
				}
				case 4:if(Time.activityFlag==false)
				{
					rno=Math.floor(Math.random()*2);
					if(Time.amPm=="AM")
					{
						if(rno==1)
						Time.randHr=6;
					else
						Time.randHr=9;
					}
					else
					{
						if(rno==1)
							Time.randHr=8;
						else
							Time.randHr=10;
					}
				}



				if(((Time.randHr>=6 && Time.randHr<7) || (Time.randHr==7 && Time.randMin==0)) && Time.amPm=="AM")
							{
								answer="time to wake up";
				   				Time.solSet.push(answer);	
							}
					else if(((Time.randHr>=9 && Time.randHr<10) || (Time.randHr==10 && Time.randMin==0)) && Time.amPm=="AM")
							{
								answer="time to school";
				   				Time.solSet.push(answer);	
							}
					else if(((Time.randHr>=8 && Time.randHr<9) || (Time.randHr==9 && Time.randMin==0)) && Time.amPm=="PM")
							{
								answer="time to dinner";
				   				Time.solSet.push(answer);	
							}	
					else if(((Time.randHr>=10 && Time.randHr<11) || (Time.randHr==11 && Time.randMin==0))&& Time.amPm=="PM")
							{
								answer="time to bed";
				   				Time.solSet.push(answer);	
							}
					
						
	}
	console.log(Time.ttsArr);
	Time.ttsArr=Time.solSet.slice();
	Time.ttsArr.splice(1,1);
			if(Time.randHr==12 && Time.quarterArr.includes(Time.randMin))
			{
				Time.ttsArr.splice((Time.ttsArr.length-1),1);
			}
			if(Time.randMin==0)
			{
				Time.ttsArr.splice(0,1);
			}	
	randTts=Math.floor(Math.random()*Time.ttsArr.length)
	Time.ansWord=Time.ttsArr[randTts]+".";	
	console.log(Time.solSet);

	document.getElementById("itIs").innerHTML="It is";
	document.getElementById("ansSpan").innerHTML=Time.ansWord;
}

Time.playSound=function()
{
	clearInterval(Time.noResponseTimer);
	clearTimeout(Time.timeOut);
	Time.startTimer();
	document.getElementById("playSound").pause();
	document.getElementById("playSound").src=Utils.Path+"sounds/"+Time.objArr[Time.questionCtr].sound;
	document.getElementById("playSound").play();
}

Time.record=function()
{
	clearTimeout(Time.playsoundTimer);
	clearTimeout(Time.playYourTurnTimer);
	clearInterval(Time.noResponseTimer);
	clearTimeout(Time.timeOut);
	document.getElementById("playSound").pause();
	$("#sound").css("pointer-events","none");
	if(Utils.mobileDeviceFlag)
		Android.stopTts();
	else
	stopSomething();
	if(Time.recordClickFlag==false)
	{
		Time.recordClickFlag=true;
		if(Utils.mobileDeviceFlag)
			Android.startSttArray("eng");
		$("#mike").prop('src',Utils.Path+"images/skin/Stop.png");
		$("#mike").addClass("blink_me");
		if(Time.checkStatus)
		{
            clearInterval(Time.checkStatus);
            Time.checkStatus = null;
        }
		Time.checkStatus = setInterval(function() 
		{
			if (Utils.mobileDeviceFlag)
				Time.sttString = Android.getSttResult();
			console.log(Time.sttString);
			if('$$$'!== Time.sttString)
			{ 
				clearInterval(Time.checkStatus);
				if(Time.sttString !== "###" && Time.sttString !== "")
					 Time.checkAnswer();
				else
				{
					console.log('Stops');
					$("#sound").css("pointer-events","auto");
					Time.startTimer();
				}
				Time.recordClickFlag = false;
				$("#mike").prop('src',Utils.Path+"images/skin/Mic.png");
				$('#mike').removeClass('blink_me');
				
			}
		},500);
	}
	else
	{
		Time.recordClickFlag = false;
		if(Utils.mobileDeviceFlag)
			Android.stopStt();
		Time.sttString="";
		clearInterval(Time.checkStatus);
		$("#mike").prop('src',Utils.Path+"images/skin/Mic.png");
		$("#mike").removeClass("blink_me");
		$("#sound").css("pointer-events","auto");
	}
}

Time.checkAnswer=function()
{
	$("#sound").css("pointer-events","none");
	$("#mike").css("pointer-events","none");
	var i,j,k,counter=0,splitArr=[],lowercaseString;
	Time.attemptFlag=true;
	totalMarks++;
	Time.ansFoundFlag=false;
	//console.log(Time.sttString);
	//Time.sttString=Time.sttString.replace(/(~|`|!|@|#|$|%|^|&|\*|\(|\)|{|}|\[|\]|;|:|\"|'|<|,|\.|>|\?|\/|\\|\||-|_|\+|=)/g," ")
	Time.sttArr=Time.sttString.split(",");	
	Time.sttArr.splice(Time.sttArr.length-1);
	//console.log(Time.sttArr);
	
	console.log(Time.sttString);
	//alert(Time.sttArr);
	for(k=0;k<Time.possibilityArr[Time.questionCtr].length;k++)
	{	
		Time.ans=Time.possibilityArr[Time.questionCtr][k].toString();
		Time.ansArr=Time.ans.split(" ");
		if(Time.sttArr.includes(Time.ans))
		{
			Time.ansFoundFlag=true;
		}
		else
		{
			for(i=0;i<Time.sttArr.length;i++)
			{
				counter=0;
				Time.sttArr[i]=regex(Time.sttArr[i]);
				console.log(Time.sttArr[i]);
				lowercaseString=Time.sttArr[i].toLowerCase();
				splitArr=lowercaseString.split(" ");
				for(j=0;j<Time.ansArr.length;j++)
				{
					if(splitArr.includes(Time.ansArr[j].toLowerCase()))
					{
						counter++;
					}
				}
				if(counter==Time.ansArr.length)
				{
					Time.ansFoundFlag=true;
					//alert("correct");
					break;
				}
			}
			if(Time.ansFoundFlag)
				break;
		}
	}	
	// alert(Time.sttArr);
	// alert(Time.ansArr);
	if(Time.ansFoundFlag)
		{	
			scoredMarks=10;
			Time.correctCounter++;
			if(Android.mobileDeviceFlag)
				Android.addLearntData(Time.ansWord,totalJsonQueCount,wordType);
			document.getElementById("teddy").src=Utils.Path+"images/skin/Taddy_Win.png";
			document.getElementById("playSound").src=Utils.Path+"sounds/instructions/coorrect_beat.mp3";
			document.getElementById("playSound").play();			
		}
		else
		{
			scoredMarks=0;
			Time.ansFoundFlag=false;
			document.getElementById("teddy").src=Utils.Path+"images/skin/Taddy_Lose.png";
			document.getElementById("playSound").src=Utils.Path+"sounds/instructions/wrongSoundAksharkhadi.mp3";
			document.getElementById("playSound").play();
			//alert("wrong")
		}	
	Time.objArr.splice(Time.questionCtr,1);
	Time.possibilityArr.splice(Time.questionCtr,1);
	if(Time.nextQueTimer)
	{
		clearTimeout(Time.nextQueTimer);
		Time.nextQueTimer=null;
	}
	console.log(resId,questionId,scoredMarks,totalMarks,level,startTime,label);
	if(Utils.mobileDeviceFlag)
	Android.addScore(resId,questionId,scoredMarks,totalMarks,level,startTime,label);
	Time.nextQueTimer=setTimeout(function(){
		Time.nextQuestion();
	},2000);		
}

Time.nextQuestion=function()
{
	Time.recordClickFlag=false;
	document.getElementById("playSound").pause();
	clearTimeout(Time.nextQueTimer);
	clearTimeout(Time.playsoundTimer);
	clearTimeout(Time.playYourTurnTimer);
	clearInterval(Time.checkStatus);
	clearInterval(Time.noResponseTimer);
	clearTimeout(Time.timeOut);
	Time.sttString="";
	
	if(Time.attemptFlag==false)
		Time.questionCtr++;
	if(Time.objArr.length==0)
	{
		Time.endGame();
	}
	else if(Time.objArr.length!=0 && Time.questionCtr>=Time.objArr.length)
	{
		Time.showPopUP();
	}
	else
	{
		
		 // if(Utils.mobileDeviceFlag)
			// Android.stopTts();
		clearInterval(Time.noResponseTimer);
		clearTimeout(Time.timeOut);
		document.getElementById("playSound").pause();
		$("#sound").css("pointer-events","auto");
		$("#mike").css("pointer-events","auto");
		document.getElementById("answerDiv").style.visibility="hidden";
		document.getElementById("teddy").src=Utils.Path+"images/skin/Taddy_Normal.png";
		Time.setQuestion();
	}
}

Time.showPopUP=function()
{
	clearInterval(Time.noResponseTimer);
	clearTimeout(Time.timeOut);
	document.getElementById("playSound").pause();
	$('#responseBoxDiv').show();
	$('#questionMsg').text(Time.modalData.responseMsg);
	$('#Yes').text(Time.modalData.yes);
	$('#No').text(Time.modalData.no);
}
Time.showSkippedQuestions=function()
{
	Time.questionCtr=0;
	$('#responseBoxDiv').hide();
	document.getElementById("playSound").pause();
	$("#sound").css("pointer-events","auto");
	$("#mike").css("pointer-events","auto");
	document.getElementById("answerDiv").style.visibility="hidden";
	document.getElementById("teddy").src=Utils.Path+"images/skin/Taddy_Normal.png";
	Time.setQuestion();
}
// Time.callHome=function()
// {
// 	if(Time.attemptFlag==true)
// 	{
// 		if(Time.ansFoundFlag)
// 			scoredMarks=10;
// 		console.log(resId,questionId,scoredMarks,totalMarks,level,startTime,label);
// 		if(Utils.mobileDeviceFlag)
// 		Android.addScore(resId,questionId,scoredMarks,totalMarks,level,startTime,label);
// 	}
// 	location.reload();
// }

function regex (str) {
    str= str.replace(/(~|`|!|@|#|$|%|^|&|\(|\)|{|}|\[|\]|;|:|\"|'|<|,|>|\?|\/|\\|\||-|_|=)/g," ");
    return str.replace(/\./gi,"");
}

Time.showNextGame=function()
{
	if(Utils.mobileDeviceFlag) 
		Android.GotoNextGame();
}
