// JavaScript Document
function init(){
document.getElementById('t1').setAttribute('autocomplete','off');
document.getElementById('t2').setAttribute('autocomplete','off');
document.getElementById('t3').setAttribute('autocomplete','off');
document.getElementById('t4').setAttribute('autocomplete','off');
}
function validar(){
	var txt1 = document.getElementById('t1').value;
	var txt2 = document.getElementById('t2').value;
	var txt3 = document.getElementById('t3').value;
	var txt4 = document.getElementById('t4').value;		
}
var index = 0;

function ver0(){
	
		var cadena = " 12:00 ";
		var palabra = document.getElementById('t1').value; 
		palabra = palabra.replace(/\s+/g, '');
		document.getElementById('t1').value = palabra;
		if(cadena.indexOf(palabra) != -1){
			if(palabra == "12:00"){				
				document.getElementById('t1').style.color = "green";
				document.getElementById('d0').className = "bien"
				index ++;
				}
			}else{
				document.getElementById('t1').style.color = "red"
				document.getElementById('d0').className = "mal"
				index --;
				}
				if(palabra == ""){
				document.getElementById('d0').className = "mal"
				}
		}
function ver90(){
	
		var cadena = " 3:00 9:00 ";
		var palabra = document.getElementById('t2').value; 
		palabra = palabra.replace(/\s+/g, '');
		document.getElementById('t2').value = palabra;
		if(cadena.indexOf(palabra) != -1){
			if(palabra == "3:00" || palabra == "9:00"){				
				document.getElementById('t2').style.color = "green";
				document.getElementById('d90').className = "bien"
				index ++;
				}
			}else{
				document.getElementById('t2').style.color = "red"
				document.getElementById('d90').className = "mal"
				index --;
				}
			if(palabra == ""){
				document.getElementById('d90').className = "mal"
				}
		}
function ver180(){
	
		var cadena = " 6:00 ";
		var palabra = document.getElementById('t3').value; 
		palabra = palabra.replace(/\s+/g, '');
		document.getElementById('t3').value = palabra;
		if(cadena.indexOf(palabra) != -1){
			if(palabra == "6:00"){				
				document.getElementById('t3').style.color = "green";
				document.getElementById('d180').className = "bien"
				index ++;
				}
			}else{
				document.getElementById('t3').style.color = "red"
				document.getElementById('d180').className = "mal"
				index --;
				}
			if(palabra == ""){
				document.getElementById('d180').className = "mal"
				}
		}
function ver360(){
	
		var cadena = " 12:00 ";
		var palabra = document.getElementById('t4').value; 
		palabra = palabra.replace(/\s+/g, '');
		document.getElementById('t4').value = palabra;
		if(cadena.indexOf(palabra) != -1){
			if(palabra == "12:00"){				
				document.getElementById('t4').style.color = "green";
				document.getElementById('d360').className = "bien"
				index ++;
				}
			}else{
				document.getElementById('t4').style.color = "red"
				document.getElementById('d360').className = "mal"
				index --;
				}
			if(palabra == ""){
				document.getElementById('d360').className = "mal"
				}
		}
