var curtime = new Date; curtime.setTime(1738214315000); var lastloctime = new Date; lastloctime.setMilliseconds(0); var diff = curtime.getTime() - lastloctime.getTime(); var serversnow = new Date; function recalcserversnow() { serversnow.setTime((new Date).getTime() + diff); } recalcserversnow(); var nextstartdate = new Date; var nextenddate = new Date; nextstartdate.setTime(1738602000000); nextenddate.setTime(1738256400000); AuctionClosed = false; var curday = serversnow.getDate(); var curhour = serversnow.getHours() / 24; function calcauctionrunning(){ if (AuctionClosed) return 0; var curtime = serversnow.getTime(); if ((nextenddate > nextstartdate) && (curtime < nextstartdate)) return 0; if (curtime < nextenddate) return 1; return 0; } var auctionrunning = calcauctionrunning(); function resettimes(){ // In the meaning of setting them again - not // setting them to defaults :-) return; // we don't want this nextstartdate.setTime(curtime.getTime()); nextstartdate.setDate(startday); nextstartdate.setMinutes(0); nextstartdate.setSeconds(0); nextstartdate.setMilliseconds(0); nextstartdate.setHours(starthour); if (nextstartdate < curtime){ if (nextstartdate.getMonth() < 11){ nextstartdate.setMonth(nextstartdate.getMonth() + 1); } else { nextstartdate.setMonth(0); nextstartdate.setFullYear(nextstartdate.getFullYear() + 1); } }; nextenddate.setTime(curtime.getTime()); nextenddate.setDate(endday); nextenddate.setMinutes(0); nextenddate.setSeconds(0); nextenddate.setMilliseconds(0); nextenddate.setHours(endhour); if (nextenddate < curtime){ if (nextenddate.getMonth() < 11){ nextenddate.setMonth(nextenddate.getMonth() + 1); } else { nextenddate.setMonth(0); nextenddate.setFullYear(nextenddate.getFullYear() + 1); } }; }; function reloadframes(){ location.reload(); // no frames }; function recalctimes(){ recalcserversnow(); var curday = serversnow.getDate(); var curhour = serversnow.getHours() / 24; var prev = auctionrunning; auctionrunning = calcauctionrunning(); if (typeof prev == "boolean" && (prev != auctionrunning)){ // oh my god oh my god oh my god NU ÅBNER / LUKKER AUKTIONEN for (var i = 0; i < auctionEvents.length; i++) { if ((auctionEvents[i][0] == "onOpen" && auctionrunning) || (auctionEvents[i][1] == "onClose" && !auctionrunning)){ if (typeof auctionEvents[i][1] == "string") { eval(auctionEvents[i][1]); } else if (typeof auctionEvents[i][1] == "function") { auctionEvents[i][1](); } } } } } resettimes(); recalctimes(); if (typeof elementstoshowstatusin == "undefined"){ var elementstoshowstatusin = new Array(); } if (typeof auctionEvents == "undefined"){ var auctionEvents = new Array( new Array("onOpen", "reloadframes()"), new Array("onClose", "reloadframes()") ); } if (typeof minnumberlength == "undefined"){ var minnumberlength = function (i, n){ var s = i + ""; while (s.length < n){ s = "0" + s; } return s; } } function updateelements(){ if (AuctionClosed){ for (var i in elementstoshowstatusin){ eval(elementstoshowstatusin[i][0] + " = \"" + res + "\""); }; } else { //recalcserversnow(); recalctimes(); // This also recalcs server's Now. var stime = ""; var sshorttime = ""; ddiff = new Date; //recalcserversnow(); if (auctionrunning){ ddiff.setTime(nextenddate.getTime() - serversnow.getTime()); } else { ddiff.setTime(nextstartdate.getTime() - serversnow.getTime()); }; var nday = ddiff.getTime(); nday = nday - (nday % (1000 * 60 * 60 * 24)); nday = nday / (1000 * 60 * 60 * 24); ddiff.setTime(ddiff.getTime() + 1000 * 60 * 60 * 23); // Læg en // dag til for at gå udenom en bug, der lægger en time til i // getHours() når int repræsentationen af datoen ikke er over en // dag. Det giver ingen mening, men sådan er de fleste // third-party bugs jo. var day = nday; var hour = ddiff.getHours(); var minute = ddiff.getMinutes(); var second = ddiff.getSeconds(); if (day > 1){ stime += day + " dage, "; } else { hour += day * 24; day = -1; // Noter, at 'x dage, ' ikke er i strengen }; if (day == -1 && hour < 1){ minute += hour * 60; hour = -1; // Noter tilsvarende, at 'x timer' ikke er i strengen } else { stime += hour + " timer, "; }; if (hour == -1 && minute < 3){ second += minute * 60; minute = -1; } else { stime += minute + " minutter, "; }; if (minute == -1){ stime += "