// AKTUELLE SERVERZEIT HOLEN function synchronisation(resynch){ // Auktion aktiv -> Dann Auktion-Synchronisation (mit Prüfung auf Auktionsende) if (typeof doAuktion == "function"){ $("#zeit").load("http://www.la-hora.org/sys/synchro_auktion.php?id="+produktId+'&nocache=' + Date.parse(new Date()), function(ret){ // Auktion beendet ? -> Neu laden if(ret == "ende"){ stopAuktion(); } offset = getOffset(); aktualisieren(); synchronisation(); }); } // ...sonst nur Zeitsynchronisation else{ $("#zeit").load("http://www.la-hora.org/sys/synchro.php", function(ret){ offset = getOffset(); aktualisieren(); if(resynch==1){window.setTimeout('synchronisation(1)',300000);} }); } } // OFFSET ZUR CLIENTZEIT BERECHNEN function getOffset(){ var localDate = new Date(); var localTime = parseInt(localDate.getTime()); var remoteTime = parseInt($("#zeit").html()); return (remoteTime - localTime); } // UHRZEIT AKTUALISIEREN function aktualisieren (){ var Wochentag = new Array("domingo", "lunes", "martes", "miércoles","jueves", "viernes", "sábado"); var Monat = new Array("enero", "febrero", "marzo", "abril", "mayo", "junio","julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"); var d = new Date(); var t = parseInt(d.getTime())+offset; d.setTime(t); var hour = d.getHours(); hour = (hour<10) ? "0"+hour:hour; var mint = d.getMinutes(); mint = (mint<10) ? "0"+mint:mint; var sec = d.getSeconds(); sec = (sec<10) ? "0"+sec :sec; $("#anzeige").html(hour + ":" + mint + ":" + sec); var wtag = Wochentag[d.getDay()]; var tag = d.getDate(); var monat = Monat[d.getMonth()]; var jahr = d.getFullYear(); $("#anzeige_datum").html(wtag + ", " + tag + ". " + monat + " " + jahr); // Ggf. Aktualisierung des Dokumenttitels if(typeof(timeTitle)=='string'){document.title = hour + ":" + mint + ":" + sec + " " + timeTitle;} // ggf. Auktion aktualisieren if (typeof doAuktion == "function"){doAuktion(t);} // ggf. Countdown aktualisieren if(typeof countdown == "function"){countdown(t);} lauf = window.setTimeout('aktualisieren()',1000); }