var minimize = true;

function onhideshow() {
 var wol = window.onload;

 window.onload = function() {
 hideshow();
 if(wol)
 wol();
 };
}

function hideshow()
{
 var table = document.getElementById("hideme");
 var image = document.getElementById("minmax");
 if(minimize)
 {
 table.style.display = "none";
 image.src = "img/site/expand.jpg";
 minimize = false;
 }else{
 table.style.display = "";
 image.src = "img/site/minimize.jpg";
 minimize = true;
 }
}

window.onload = function() {
 updateTime();
 setInterval(updateTime,500);
}

function fixTime(num) {
 if(num < 10)
 return "0"+num;
 return num;
}

function fixHour(num) {
 if(num === 0)
 return 12;
 if(num > 12)
 return num-12;
 return num;
}

function amPM(h) {
 if(h < 12)
 return "AM";
 return "PM";
}

function updateTime() {
 var today=new Date();
 var h=today.getHours();
 var m=today.getMinutes();
 var s=today.getSeconds();

 var e = document.getElementById('time');
 if(e) {
 e.innerHTML = fixHour(h)+":"+fixTime(m)+/*":"+fixTime(s)+*/" "+amPM(h);
 }
}
