var timerID= null;
var timerActivo= false;
var http_time;

function handleHttpResponse_time() 
{ 
    if (http_time.readyState == 4) 
    { 
        results = http_time.responseText; 
        document.getElementById('time').innerHTML = results;
    } 
}

function getHora(id,off,formul){
	
	var url = "../js/getTime";	
	var ext = ".php";
		
	sendQuerystring_time(url + ext);
}
 
function sendQuerystring_time(dir) { 
  http_time = getXmlHttpObject_time();
  http_time.open("GET", dir, true);
  http_time.onreadystatechange = handleHttpResponse_time;
  http_time.send(null);
} 

function getXmlHttpObject_time() {  
    //alert("getXmlHttpObject");
    var xmlhttp;
		
    /*@cc_on 
    @if (@_jscript_version >= 5) 
    try 
    { 
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    catch (e) 
    { 
    
    try{ 
    		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    catch (e){ 
    		xmlhttp = false; 
    } 
    } 
    @else 
    xmlhttp = false; 
    @end @*/

    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try{
            xmlhttp = new XMLHttpRequest();
        }
        catch (e){
            xmlhttp = false;
        } 
    }
    return xmlhttp; 
}

function PararReloj () {
	if (timerActivo) 
		clearTimeout (timerID);
}

function ActivarReloj () {
        PararReloj();
        Reloj();
}

function Reloj () {
	getHora();
	timerID= setTimeout("Reloj()",10000);
	timerActivo= true;
}