
// CLOCK

var clockID = 0;
function UpdateClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
	var curDateTime = new Date()
	var curHour = curDateTime.getHours()
	var curMin = curDateTime.getMinutes()
	var curSec = curDateTime.getSeconds()
	var td = document.getElementById("clock"); 
	td.firstChild.nodeValue = ((curHour < 10) ? "0" : "") + curHour + ":" 
		+ ((curMin < 10) ? "0" : "") + curMin + ":" 
		+ ((curSec < 10) ? "0" : "") + curSec   
	clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
	clockID = setTimeout("UpdateClock()", 500);
}
function KillClock() {
	if(clockID) {
		clearTimeout(clockID);
		clockID  = 0;
	}
}

// POPUP

var newWin = null;
function popUp(strURL, strType, strWidth, strHeight) {
 if (newWin != null && !newWin.closed)
   newWin.close();
 var strOptions="";
 if (strType=="monkey")
   strOptions="height="+
     strHeight+",width="+strWidth;
 if (strType=="console")
   strOptions="resizable,height="+
     strHeight+",width="+strWidth;
 if (strType=="popup")
   strOptions="scrollbars,resizable,height="+
     strHeight+",width="+strWidth;
if (strType=="fixed")
   strOptions="status,height="+
     strHeight+",width="+strWidth;
 if (strType=="elastic")
   strOptions="scrollbars,"+
     "resizable,height="+
     strHeight+",width="+strWidth;
 if (strType=="targetBLANK")
   strOptions="toolbar,menubar,scrollbars,"+
     "resizable,height="+
     strHeight+",width="+strWidth;	 
 newWin = window.open(strURL, 'newWin', strOptions);
 newWin.focus();
}


// ANYTHING WHICH NEEDS STARTED

function init() {
	StartClock();
}

