/*
David Pabin utility functions

useful snippets to make my life easier
*/

//find the position of an element 
//hijacked from http://www.quirksmode.org/js/findpos.html
//uses recursion to find the offset of each element relative to its parent, resulting in an accurate
//position for the object passed in
function findPosition(obj) 
{
	var curleft = curtop = 0
	if(obj.offsetParent)
	{
		do
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent)
	}
	return [curleft,curtop];
}

//pause javascript's processing for a specified period of time
//hijacked from http://www.sean.co.uk/a/webdesign/javascriptdelay.shtm
function pauseScript(millis)
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); }
	while(curDate-date < millis);
} 
