function number(x) {
if (x==1) return "eins"; if (x==2) return "zwei"; if (x==3) return "drei";
if (x==4) return "vier"; if (x==5) return "f&uuml;nf"; if (x==6) return "sechs";
if (x==7) return "sieben"; if (x==8) return "acht"; if (x==9) return "neun";
if (x==10) return "zehn"; if (x==11) return "elf"; if (x==12) return "zw&ouml;lf";
return x; //default
}

function ishtime(h,m) {
h = number(h)
if (m<=3 || m>57) return h+" Uhr";
if (m<=7)  return "f&uuml;nf nach "+h;
if (m<=12) return "zehn nach "+h;
if (m<=17) return "viertel nach "+h;
if (m<=23) return "zwanzig nach "+h;
if (m<=28) return "f&uuml;nf vor halb "+h;
if (m<=33) return "halb "+h;
if (m<=38) return "f&uuml;nf nach halb "+h;
if (m<=43) return "zwanzig vor "+h;
if (m<=48) return "viertel vor "+h;
if (m<=53) return "zehn vor "+h;
if (m<=58) return "f&uuml;nf vor "+h;
return "h:m"; // never reached?
}

function daytime(h) {
if (!h || h>21) return " nachts"
if (h<12) return " morgens";
if (h<=17) return " nachmittags";
return " abends"; // default
}

function ish(h,m) {
if (!h && !m) { // if no time supplied, use the system time
time = new Date()
h = time.getHours()
m = time.getMinutes()
}

z = daytime(h);
h = h % 12 // fix to 12 hour clock
if (m>57 && time.getSeconds()>30) m++; // round seconds
if (m>60) m=0 // round up minutes
if (m>23) h++ // round up hours
if (h>12)  h = 1 // the clock turns round..
if (h==0) h = 12
return "Es ist jetzt ca. "+ishtime(h,m)+z+"."
}