function sound(){ if(index >= 4){ sg.sound('success');}else{sg.sound('error');}}
/*var t = document.getElementById("t2");
t.addEventListener('keyup', verificar);

function verificar(){
  var timer = null;  
  clearTimeout(timer);
  timer = setTimeout(verR90, 1000);
}

function verR90(){
  var cadena = "3:00 9:00";
  var palabra = document.getElementById("t2").value ;
  if (cadena.indexOf(palabra) != -1){
    if(palabra == "9:00" || palabra == "3:00"){
      document.getElementById("t2").style.color = "green";
	  sg.sound('success-low'); 
	  document.getElementById("t2").e = "true";
    } 
	else{
		document.getElementById("t2").style.color = "red";
		}
  }
    else{
      document.getElementById("t2").style.color ="red";
	  sg.sound('error');
    }
}

var tb = document.getElementById("t1");
tb.addEventListener('keyup', verificarb);

function verificarb(){
  var timer = null;  
  clearTimeout(timer);
  timer = setTimeout(verR0, 1000);
}
function verR0(){
  var cadena = "12:00";
  var palabra = document.getElementById("t1").value ;
  if (cadena.indexOf(palabra) != -1){
    if(palabra == "12:00"){
      document.getElementById("t1").style.color = "green";
	  sg.sound('success-low');
	  document.getElementById("t1").disabled = "true";
    } 
	else{
		document.getElementById("t1").style.color = "red";
		}
  }
    else{
      document.getElementById("t1").style.color ="red";
	  sg.sound('error');
    }
}

var tc = document.getElementById("t3");
tc.addEventListener('keyup', verificarc);

function verificarc(){
  var timer = null;  
  clearTimeout(timer);
  timer = setTimeout(verR180, 1000);
}
function verR180(){
  var cadena = "6:00";
  var palabra = document.getElementById("t3").value ;
  if (cadena.indexOf(palabra) != -1){
    if(palabra == "6:00"){
      document.getElementById("t3").style.color = "green";
	  sg.sound('success-low');
	  document.getElementById("t3").disabled = "true";
    } 
	else{
		document.getElementById("t3").style.color = "red";
		}
  }
    else{
      document.getElementById("t3").style.color ="red";
	  sg.sound('error');
    }
}

var td = document.getElementById("t4");
td.addEventListener('keyup', verificard);

function verificard(){
  var timer = null;  
  clearTimeout(timer);
  timer = setTimeout(verR360, 1000);
}
function verR360(){
  var cadena = "12:00";
  var palabra = document.getElementById("t4").value ;
  if (cadena.indexOf(palabra) != -1){
    if(palabra == "12:00"){
      document.getElementById("t4").style.color = "green";
	  sg.sound('success-low');
	  document.getElementById("t4").disabled = "true";
    } 
	else{
		document.getElementById("t4").style.color = "red";
		}
  }
    else{
      document.getElementById("t4").style.color ="red";
	  sg.sound('error');
    }
}


}*/





 /*function verificarRespuesta0(){
	 var cadena="12:00"
	 var palabra=document.getElementById('An0').value;
	 if(cadena.indexOf(palabra)!=-1 || palabra == cadena){
		 sg.sound('success-low');
		 document.getElementById('An0').style.color = "green";
		 if( palabra == '12:00'){
			 sg.sound('success-low');}
		 }	
		else{
			sg.sound('error');
			document.getElementById('An0').style.color = "red"; 
			 }
 		}
 function verificarRespuesta90(){
	 var cadena='3:00 9:00'
	 var palabra=document.getElementById('An90').value;
	 if(cadena.indexOf(palabra)!=-1 ){				 
		 if( palabra == '9:00' || palabra == '3:00'){
			 sg.sound('success-low');}
			 document.getElementById('An90').style.color = "green";
		 }		 
		 else{
			sg.sound('error');
			document.getElementById('An90').style.color = "red"; 
			 }
 		}*/
/*function verificarRespuesta180(i,id){
  var resAnR = ['6:00'];
  var resUsu = document.getElementById(id).value;
  var found = false;
   for(i = 0; i < resAnR.length && !found; i++){ 
      var x = i;
      var res = resAnR[x];
      if (resUsu != res){
        document.getElementById(id).style.color = "red";   
		 sg.sound('error');
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
	  if (resUsu != res){
        document.getElementById(id).style.color = "red";
		sg.sound('error');    
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
    }
  }*/

	

  /*var resAnR = ['12:00'];
  var resUsu = document.getElementById(id).value;
  var found = false;
   for(i = 0; i < resAnR.length && !found; i++){ 
      var x = i;
      var res = resAnR[x];
      if (resUsu != res){
        document.getElementById(id).style.color = "red";  
		sg.sound('error');  
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
	  if (resUsu != res){
        document.getElementById(id).style.color = "red";  
		sg.sound('error');  
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
    }*/
  
/* function verificarRespuesta45(i,id){
  var resAnR = ['12:08', '1:10', '2:14', '3:15', '4:19', '5:20', '6:23', '7:25', '8:28', '9:38', '10:48', '11:58'];
  var resUsu = document.getElementById(id).value;
  var found = false;
   for(i = 0; i < resAnR.length && !found; i++){ 
      var x = i;
      var res = resAnR[x];
      if (resUsu != res){
        document.getElementById(id).style.color = "red"; 
		sg.sound('error'); 
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
	  if (resUsu != res){
        document.getElementById(id).style.color = "red";
		sg.sound('error');   
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
    }
  }
    function verificarRespuesta90(i,id){
  var resAnR = ['3:00', '9:00'];
  var resUsu = document.getElementById(id).value;
  var found = false;
   for(i = 0; i < resAnR.length && !found; i++){ 
      var x = i;
      var res = resAnR[x];
      if (resUsu != res){
        document.getElementById(id).style.color = "red";   
		sg.sound('error'); 
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
	  
    }
  }
  function verificarRespuesta360(i,id){
  var resAnR = ['12:00'];
  var resUsu = document.getElementById(id).value;
  var found = false;
   for(i = 0; i < resAnR.length && !found; i++){ 
      var x = i;
      var res = resAnR[x];
      if (resUsu != res){
        document.getElementById(id).style.color = "red";   
		sg.sound('error'); 
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
	  if (resUsu != res){
        document.getElementById(id).style.color = "red"; 
		sg.sound('error');   
      }
      else{
        found = true;
        document.getElementById(id).style.color = "green";
		sg.sound('success-low');
      }
    }
  }*/