var cx=123;
var cy=121;
var minutlen=99;
var hourlen=62;
var clockid="clock";
var pathid="path3245";
var pathelem;
var trycnt=10;

function drawtime() {
    var now=new Date()
    var nowm=now.getMinutes()*1.0+1.0*now.getSeconds()/60;
    var nowh=now.getHours()*1.0+1.0*nowm/60;
    var mposx=cx + minutlen * Math.sin( nowm / 30 * Math.PI );
    var mposy=cy - minutlen * Math.cos( nowm / 30 * Math.PI );
    var hposx=cx +  hourlen * Math.sin( nowh / 6 * Math.PI );
    var hposy=cy -  hourlen * Math.cos( nowh / 6 * Math.PI );
    pathelem.setAttribute("d","M " + mposx + "," + mposy + " L " +
			  cx + "," + cy + " L " + hposx + "," + hposy );
    window.setTimeout("drawtime()",5000)
};
function checksvg() { // waiting for embed document
    svgba = document.getElementById(clockid).contentDocument;
    if (svgba == null) {
        if (trycnt-- > 0) { 
            setTimeout("checksvg()", 100);
        } else {
            window.alert("SVG Drawing: '"+clockid+"' not found");
        };
    } else {
	pathelem=svgba.getElementById(pathid);
	pathelem.setAttribute("style","fill:none;stroke:rgb(105,105,105);stroke-width:7.5px")
        drawtime();
    };
}
window.onload=function() {window.setTimeout("checksvg()",200);};

