// Content.html custom JavaScript

g_FileIncludes = 0;

function includeScript( scriptPath )
{
	var elemHead = document.getElementsByTagName( "head" )[0];
	var include = document.createElement( "script" );
	include.type = "text/javascript";
	include.src = scriptPath + "?ver=3";
	elemHead.appendChild( include );
	g_FileIncludes++;
}

// files built to be included must call this method
function scriptIncluded( filename )
{
	g_FileIncludes--;
}

window.onload = onPageLoad;
function onPageLoad()
{
	// sometimes the script tags haven't finished loading by this point...
	waitForInclude();
}

function waitForInclude()
{
	if ( g_FileIncludes != 0 )
	{
		setTimeout( "waitForInclude()", 10 );
		return;
	}
	
	scriptMain();
}