var timeoutClock;
var fecha;

function reloj(label) {
    fecha.setSeconds(fecha.getSeconds()+1);

    horas = fecha.getHours();
    if (horas < 10) {
	    horas = '0'+horas;
    }

    minutos = fecha.getMinutes();
    if (minutos < 10) {
	    minutos = '0'+minutos;
    }

	segundos = fecha.getSeconds();
    if (segundos < 10) {
	    segundos = '0'+segundos;
    }

    try{
    MM_findObj(label, document).innerHTML = horas+":"+minutos;
    }catch(ex){
        label = "";
    }
    timeoutClock=setTimeout('reloj("' + label + '")',1000);
}

function SetSvrClock(intHoras, intMinutos, intSegundos) {
    var ClientDate = new Date();
    fecha = new Date(ClientDate.getYear(),ClientDate.getMonth(), ClientDate.getDate(), intHoras, intMinutos, intSegundos);
}

var cantPartidos = 3;
var fechas = new Array(cantPartidos);
var timeoutClock = new Array(cantPartidos);

function relojPartido(label, id) {
    var fechaPartido;
    
    fechaPartido = fechas[id];
    
    fechaPartido.setSeconds(fechaPartido.getSeconds()+1);

    horas = fechaPartido.getHours();
    if (horas < 10) {
	    horas = '0'+horas;
    }

    minutos = fechaPartido.getMinutes();
    if (minutos < 10) {
	    minutos = '0'+minutos;
    }

	segundos = fechaPartido.getSeconds();
    if (segundos < 10) {
	    segundos = '0'+segundos;
    }

    MM_findObj(label, document).innerHTML = horas+":"+minutos+":"+segundos;
    timeoutClock[id]=setTimeout('relojPartido(\'' + label + '\',' + id + ');',1000);
}

function SetSvrClockPartido(intHoras, intMinutos, intSegundos, id) {
    var ClientDate = new Date();
    fechas[id] = new Date(ClientDate.getYear(),ClientDate.getMonth(), ClientDate.getDate(), intHoras, intMinutos, intSegundos);
}