<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script>
var Events = {};
Events.text = [
['starts in ', '<font color="green">open, to start </font>'],
['will appear in ', '<font color="red">hurry up, left </font>']
];
Events.sked = [
['Blood Castle - ', 0, '00:00', '04:00', '08:00', '12:00', '16:00', '20:00'],
['Devil Square - ', 0, '02:30', '06:30', '10:30', '14:30', '18:30', '22:30'],
['Chaos Castle - ', 0, '01:00', '05:00', '09:00', '13:00', '17:00', '21:00'],
['White Wizard - ', 0, '03:30', '06:30', '09:30', '12:30', '15:30', '18:30', '21:30'],
['Golden Invasion - ', 0, '00:00', '06:00', '12:00', '18:00'],
['Loren Deep - ', 0, '18:00'],
['HAPPY HOUR - ', 0, '21:00'],
];
Events.init = function(e)
{
if (typeof e == "string") var g = new Date(new Date().toString().replace(/\d+:\d+:\d+/g, e));
var f = (typeof e == "number" ? e : (g.getHours() * 60 + g.getMinutes()) * 60 + g.getSeconds()),
q = Events.sked,
j = [];
for (var a = 0; a < q.length; a++)
{
var n = q[a];
for (var k = 2; k < q[a].length; k++)
{
var b = 0,
p = q[a][k].split(":"),
o = (p[0] * 60 + p[1] * 1) * 60,
c = q[a][2].split(":");
if (q[a].length - 1 == k && (o - f) < 0) b = 1;
var r = b ? (1440 * 60 - f) + ((c[0] * 60 + c[1] * 1) * 60) : o - f;
if (f <= o || b)
{
var l = Math.floor((r / 60) / 60),
l = l < 10 ? "0" + l : l,
d = Math.floor((r / 60) % 60),
d = d < 10 ? "0" + d : d,
u = r % 60,
u = u < 10 ? "0" + u : u;
j.push('<div class="event">' + '<b class="time" style="color: #FFBF00;">' + n[0] + q[a][b ? 2 : k] + '</b><div class="small"><span>' + (Events.text[q[a][1]][+(l == 0 && d < (q[a][1] ? 1 : 5))]) + "</span>" + (l + ":" + d + ":" + u) + "</div></div>");
break;
};
};
};
document.getElementById("events").innerHTML = j.join("");
setTimeout(function()
{
Events.init(f == 86400 ? 1 : ++f);
}, 1000);
};
jQuery(document).ready(function($)
{
var d = new Date();
hh = d.getUTCHours() + 3, mm = d.getMinutes(), ss = d.getSeconds();
if (hh >= 24)
{
hh = hh - 24;
}
if (hh <= 9)
{
hh = "0" + hh;
}
if (mm <= 9)
{
mm = "0" + mm;
}
if (ss <= 9)
{
ss = "0" + ss;
}
Events.init(hh + ":" + mm + ":" + ss);
});
</script>
<div class="xysad" id="events"></div>