// JavaScript Document
var timerID = 0;
var tStart  = null;
var timerID2 = 0;
var tStart2  = null;
var timerID3 = 0;
var tStart3  = null;

function UpdateTimer(msVal) {
   if(timerID) {
      clearTimeout(timerID);
   }

   if(!tStart)
      tStart   = new Date();

   var   tDate = new Date();
   var   tDiff = tDate.getTime() - tStart.getTime();

   tDate.setTime(tDiff);
   if(document.getElementById('layerTexto').style.visibility=='visible'){
   		document.getElementById('layerTexto').style.visibility='hidden';
   }
   else{
   	document.getElementById('layerTexto').style.visibility='visible';
   }
   timerID = setTimeout("UpdateTimer('" + msVal + "')", msVal);
}
function UpdateTimer2(msVal) {
   if(timerID2) {
      clearTimeout(timerID2);
   }

   if(!tStart2)
      tStart2   = new Date();

   var   tDate2 = new Date();
   var   tDiff2 = tDate2.getTime() - tStart2.getTime();

   tDate2.setTime(tDiff2);
   if(document.getElementById('layerRegisto')){
   if(document.getElementById('layerRegisto').style.visibility=='visible'){
		document.getElementById('layerRegisto').style.visibility='hidden';
   }
   else{
   	document.getElementById('layerRegisto').style.visibility='visible';
   }
   timerID2 = setTimeout("UpdateTimer2('" + msVal + "')", msVal);
   }
}
function UpdateTimer3(msVal) {
   if(timerID3) {
      clearTimeout(timerID3);
   }

   if(!tStart3)
      tStart3   = new Date();

   var   tDate3 = new Date();
   var   tDiff3 = tDate3.getTime() - tStart3.getTime();

   tDate3.setTime(tDiff3);
   if(document.getElementById('layerNacional')){
   if(document.getElementById('layerNacional').style.visibility=='visible'){
		document.getElementById('layerNacional').style.visibility='hidden';
   }
   else{
   	document.getElementById('layerNacional').style.visibility='visible';
   }
   timerID3 = setTimeout("UpdateTimer3('" + msVal + "')", msVal);
   }
}

function StartTimer(msVal) {
   tStart   = new Date();
   delay = msVal;
   timerID  = setTimeout("UpdateTimer('" + msVal + "')", msVal);
}
function StartTimer2(msVal) {
   tStart2   = new Date();
   delay2 = msVal;
   timerID2  = setTimeout("UpdateTimer2('" + msVal + "')", msVal);
}
function StartTimer3(msVal) {
   tStart3   = new Date();
   delay3 = msVal;
   timerID3  = setTimeout("UpdateTimer3('" + msVal + "')", msVal);
}


function StopTimer() {
   if(timerID) {
      clearTimeout(timerID);
      timerID  = 0;
   }
   tStart = null;
}
function StopTimer2() {
   if(timerID2) {
      clearTimeout(timerID2);
      timerID2  = 0;
   }
   tStart2 = null;
}
function StopTimer3() {
   if(timerID3) {
      clearTimeout(timerID3);
      timerID3  = 0;
   }
   tStart3 = null;
}
function ResetTimer() {
   tStart = null;
   tStart2 = null;
   tStart3 = null;
}

