
function contar(ayo,mes,dia,hora,minuto,segundo,id) {

/*
Autor 1: pepe
http:www.forosdelweb.com/f13/contador-cuenta-atras-356428/#post1357499

Autor 2: Chris Meichtry
http:www.mambosphere.com

Autor 3 (Modificador y recopilador): JoniJnm
htp://www.jonijnm.es
*/
  var dif = dia + ' del ' + mes + ' de ' + ayo + ', a las ' + hora + ':';
  if (minuto < 10) { dif+='0'; }
  dif+=minuto + '<br>';
  document.getElementById('evento' + id).innerHTML=dif
  var a = new Date();
  //hora, minuto,segundo, mes,dia a?o.
  var dif= mktime(hora,minuto,segundo,mes - 1,dia,ayo) - mktime(a.getHours(),a.getMinutes(),a.getSeconds(),a.getMonth(),a.getDate(), a.getFullYear());
  if (dif < 0) { document.getElementById('contar' + id).innerHTML="<font color='#FF0000'>Lleg&oacute; el d&iacute;a!!</font>"; }
  else {
    dia= Math.floor(dif/60/60/24);  
    hora= Math.floor((dif - dia*60*60*24)/60/60);
    minuto= Math.floor((dif - dia*60*60*24 - hora*60*60)/60);
    segundo= Math.floor(dif - dia*60*60*24 - hora*60*60 - minuto*60);
    var txt = '';
    if (dia > 0) {
        txt=dia+' d&iacute;a';
        if (dia != 1) { txt+='s'; }
        //txt+= '<br>';
		txt+= ' ';
    }
    if (hora > 0 || dia > 0) {
        txt+=hora+' hora';
        if (hora != 1) { txt+='s'; }
        //txt+= '<br>';
		txt+= ' ';
    }
    if (minuto > 0 || hora > 0 || dia > 0) {
        txt+=minuto+' minuto';
        if (minuto != 1) { txt+='s'; }
        //txt+= '<br>';
		txt+= ' ';
    }
    txt+=segundo+' segundo';
    if (segundo != 1) { txt+='s'; }
    document.getElementById('contar' + id).innerHTML=txt;
    }

function mktime() {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: baris ozdil
    // +      input by: gabriel paderni 
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: FGFEmperor
    // +      input by: Yannoo
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: mktime( 14, 10, 2, 2, 1, 2008 );
    // *     returns 1: 1201871402
    
    var no, ma = 0, mb = 0, i = 0, d = new Date(), argv = arguments, argc = argv.length;
    d.setHours(0,0,0); d.setDate(1); d.setMonth(1); d.setYear(1972);
 
    var dateManip = {
        0: function(tt){ return d.setHours(tt); },
        1: function(tt){ return d.setMinutes(tt); },
        2: function(tt){ set = d.setSeconds(tt); mb = d.getDate() - 1; return set; },
        3: function(tt){ set = d.setMonth(parseInt(tt)-1); ma = d.getFullYear() - 1972; return set; },
        4: function(tt){ return d.setDate(tt+mb); },
        5: function(tt){ return d.setYear(tt+ma); }
    };
    
    for( i = 0; i < argc; i++ ){
        no = parseInt(argv[i]*1);
        if(no && isNaN(no)){
            return false;
        } else if(no){
            // arg is number, let's manipulate date object
            if(!dateManip[i](no)){
                // failed
                return false;
            }
        }
    }
 
    return Math.floor(d.getTime()/1000);
}

}