//Ali Dehghani G. from Neka City, Iran.
//27 july 2010, 1:27 AM, Friday
//hitTestObject
//version 1.0.0
//plugin prototype: $(element).hitTestObject(target), this plugin works like its peer in ActionScript 3.0
//returns TRUE if two elements hits together and FALSE otherwise!
jQuery.fn.hitTestObject=function(target){
	var src=jQuery(this);
	var x1=src.offset().left,y1=src.offset().top,w=src.outerWidth(),h=src.outerHeight();
	var xp1=target.offset().left,yp1=target.offset().top,wp=target.outerWidth(),hp=target.outerHeight();
	var x2=x1+w,y2=y1+h,xp2=xp1+wp,yp2=yp1+hp;
	if(xp1>=x1 && xp1<=x2 )
	{
		if(yp1>=y1 && yp1<=y2)
		{
			return true;
		}
		else if(y1>=yp1 && y1<=yp2)
		{
			return true;
		}
	}
	else if(x1>=xp1 && x1<=xp2)
	{
		if(yp1>=y1 && yp1<=y2)
		{
			return true;
		}
		else if(y1>=yp1 && y1<=yp2)
		{
			return true;
		}
	}
	return false;
};//end of hit test
