	// Round the number to a given factor.  Example: round 13 to a factor of 5 would round it to 15.
	function roundTo(num, factor) 
	{
		tempNum = Math.round(num / factor) * factor; 
		if (tempNum > num)
		{
			tempNum -= factor;
		}
			
		return tempNum; 
	}

	// Get the position of an object being displayed.
	function getPos(obj)
	{
		var curTop = 0;
		var curLeft = 0;
		if(obj.offsetParent)
		{
			while(obj.offsetParent)
			{
				curTop += obj.offsetTop;
				curLeft += obj.offsetLeft;
				obj = obj.offsetParent;
			}
		}
		else if(obj.y || obj.x)
		{
			if(obj.y)
			{
				curTop += obj.y;
			}
			if(obj.x)
			{
				curLeft += obj.x;
			}
		}
		return {x:curLeft, y:curTop};
	}
	
	// existing function to find window dimensions and scroll amount:
	function dfxWinXY(w)  
	{
	    var b, d, x, y, sx, sy, v;
	    x = y = sx = sy = 0;
	    if(w.innerWidth && w.innerHeight)
	    {  
			x = w.innerWidth;
	       	v = w.document.body.offsetWidth;
	       	if(v && (1 < v) && !(x < v))
	       	{
	          x = v - 1;
	        }
	       	y = w.innerHeight;
	       	sx = w.pageXOffset || 0;
	       	sy = w.pageYOffset || 0;
	    }
	    else
	    {  
	    	d = w.document;
	       	if(d.body)
	       	{  
	       	  b = d.documentElement.clientWidth ? d.documentElement : d.body;
	          x = b.clientWidth || 0;
	          y = b.clientHeight || 0;
	          sx = b.scrollLeft || 0;
	          sy = b.scrollTop || 0;
	       }
	    }
	
	    return {x:x, y:y, sx:sx, sy:sy};
	}
	
	// Get a movie object by name.
	function getMovieName(movieName) 
	{
		if (navigator.appName.indexOf("Microsoft") != -1) 
		{
			return window[movieName]
		}
		else 
		{
			return document[movieName]
		}
	}
	
	// Trim off leading and trailing whitespace.
	function trim(stringToTrim) 
	{
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}


