void InitDocument(bool forceLoad)
	{
		// may be serliazing an already initialized object, ensure we handle reference
		// counting correctly.
		if (m_pCompilingNotification)
		{
			m_pCompilingNotification->RemoveReference();
			m_pCompilingNotification = 0;
		}

		// Load the compiling notification rml
		IGUISystem* pGUI = PerModuleInterface::g_pSystemTable->pGUISystem;

		if (forceLoad)
		{
			// Clear style sheet cache so any changes to RCSS files will be applied
			pGUI->ClearStyleSheetCache();
		}

		IGUIDocument* pDocument = forceLoad ? NULL : pGUI->GetDocument("CompilingNotification");
		if (pDocument == NULL)
		{
			pDocument = pGUI->LoadDocument("/GUI/compiling-notification.rml", "CompilingNotification");
		}

		if (pDocument != NULL)
		{
			pDocument->Show();
			m_pCompilingNotification = pDocument->Element()->GetElementById("compiling");
			
			pDocument->RemoveReference();
		}
	}
	void InitDocument(bool forceLoad)
	{
		// may be serliazing an already initialized object, ensure we handle reference
		// counting correctly.
		if (m_pCounterElement)
		{
			m_pCounterElement->RemoveReference();
			m_pCounterElement = 0;
		}

		// Load and show the fps counter
		SystemTable* pSystemTable = PerModuleInterface::GetInstance()->GetSystemTable();
		IGUISystem* pGUI = pSystemTable->pGUISystem;

		if (forceLoad)
		{
			// Clear style sheet cache so any changes to RCSS files will be applied
			pGUI->ClearStyleSheetCache();
		}

		IGUIDocument* pDocument = forceLoad ? NULL : pGUI->GetDocument("FPSCounter");
		if (pDocument == NULL)
		{
			pDocument = pGUI->LoadDocument("/Assets/GUI/fps-counter.rml", "FPSCounter");
		}

		if (pDocument != NULL)
		{
			pDocument->Show();
			m_pCounterElement = pDocument->Element()->GetElementById("fps");
			
			pDocument->RemoveReference();
		}
	}
	void InitDocument(bool forceLoad)
	{
		// may be serializing an already initialized object, ensure we handle reference
		// counting correctly.
		if (m_pInputElement)
		{
			m_pInputElement->RemoveEventListener( "click", this, 0 );
			m_pInputElement->RemoveReference();
			m_pInputElement = 0;
		}
		if ( m_pInfoElement )
		{
			m_pInfoElement->RemoveReference();
			m_pInfoElement = 0;
		}

		// Load and show the input element
		SystemTable* pSystemTable = PerModuleInterface::GetInstance()->GetSystemTable();
		IGUISystem* pGUI = pSystemTable->pGUISystem;

		if (forceLoad)
		{
			// Clear style sheet cache so any changes to RCSS files will be applied
			pGUI->ClearStyleSheetCache();
		}

		IGUIDocument* pDocument = forceLoad ? NULL : pGUI->GetDocument("Input");
		if (pDocument == NULL)
		{
			pDocument = pGUI->LoadDocument("/Assets/GUI/input.rml", "Input");
		}

		if (pDocument != NULL)
		{
			pDocument->Show();
			m_pInputElement = pDocument->Element()->GetElementById("input");
			m_pInputElement->AddEventListener( "click", this, 0 );

			// Make input element same size as window
			char buff[16];
			float windowWidth, windowHeight;
			PerModuleInterface::GetInstance()->GetSystemTable()->pGame->GetWindowSize( windowWidth, windowHeight );
			_itoa_s( (int)windowWidth, buff, 10 );
			m_pInputElement->SetProperty( "width", buff );
			_itoa_s( (int)windowHeight, buff, 10 );
			m_pInputElement->SetProperty( "height", buff );
			
			// Set up info element in the bottom right corner
			m_pInfoElement = pDocument->Element()->GetElementById("info");
			m_pInfoElement->SetProperty( "display", "none" );

			int left;
			left = (int)( windowWidth - m_pInfoElement->GetClientWidth() );
			_itoa_s( left, buff, 10 );
			m_pInfoElement->SetProperty( "left", buff );
			
			int top;
			top = (int)( windowHeight - m_pInfoElement->GetClientHeight() );
			_itoa_s( top, buff, 10 );
			m_pInfoElement->SetProperty( "top", buff );
			

			pDocument->RemoveReference();
		}
	}