/***********************
* Adobe Edge Composition Actions
*
* Edit this file with caution, being careful to preserve 
* function signatures and comments starting with 'Edge' to maintain the 
* ability to interact with these actions from within Adobe Edge
*
***********************/
(function($, Edge, compId){
var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes

   //Edge symbol: 'stage'
   (function(symbolName) {
      
      
      Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {
//TOUCH OR CLICK
var clickEventType = ('ontouchend' in document.documentElement ? "touchend" : "click");
var qNoShow = 1; // Show question number ie 1/10
	var resetScoreCheck = 0;
	var qNo;
	var bonusTxt = 0;
	var yesNo = 99; //SET yesNo so it can't = menu_id

function getStorage(name){//CHECK FOR LOCAL STORAGE
	if(typeof(Storage)!=="undefined"){
		if (window.localStorage){//localStorage
		  var stored=localStorage.getItem(name);
		}else{ //sessionStorage
		  var stored=sessionStorage.getItem(name);
		}
		var storedItem=(stored!=null)?stored:"";
	}else{
		 var storedItem= "";
	}
	return storedItem;
} 
function setStorage(name,value){
	if(typeof(Storage)!=="undefined"){
		if (window.localStorage){//localStorage
		  localStorage.setItem(name,value);
		}else{ //sessionStorage
		  sessionStorage.setItem(name,value);
		}
	}else{
		return false;
	}
}
	var storedBonus=parseInt(getStorage('storedbonus'));
	var bonus =(storedBonus>0)?storedBonus:0; //Set bonus at 0
	var ans;
	var correct = 0;
	var wrong = 0;
	var questions = 10; //Number of questions in each round
	var levelsNo=5; //number of rounds
	var max = 0;
	var answers=['A','B','C','D'];
	var storedTeam=getStorage('storedteam');
	var team =(storedTeam!="")?storedTeam:"";
	var teamArr=['BRA','CRO','MEX','CMR','ESP','NED','CHI','AUS','COL','GRE','CIV','JPN','URU','CRC','ENG','ITA','SUI','ECU','FRA','HON','ARG','BIH','IRI','NGR','GER','POR','GHA','USA','BEL','ALG','RUS','KOR'];
	var xmlNo = "GN31860.xml";

	var headline;
	var headlinetxt = sym.getSymbol("styleHead").$("headlineTxt").css("pointer-events","none");
	var source;
	var sourcetxt = sym.getSymbol("styleBase").$("sourceTxt").css("pointer-events","none");
	var resultTxt;
	var resultTxttxt = sym.getSymbol("quizMc").$("resultTxt").css({"pointer-events":"none" ,"background-color":"rgba(218,0,0,1)", "padding":"10px", "border-width":"1px","border-style":"solid","border-color":"rgba(0,0,0,1", "border-radius":"1px", "box-shadow":"5px 5px 5px rgba(0,0,0,0.3)"});

	var txt=[];
	txt[0] = sym.getSymbol("teamsMc").$("txt0").css({"pointer-events":"none",});
	txt[1] = sym.getSymbol("quizMc").$("txt1").css({"pointer-events":"none"});
	txt[2] = sym.getSymbol("quizMc").getSymbol("teamBtn").$("txt2").css({"pointer-events":"none"});
	txt[3] = sym.getSymbol("quizMc").getSymbol("bonusBtn").$("txt3").css({"pointer-events":"none"});
	txt[4] = sym.getSymbol("quizMc").$("txt4").css({"pointer-events":"none"});
	txt[5] = sym.$("txt5").css({"pointer-events":"none"});
	txt[6] = sym.$("txt6").css({"pointer-events":"none"});
	txt[7] = sym.$("txt7").css({"pointer-events":"none"});
	txt[8] = sym.$("txt8").css({"pointer-events":"none"});
	txt[9] = sym.$("txt9").css({"pointer-events":"none"});
	txt[10] = sym.getSymbol("quizMc").$("txt10").css({"pointer-events":"none","background-color":"rgba(61,61,61,1)", "padding":"10px"});
	txt[11] = sym.$("txt11").css({"pointer-events":"none"});
	txt[12] = sym.$("txt12").css({"pointer-events":"none"});
	txt[13] = sym.$("txt13").css({"pointer-events":"none"});
	txt[14] = sym.getSymbol("winnerMc").$("txt14").css({"pointer-events":"none", "box-shadow":"5px 5px 5px rgba(0,0,0,0.3)"});
	txt[15] = sym.$("txt15").css({"pointer-events":"none"});
	txt[16] = sym.getSymbol("teamsMc").getSymbol("returnQuizBtn").$("txt16").css({"pointer-events":"none"});
	txt[17] = sym.getSymbol("winnerMc").$("txt17").css({"pointer-events":"none","background-color":"rgba(0,0,0,1)", "padding-top":"15px"});
	txt[18] = sym.$("txt18").css({"pointer-events":"none"});
	txt[19] = sym.$("txt19").css({"pointer-events":"none"});
	txt[20] = sym.$("txt20").css({"pointer-events":"none"});
	txt[21] = sym.$("txt21").css({"pointer-events":"none"});

	var txtArr=[];
	var countryArr=[];
	//AJAX retrieves data from xml source specified in url, maps xml variable to DOM object variable
	$.ajax({	
		type: "GET",
		url: xmlNo,
		dataType: "xml",
		success: function(xml) {
			custonCol = $(xml).find('customColour').text();
			sym.getSymbol("styleHead").$("headerBox").css("background-color",custonCol);
			headline = $(xml).find('headline').text();
			headlinetxt.html(headline);
			source = $(xml).find('source').text();
			sourcetxt.html(source);
			//create array from xml, put it into array of text elements
			for (var i=0; i<20; i++){
			txtArr[i]=$(xml).find('txt'+i).text();
			txt[i].html(txtArr[i]);
			}
			txt[4].html(txtArr[3+level]);
			sym.getSymbol("winnerMc").$("txt17").animate({left:187 - sym.getSymbol("winnerMc").$("txt17").width()/2}, 0);
			sym.getSymbol("quizMc").$("txt10").animate({top:500 - sym.getSymbol("quizMc").$("txt10").height()+0}, 0);

			for (var c=0; c<32; c++){
				countryArr[c]=$(xml).find('country'+c).text();
				var teamText="<div class='teamlist'>";
				teamText +="<table class='team' id='t"+c+"'><tr>";
				teamText +="<td class='tflag' id='tflag"+c+"'></td>";
				teamText +="<td class='tname' id='tname"+c+"'></td>";
				teamText +="<td class='tsel' id='tsel"+c+"'></td>";
				teamText +="</tr></table>";
				teamText +="</div>";		
				sym.getSymbol("teamsMc").$("table").append(teamText);
				flagHTML = "<img src='flags/" +teamArr[c]+ ".png' height='34px' width='34px'>"
				$('#tflag' + c).html(flagHTML);
				$('#tflag' + i).css({'cursor':'pointer'});
				$('#tflag' + c).on('click',selectTeam(teamArr[c]));	
				$('#tname' + c).text(countryArr[c]);
				$('#tname' + c).css({'cursor':'pointer'});
				$('#tname' + c).on(clickEventType,selectTeam(teamArr[c]));//touch or click
				$('#t' + c).on(clickEventType,selectTeam(teamArr[c],c));
				$('#t' + c).on('mouseover',function(){ $(this).css({'background-color':'rgba(255,255,255,0.65)'}); });
				$('#t' + c).on('mouseout',teamOut(c));
				$('.teamlist').css({'width':'100%','height':'42px','border-top':'solid 1px rgb(255,255,255)','border-bottom':'solid 1px rgb(150,150,150)','font-family':'pragmatica-web, sans-serif','font-size':'13px'});
				$('.team').css({'width':'100%'});
				$('.tflag').css({'width':'15%','text-align':'center'});
				$('.tname').css({'width':'85%','font-weight':700,'font-size':'15px'});
				if(team==teamArr[c]){
					$('#t'+c).css({'background-color':'rgba(255,255,255,0.65)'});
				}
			}
		}
	}); // END XML

	var selectTeam = function(t,number){ //to handle lexical scope
	return function (e) {
		team=t;
		setStorage('storedteam', team);//June 9
		for (var n=0; n<32; n++){
			if(n==number){
				$('#t'+number).css({'background-color':'rgba(255,255,255,0.65)'});
			}else{
				$('#t'+n).css({'background-color':'rgba(255,255,255,0)'});
			}
		}
		sym.getSymbol("teamsMc").$("returnQuizBtn").fadeIn(0);
		}
	};		
	var teamOut = function(number){ //to handle lexical scope
		return function (e) {
			if(team!=teamArr[number]){
				$('#t'+number).css({'background-color':'rgba(255,255,255,0)'});
			}
		}
	};	

	function closestNum (num, arr) {
	var curr = arr[0];
	var diff = Math.abs(num - curr);
	for (var i = 0; i < arr.length; i++) {
		if (num<=arr[i]){
			var newdiff = Math.abs (num - arr[i]);
			if (newdiff < diff) {
				diff = newdiff;
				curr = arr[i];
			}
		}
	}
	return curr;
	}
	var storedLevel=parseInt(getStorage('storedlevel'));//June 9
	var level =(storedLevel>1)?storedLevel:1; //Set level at 1
	sym.getSymbol("quizMc").$("stageWash"+level).css({'top':'40px'});//set background colour

	var allDone=[];//all questions completed - to ensure they don't get asked twice
	var doneArr=[];//questions completed in each round
	var qNos=[]; //array of questions that meet criteria
	var thisQuestion;
	function nextQuestion(){
	sym.$("nextBtn").fadeOut(0);
	sym.getSymbol("quizMc").$("bonusLock").fadeOut();
	for (var q=0;q<4; q++){
		sym.getSymbol("quizMc").getSymbol("btn"+q).$("txtA").empty();
	}
	qNos.length=0;
	$.ajax({	
		type: "GET",
		url: "quiz.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find("question").each(function(){
				var $question = $(this);
				var q = $question.attr("qno");
				var cat = $question.attr("category");
				var diff = $question.attr("difficulty");
				if(allDone.indexOf(q)<0){						
					if(level==1){
						if (cat==team||diff==level){
							qNos.push($question.attr("qno"));//push questions that meet criteria into array
						}
					}else if(level==5){
						if (diff==level-1||cat=="Final"){
							qNos.push($question.attr("qno"));
						}
					}else{
						if (diff==level&&cat!=team){ //R16=2, QF=3, SF=4
							qNos.push($question.attr("qno"));
						}
					}
					var randomNo=Math.floor(Math.random() *(qNos.length));
					qNo=qNos[randomNo];
					if (q==qNo){ //show data for new qNo
							ans = $question.find('correct').text();
							var ques = $question.find('q').text();	
							var opt1 = $question.find('qa').text();  
							var opt2 = $question.find('qb').text();  
							var opt3 = $question.find('qc').text();  
							var opt4 = $question.find('qd').text();
							sym.getSymbol("quizMc").$("qTxt").html(ques);
							sym.getSymbol("quizMc").getSymbol("btn0").$("txtA").html(opt1);
							sym.getSymbol("quizMc").getSymbol("btn1").$("txtA").html(opt2);
							sym.getSymbol("quizMc").getSymbol("btn2").$("txtA").html(opt3);
							sym.getSymbol("quizMc").getSymbol("btn3").$("txtA").html(opt4);	
							sym.getSymbol("quizMc").$("imageMain").attr("src", "quizpix/"+q+".jpg");	
							sym.getSymbol("quizMc").$("txt1").html(qNoShow + "/" + questions);
							thisQuestion=q;	
					}				
				}
			});//end each
		}
	});
	}	

	// MENU BUTTONS --------------------------------------------	
	menuArray = []; //the array that will hold references to the buttons.
	for (var h = 0; h < 4; h++){
		var menuBtnSymbols = sym.getSymbol("quizMc").getSymbol("btn" +h); // Create an instance element of a symbol as a child of the given parent element
		menuBtnSymbols.setVariable("menuId", h); //set the value of a Symbol variable
		menuArray.push(menuBtnSymbols); //push it into the array
	}
	$.each(menuArray, function( count, menuInTheArray ){ //a 'for each' loop through the newly populated array
		var menuBtnItem = $(menuInTheArray); //create jQuery reference to the item
		var menuBtnElement = menuInTheArray.getSymbolElement(); //create a jQuery reference to the DIV element inside the symbol
		menuBtnElement.on (clickEventType, {menuId:count}, menuBtnClick);
		menuBtnElement.on ("mouseover", {menuId:count}, menuShow);
		menuBtnElement.on ("mouseout", {menuId:count}, menuHide);
	})
	function resetmenu(){
		for (var h=0; h<menuArray.length; h++){
         menuArray[h].$("btnOver").fadeOut(0);
         menuArray[h].$("btnClick").fadeOut(0);
         menuArray[h].$("btnClickYes").fadeOut(0);
		}
	}
	resetmenu();
function menuBtnClick (e){
		var menuMenu_id = (e.data.menuId); //get the id of the clicked item
		yesNo = menuMenu_id;
		sym.getSymbol("quizMc").getSymbol("timerMc").stop();
		sym.getSymbol("quizMc").$("teamLock").fadeOut();//
		sym.checkAnswer();
}
	function menuShow (e){
		var menuMenu_id = (e.data.menuId); //get the id of the over button
		sym.getSymbol("quizMc").getSymbol("btn" + menuMenu_id).$("btnOver").fadeIn(0);
	}
	function menuHide (e){
		var menuMenu_id = (e.data.menuId); //get the id of the out button
		sym.getSymbol("quizMc").getSymbol("btn" + menuMenu_id).$("btnOver").fadeOut(0);
	}
// CHECK ANSWER RIGHT/WRONG
sym.checkAnswer = function(){
	sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnReplay").fadeOut(0);
	sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnArrowRight").fadeIn(0);
	sym.getSymbol("quizMc").$("nextBtn").fadeIn(200);
	sym.getSymbol("quizMc").$("qLock").fadeIn(200);
	sym.getSymbol("quizMc").getSymbol("timerMc").stop();
	doneArr.push(thisQuestion); //question done for	this round
	allDone.push(thisQuestion); //question done. do not ask again
		for (var i=0;i<answers.length; i++){
			if (ans==answers[i]){
				var a=i;
				if (yesNo ==a) {	
							sym.getSymbol("quizMc").getSymbol("btn" + yesNo).$("btnClickYes").fadeIn(0);
							correct++;
							bonus++;
							setStorage('storedbonus', bonus);//June 9
							sym.getSymbol("quizMc").getSymbol("winTal").$("ar").html(correct);
							sym.getSymbol("quizMc").getSymbol("winTal").play(1);
							bonusBalls();
							if (bonus <= 2){
								sym.getSymbol("quizMc").$("bonusLock").fadeOut();
							}else{
								sym.getSymbol("quizMc").$("bonusLock").fadeIn();
							}
				}else{
							sym.getSymbol("quizMc").getSymbol("btn" + i).$("btnClickYes").fadeIn(0);
							wrong++;
							sym.getSymbol("quizMc").getSymbol("losTal").$("aw").html(wrong);
							sym.getSymbol("quizMc").getSymbol("losTal").play(1);
				}
			}
		}
	if (doneArr.length == questions) {		//if set number of questions ahve been asked
		sym.getSymbol("quizMc").$("resultTxt").stop().animate ({opacity:1}, 300, 'easeOutBounce');
		if(correct>questions/2){ //If more than 50% correct - go through to the next round
			level++; //increment difficulty level
			//sym.$("cheer")[0].play();
			setStorage('storedlevel', level);//June 9
			sym.getSymbol("quizMc").$("resultTxt").html(txtArr[11]); // SHOW RESULT TEXT - WIN
			resetStage();
			resetScoreCheck = 1;
			if(level == levelsNo+1){ //If its the end of the last level, i.e. the Final
				sym.$("winnerMc").fadeIn(500);
				//sym.$("samba")[0].play();
				resetStage();
			}
		}else if(correct==questions/2){//if wrong==correct go to penalty shootout
			questions=questions+5;//five extra questions for the decider
			//sym.$("jeer")[0].play();
			sym.getSymbol("quizMc").$("resultTxt").html(txtArr[13]); // SHOW RESULT TEXT - PENALTIES
		}else{//If you lose? START AGAIN
			startAgain();
			//sym.$("boo")[0].play();
			sym.getSymbol("quizMc").$("resultTxt").html(txtArr[12]); // SHOW RESULT TEXT - LOST
			sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnArrowRight").fadeOut(0);

		}
	}	
}
function startAgain(){ // RESET STAGE
	sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnReplay").fadeIn(0);
	sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnArrowRight").fadeOut(0);
	for (var i=1;i<levelsNo+2;i++){
		sym.getSymbol("quizMc").$("stageWash"+i).css({'top':'-600px','opacity':1});
	}
	level = 1;
	setStorage('storedlevel', level);//June 9
	sym.getSymbol("quizMc").$("txt4").html(txtArr[4]); // CHANGE STAGE HEADER
	bonus = 0;
	setStorage('storedbonus', bonus);//June 9
	allDone.length=0;//empty array of questions completed
	resetStage();
	resetBalls();
	resetScore();
}

function resetStage(){ // RESET STAGE
	//qNoShow = 1;
	doneArr.length=0;//NEW
	qNos.length=0;
	qNo=0;
	qNoShow = 0;
	questions=10;//END
	sym.getSymbol("quizMc").$("stageWash"+(level-1)).stop().animate({opacity:0}, 2000);
	sym.getSymbol("quizMc").$("stageWash"+level).stop().animate ({top:40}, 2000);
}

function resetScore(){ // RESET SCORE
	correct = 0;
	wrong = 0;
	sym.getSymbol("quizMc").getSymbol("losTal").$("aw").html(0); //Reset score
	sym.getSymbol("quizMc").getSymbol("winTal").$("ar").html(0); //Reset score 
	sym.getSymbol("quizMc").$("txt4").html(txtArr[level + 3]); // CHANGE STAGE HEADER
	}
	resetScore();

// NEXT QUESTION
sym.getSymbol("quizMc").$("nextBtn").on(clickEventType, function(e){
	e.stopPropagation(); e.preventDefault();
	if (resetScoreCheck == 1){
		resetScore();
		resetScoreCheck = 0;
	}
	sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnReplay").fadeOut(0);
	sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnArrowRight").fadeIn(0);
	sym.getSymbol("quizMc").$("resultTxt").stop().animate ({opacity:0}, 0, 'easeOutBounce');
	yesNo = 99; // yesNo = menu_id so reset yesNo so answer isn't same as last menu_id
	qNoShow++;
	sym.getSymbol("quizMc").getSymbol("timerMc").play(1);
	sym.getSymbol("quizMc").$("teamLock").fadeIn();//
	sym.getSymbol("quizMc").$("qLock").fadeOut(0);
	sym.getSymbol("quizMc").$("nextBtn").fadeOut(0);
	if (max == 1) {
		sym.getSymbol("quizMc").$("nextBtn").fadeOut(0);
		max = 0;
	}
	if (doneArr.length == questions) {
		sym.getSymbol("quizMc").$("nextBtn").fadeIn(0);
		max = 1;
	}
	nextQuestion();
	resetmenu();
});

sym.getSymbol("quizMc").$("nextBtn").mouseover(function(){
	sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnOut").fadeOut(0);
});
sym.getSymbol("quizMc").$("nextBtn").mouseout(function(){
	sym.getSymbol("quizMc").getSymbol("nextBtn").$("btnOut").fadeIn(0);
});

// TEAMS COUNT
	sym.getSymbol("quizMc").$("teamBtn").on(clickEventType, function(e){
	e.stopPropagation(); e.preventDefault();
		sym.getSymbol("quizMc").getSymbol("timerMc").stop();
		sym.$("teamsMc").fadeIn(600);
	});
	sym.getSymbol("quizMc").$("teamBtn").mouseover(function(){
		sym.getSymbol("quizMc").getSymbol("teamBtn").$("btnOver").fadeOut(200);
	});
	sym.getSymbol("quizMc").$("teamBtn").mouseout(function(){
		sym.getSymbol("quizMc").getSymbol("teamBtn").$("btnOver").fadeIn(200);
	});

// BONUS COUNT
	sym.getSymbol("quizMc").$("bonusBtn").on(clickEventType, function(e){
	e.stopPropagation(); e.preventDefault();
	if (bonus >= 3){
		for (var i=0;i<answers.length; i++){
			if (ans==answers[i]){
				yesNo = i;
			}
		}
		sym.checkAnswer();
		for (var b=1;b<4; b++){
			sym.getSymbol("quizMc").getSymbol("bonusBtn").$("bonusBallRed"+b).fadeOut(0); // RESET BONUS BALLS AFTER CLICK
		}
		bonus = 0;
		setStorage('storedbonus', bonus);//June 9
	}else{
		if (bonusTxt == 0){
			bonusTxt = 1;
			sym.getSymbol("quizMc").$("txt10").stop().animate ({left:200}, 400, 'easeOutCubic');
			sym.getSymbol("quizMc").$("txt10").delay(4000).animate ({left:420}, 400, 'easeInCubic', function() {
    		bonusTxt = 0;
  			});
		}else{
			sym.getSymbol("quizMc").$("txt10").stop().animate ({left:420}, 400, 'easeInCubic');
			bonusTxt = 0;
		}
	}
	});
	sym.getSymbol("quizMc").$("bonusBtn").mouseover(function(){
	sym.getSymbol("quizMc").getSymbol("bonusBtn").$("btnOver").fadeOut(200);
	});
	sym.getSymbol("quizMc").$("bonusBtn").mouseout(function(){
	sym.getSymbol("quizMc").getSymbol("bonusBtn").$("btnOver").fadeIn(200);
	});

function bonusBalls(){
	if (bonus <= 3){
		sym.getSymbol("quizMc").getSymbol("bonusBtn").$("bonusBallRed"+bonus).fadeIn(200);
	}else{

	}
}
sym.getSymbol("quizMc").$("bonusLock").fadeOut();
sym.getSymbol("quizMc").$("teamLock").fadeOut();
function resetBalls(){  // RESET BALLS
for (var b=1;b<4; b++){
			sym.getSymbol("quizMc").getSymbol("bonusBtn").$("bonusBallRed"+b).fadeOut(0);
		}
	}
	resetBalls();

// RETURN TO QUIZ BUTTON
	sym.getSymbol("teamsMc").$("returnQuizBtn").on(clickEventType, function(e){
	e.stopPropagation(); e.preventDefault();
		sym.$("teamsMc").fadeOut(500);
		//sym.$("samba")[0].pause();
		sym.getSymbol("styleHead").$("flag").attr('src','flags/'+team+'.png');
		sym.getSymbol("styleHead").$("flag").fadeIn(600);
		qNoShow=(qNoShow==1)?0:qNoShow;
		sym.getSymbol("quizMc").$("nextBtn").trigger(clickEventType);
	});
	sym.getSymbol("teamsMc").$("returnQuizBtn").mouseover(function(){
		sym.getSymbol("teamsMc").getSymbol("returnQuizBtn").$("btnOver").fadeOut(200);
	});
	sym.getSymbol("teamsMc").$("returnQuizBtn").mouseout(function(){
		sym.getSymbol("teamsMc").getSymbol("returnQuizBtn").$("btnOver").fadeIn(200);
	});

// PLAY AGAIN BUTTON
	sym.getSymbol("winnerMc").$("againBtn").on(clickEventType, function(e){
	e.stopPropagation(); e.preventDefault();
		startAgain();
		sym.$("teamsMc").fadeIn(500);
		//sym.$("samba")[0].pause();
		sym.$("winnerMc").fadeOut(500);
		sym.getSymbol("quizMc").$("resultTxt").fadeOut(0);
		sym.getSymbol("quizMc").$("nextBtn").fadeOut(0);
	});
	sym.getSymbol("winnerMc").$("againBtn").mouseover(function(){
		sym.getSymbol("winnerMc").$("txt17").css("background-color","rgba(66,66,66,1)");
	});
	sym.getSymbol("winnerMc").$("againBtn").mouseout(function(){
		sym.getSymbol("winnerMc").$("txt17").css("background-color","rgba(0,0,0,1)");
	});
//SET STAGE AT BEGINNING	
if(bonus>0){
	for (var b=1;b<bonus+1; b++){//show saved bonus
				sym.getSymbol("quizMc").getSymbol("bonusBtn").$("bonusBallRed"+b).fadeIn(0);
	}
}
if (team!=""){
	sym.$("teamsMc").fadeOut(500);
	nextQuestion();
	sym.getSymbol("quizMc").getSymbol("timerMc").play(1);
	sym.getSymbol("styleHead").$("flag").attr('src','flags/'+team+'.png');
   //sym.$("samba")[0].play();
}else{
	sym.getSymbol("styleHead").$("flag").fadeOut(0);
	//sym.$("samba")[0].play();//June3
}
sym.getSymbol("quizMc").$("nextBtn").fadeOut(0);
sym.getSymbol("quizMc").$("qLock").fadeOut(0);

sym.getSymbol("teamsMc").$("returnQuizBtn").fadeOut(0);
sym.$("winnerMc").fadeOut(0);
$('img').on('dragstart',function(e){ e.preventDefault(); }); //make images undraggable

         	});//Edge binding end	
		
		// VIDEO BTN 1 =========================================================
         	
			
         	
         		
         	
			
			
         	// VIDEO BTN 2 =========================================================
         	
         	
         	
         		
         	
         	


   })("stage");
   //Edge symbol end:'stage'

   //=========================================================
   
   //Edge symbol: 'StyleBase'
   (function(symbolName) {   
   
   })("StyleBase");
   //Edge symbol end:'StyleBase'

   //=========================================================
   
   //Edge symbol: 'styleHead_1'
   (function(symbolName) {   
   
   })("styleHead");
   //Edge symbol end:'styleHead'

   //=========================================================
   
   //Edge symbol: 'Preloader'
   (function(symbolName) {   
   
   })("Preloader");
   //Edge symbol end:'Preloader'

   //=========================================================
   
   //Edge symbol: 'btn'
   (function(symbolName) {   
   
   })("btn");
   //Edge symbol end:'btn'

   //=========================================================
   
   //Edge symbol: 'teamsMc'
   (function(symbolName) {   
   
   })("teamsMc");
   //Edge symbol end:'teamsMc'

   //=========================================================
   
   //Edge symbol: 'timerMc'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 15000, function(sym, e) {
         sym.getComposition().getStage().checkAnswer();

      });
      //Edge binding end

   })("timerMc");
   //Edge symbol end:'timerMc'

   //=========================================================
   
   //Edge symbol: 'quizMc'
   (function(symbolName) {   
   
   })("quizMc");
   //Edge symbol end:'quizMc'

   //=========================================================
   
   //Edge symbol: 'teamBtn'
   (function(symbolName) {   
   
   })("teamBtn");
   //Edge symbol end:'teamBtn'

   //=========================================================
   
   //Edge symbol: 'teamBtn_1'
   (function(symbolName) {   
   
   })("bonusBtn");
   //Edge symbol end:'bonusBtn'

   //=========================================================
   
   //Edge symbol: 'btn_1'
   (function(symbolName) {   
   
   })("btn_1");
   //Edge symbol end:'btn_1'

   //=========================================================
   
   //Edge symbol: 'winTal'
   (function(symbolName) {   
   
   })("winTal");
   //Edge symbol end:'winTal'

   //=========================================================
   
   //Edge symbol: 'losTal'
   (function(symbolName) {   
   
   })("losTal");
   //Edge symbol end:'losTal'

   //=========================================================
   
   //Edge symbol: 'teamScroller'
   (function(symbolName) {   
   
   })("teamScroller");
   //Edge symbol end:'teamScroller'

   //=========================================================
   
   //Edge symbol: 'returnQuizBtn'
   (function(symbolName) {   
   
   })("returnQuizBtn");
   //Edge symbol end:'returnQuizBtn'

   //=========================================================
   
   //Edge symbol: 'winnerMc'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 30000, function(sym, e) {
         // Play the timeline at a label or specific time. For example:
         // sym.play(500); or sym.play("myLabel");
         sym.play(1);

      });
      //Edge binding end

   })("winnerMc");
   //Edge symbol end:'winnerMc'

   //=========================================================
   
   //Edge symbol: 'returnQuizBtn_1'
   (function(symbolName) {   
   
   })("playAgainBtn");
   //Edge symbol end:'playAgainBtn'

})(jQuery, AdobeEdge, "GraphicNews31860");