I trying to build up to a more complicated problem, but to warm up, I wanted to undertake a simpler project. Having a user use clicks of a mouse to draw a shape.

I'm pretty good with Javascript and have a solid programming background, so all I need is the logic and key functions I need to do this.

To repeat, I want the user to click their mouse and have a line drawn from point to point until any of the lines cross and then I want the area in the shape to be selected/colored etc.

I just need a push in the right direction, so articles links, ideas are welcome.
Thanks in advance.