<html>
<script src='http://code.jquery.com/jquery-latest.min.js'></script>
<script>
function angleOf(x,y) { // Calculate angle of vector
var a = [0,0,-2,-1,0,2,-3,4,2][(x < 0 ? 2 : x ? 1 : 0) + (y < 0 ? 6 : y ? 3 : 0)];
return a < 0 ? -a * Math.PI / 2 : a * Math.PI / 2 + (x ? Math.atan(y / x) : Math.PI / 2);
}
function calculationeur(e) {
document.getElementById("angle").innerHTML = Math.angleOf(e.clientY, e.clientX)
}
function maineur() {
$("#paper").mousemove(function(event) {
var x = event.pageX, y = event.pageY;
var cx = 64, cy = 64;
var msg = "Angle of (" + x + "," + y + ") about (" + cx + "," + cy + ") is " + ((36000 - Math.floor(angleOf(x - cx, y - cy) / Math.PI * 18000.0)) / 100);
$("#angle").text(msg);
});
}
</script>
<body onload='maineur()'>
<img id=paper style=background-color:cyan height=128px width=128px></img>
<span id=angle>???</span>°
</body>