Thales Inscribed Angle Theorem Demonstrated Using JSXGraph

Thales inscribed angle theorem states the angle at PP' below is smaller than that at PP if PP is inside the circle, and larger if it is outside the circle. Furthermore, for a fixed segment ABAB inside the circle, the angle at PP' will always be the same regardless of where on the circle PP' is, as long as it is on the same side of AB.AB.

Try moving the points P,P, AA or BB around to see how it affects the angles!

Source Code

window.onload = function() {
    var M = 6;
    brd = JXG.JSXGraph.initBoard('box',{
        grid: false,

    o = brd.create('point', [0, 0], {name: 'O'});
    c = brd.create('circle', [o, 4], {name: 'C'});

    a = brd.create('glider', [3, 0, c], {name: 'A'});
    b = brd.create('glider', [-3, -3, c], {name: 'B', label:{offset:[-15,0]}});
    p = brd.create('point', [-1, 2], {name: 'P'});

    opts = {strokeColor: 'blue'};
    lab = brd.create('segment', [a, b], opts);

    opts = {strokeColor: 'blue'};
    lpb = brd.create('segment', [p, b], opts);
    lpa = brd.create('segment', [a, p], opts);

    op = brd.create('line', [o, p], {visible: false});

    pp = brd.create('intersection', [c, op, 0], {name: 'P\'', label:{offset:[0,15]}});
    opts = {strokeColor: 'green'};
    lppb = brd.create('segment', [pp, b], opts );
    lppa = brd.create('segment', [a, pp], opts);
    opts = {strokeColor: 'lightblue', strokeWidth: '1px'};
    lopp = brd.create('segment', [o, pp], opts);

    angp = brd.create('angle', [b, p, a]);
    angpp = brd.create('angle', [b, pp, a]);

    var setAngleLabels = function() {

    brd.on(function() { setAngleLabels(); }, 'move');