// the clock code (start, stop, disp, parse) has been severely modified from
// Netscape's JavaScript documentation at www.netscape.com on Jan.25.96
var timerID = null;	var timerRunning = false;

function start() { stop();	parse();	disp(); }
function stop(){
        if(timerRunning){ clearTimeout(timerID); }
        timerRunning = false; }
function parse() {
	Todays = new Date();
	var Month = Todays.getMonth() +1;
	var Day = Todays.getDate();
	var Year = Todays.getYear() %100;
	Year  = Year  < 10 ? "0"+Year  : Year;
	Month = Month < 10 ? "0"+Month : Month;
	Day   = Day   < 10 ? "0"+Day   : Day;
	if( clock.indexOf("euro") != "-1"){
		Dated = "" + Day +"/"+ Month +"/" + Year; }
	else if( clock.indexOf("gran") != "-1"){
		Dated = "" + Year +"."+ Month +"." + Day; }
	else{	Dated = "" + Month +"/"+ Day +"/" + Year; }
}
function disp() {
        var now = new Date();
        var Hs = now.getHours();
        var Ms = now.getMinutes();
//      var Ss = now.getSeconds();
	var timeValue = Hs
	if( clock.indexOf("mil") != "-1"){ var hour = Hs; }
	else{
		var hour = (Hs > 12) ? Hs -12 :Hs;
		hour = (hour < 1) ? 12 :hour; }
		timeValue = "" + ((hour <= 9) ? " " : "" ) + hour;
        timeValue += ((Ms < 10) ? ":0" : ":") + Ms
	// could do a blinking : for seconds... but the | cursor works too if not blurred
//      timeValue += ((Ss < 10) ? ":0" : ":") + Ss

	if( clock.indexOf("mil") == "-1"){
		timeValue += (Hs >= 12) ? " PM" : " AM"; }

	document.forms[0][0].value = timeValue + " " + Dated;

        timerID = setTimeout("disp()",20000);
        timerRunning = true; }
function init() {
	clock = '';
	if( window.location.hash != "" ) {
	    loc = window.location.hash;
	    var strsrch = loc.indexOf("search=");
	    var endsrch = loc.indexOf("&", strsrch+7);
	    document.search.def_search.value = loc.substring(strsrch+7, endsrch);

	    strclk = loc.indexOf("clock=");
	    if(strclk != "-1"){
		      endclk =  loc.indexOf("&", strclk+6);
		      clock = loc.substring(strclk+6, endclk); }
	}
}
