/** @author Jonathan Toland */
window.clocFx = function(source)
{
	var stripBlankLines = function(source)
	{
		return source.replace(/^\s*$\s/gm, '').replace(/\s*$/, '');
	};
	var stripASComments = function(source)
	{
		return source.replace(/\/\/.*/g, '').replace(/\/\*[\s\S]*?\*\//g);
	};
	var stripMXMLComments = function(source)
	{
		return source.replace(/<!--[\s\S]*-->/g, '')
		.replace(/<((?:\w+:)?)Script\s*>\s*<!\[CDATA\[[\s\S]*?\]\]>\s*<\/\1Script\s*>/g, stripASComments);
	};
	var stripComments = function(source)
	{
		if (/^\s*</.test(source))
		{
			return stripMXMLComments(source);
		}
		else
		{
			return stripASComments(source);
		}
	};
	var result = { total: source.split('\n').length };
	var strippedSource = stripBlankLines(source);
	result.blank = result.total - strippedSource.split('\n').length;
	strippedSource = stripBlankLines(stripComments(strippedSource))
	result.code = strippedSource.split('\n').length;
	result.commented = result.total - result.blank - result.code;
	result.stripped = strippedSource;
	return result;
};