A Demo: http://jsfiddle.net/m1erickson/AN4Jf/
You can listen for mousedown events and call handleMouseDown() when the event occurs:
canvas.onmousedown=handleMouseDown;
The mousedown handler gets the mouse position like this:
var canvas=document.getElementById("canvas");
var offsetX=canvas.offsetLeft;
var offsetY=canvas.offsetTop;
function handleMouseDown(e){
e.preventDefault();
mouseX=parseInt(e.clientX-offsetX);
mouseY=parseInt(e.clientY-offsetY);
}
Assume your Seat "class" looks something like this:
// Seat "class"
function Seat(x,y,radius,id,seatNo,color){
this.x=x-200; // -200 pulls the seats leftward for better display
this.y=y;
this.radius=radius;
this.id=id;
this.seatNo=seatNo;
this.color=color
}
Then you can test if the mousedown occurred in any Seat object like this:
Seat.prototype.isMouseInside=function(mouseX,mouseY){
var dx=mouseX-this.x;
var dy=mouseY-this.y;
return(dx*dx+dy*dy<=this.radius*this.radius);
}