//==================================================================================================
// COMMON PAGE SCRIPT (IS LOADED AFTER ALL OTHER TS-SCRIPTS) —
// FUNCTIONS FOR INVOCATION FROM PLAIN JS (HTML), INITIALIZATION ETC.:
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
// APPLICATION (CONFIGURATION ETC):

function app_SpecifyIsDebugConfiguration() {
   App.SpecifyIsDebugConfiguration()
}

//--------------------------------------------------------------------------------------------------
// MISCELLANEOUS HELPERS:

function showAlert(message: string) {
   if ( !message )
      message = 'Error message was not provided for this box.'
   alert(message)
}

function UseErrorClass(element: HTMLElement, use: boolean) {
   HArgChecking.PROVIDED(element, 'UseErrorClass', 'element')
   Common.UseErrorClass(element, use)
}
function IncludeErrorClass(element: HTMLElement) {
   HArgChecking.PROVIDED(element, 'IncludeErrorClass', 'element')
   Common.IncludeErrorClass(element)
}
function ExcludeErrorClass(element: HTMLElement) {
   HArgChecking.PROVIDED(element, 'ExcludeErrorClass', 'element')
   Common.ExcludeErrorClass(element)
}

//--------------------------------------------------------------------------------------------------
// PAGE EVENT HANDLERS:

function window_OnError( message: string, url: string, line: number, col: number,
                         errorObj ): boolean {
   return Breakdown.HandlePageError(message, url, line, col, errorObj)
}
function window_OnLoad() {
// Hide loading indicator by completion of page loading:
   $('#loading').hide()
   //throw 'Qwertyuiop!!!'
   page_loaded_completely = true
}

function document_DOMContentLoaded() {
   page_loaded = true
}

//==================================================================================================
// GLOBAL VARIABLES, ASSIGNMENTS AND FUNCTION CALLS (COMMON PAGE SCRIPT):
//--------------------------------------------------------------------------------------------------

window.onerror = window_OnError
window.onload = window_OnLoad
/*
window.onload = function() {
   setTimeout( window_OnLoad, 3000 ) // for test purpose
}
*/
document.addEventListener('DOMContentLoaded', document_DOMContentLoaded)

//==================================================================================================
common_script_loaded = true
//==================================================================================================
