// Version: 1.6

/**
This replaces  getNextHighestDepth()
It's useful when you're using components  (which mess up that function)
It's also useful when you're coding for the PSP  (flash player 6 lacks that function)
*/

if( _global.nextDepth === undefined ){
	_global.nextDepth = function(this_mc, maxDepth, minDepth)
	{
		this_mc = (this_mc) ? this_mc : _root;		// default = _root
		var outputDepth = (minDepth!=undefined) ? minDepth : 1;
		var componentDepth = (maxDepth) ? maxDepth : 1048500;		// default:  1048500
		for (var nam in this_mc)
		{
			var thisDepth = this_mc[nam].getDepth();
			//trace("\t"+nam+"'s depth is: "+thisDepth);
			if (thisDepth < componentDepth  &&  thisDepth >= outputDepth)
			{
				outputDepth = thisDepth+1;
			}// if (   > outputDepth)
		}// for...in (this_mc)
		//trace("outputDepth: "+outputDepth);
		return outputDepth;
	}// nextDepth()
}// if:  _global.nextDepth doesn't already exist