/**
 * Rect Class - Tools for rectangles
 *
 * @author 	Eric Jeker <eric.jeker@virtua.ch>
 * @version	0.1
 * @licence DWYW : Do Whatever You Want
**/

var Rect = {
	x : 0,
	y : 0,
	h : 0,
	w : 0,
	style : null,
	
	// Define rectangle informations
	setRect : function(r)	{
		Point.setFromElement(r) ;
		
		Rect.x = Point.x ;
		Rect.y = Point.y ;
		
		Rect.h = r.offsetHeight ;
		Rect.w = r.offsetWidth ;
		Rect.style = r.style ;
	},
	
	// Check if the coordinates are inside the rectangle
	checkHit : function (r, x, y)	{
		Rect.setRect(r) ;
		if (y <= Rect.h + Rect.y && y >= Rect.y
				&& x <= Rect.w + Rect.x && x >= Rect.x)	{
		
			return true ;
		}
		
		return false ;
	}
}