//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// MAGISTRAL LAYOUT FUNCTIONS:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*
function Magistral_Exists(): boolean {
   return WIN.magistral_PageContentDIV != null
}
*/
function Magistral_Initialize() {
   Magistral.Initialize()
}

function Magistral_GetPageContentWidthDiff(): number {
   return Magistral.GetPageContentWidthDiff()
}
//--------------------------------------------------------------------------------------------------

function Magistral_SetDropDownMenuHtml(itemsHTML: string) {
   HArgChecking.PROVIDED(itemsHTML, 'Magistral_SetDropDownMenuHtml', 'innerHTML')
   WIN.magistral_DropdownMenuDIV.innerHTML = itemsHTML
}

function Magistral_SetPageName(verticalName: string|null) {
   Magistral.SetPageName(verticalName)
}
function Magistral_SetPageNameHTML(verticalNameHTML: string|null) {
   Magistral.SetPageNameHTML(verticalNameHTML)
}

function Magistral_SetDropdownIcon( iconClassName: string|null,
                                    iconPath: string|null ) {
   Magistral.SetDropdownIcon(iconClassName, iconPath)
}
function Magistral_SetDropdownIconClass(className: string|null) {
   Magistral.SetDropdownIconClass(className)
}
function Magistral_SetDropdownIconPath(iconPath: string|null) {
   Magistral.SetDropdownIconPath(iconPath)
}
function Magistral_SetDropdownIconHtml(html: string|null) {
   Magistral.SetDropdownIconHtml(html)
}

function Magistral_SetPageNameDropdownIcon( verticalName: string|null,
                                            iconClassName: string|null,
                                            iconPath: string|null ) {
   Magistral.SetPageNameDropdownIcon(verticalName, iconClassName, iconPath)
}
function Magistral_SetPageNameIconClass( verticalName: string|null,
                                         className: string|null ) {
   Magistral.SetPageNameIconClass(verticalName, className)
}
function Magistral_SetPageNameIconPath( verticalName: string|null,
                                        iconPath: string|null ) {
   Magistral.SetPageNameIconPath(verticalName, iconPath)
}

function Magistral_ResetPageNameDropdownIcon() {
   Magistral.ResetPageNameDropdownIcon()
}

//--------------------------------------------------------------------------------------------------

function Magistral_LocationChanged() {
   Magistral.LocationChanged()
}
function Magistral_InitiateReloadPage(): boolean {
   return Magistral.InitiateReloadPage()
}
function Magistral_DeferredInitiateReloadPage(milliseconds: number=0) {
   Magistral.DeferredInitiateReloadPage(milliseconds)
}

function Magistral_ClearSelectionUnscrollEtc() {
   Magistral.ClearSelectionUnscrollEtc()
}
function Magistral_ClearSelectionDeferredUnscrollEtc(milliseconds: number=0) {
   Magistral.ClearSelectionDeferredUnscrollEtc(milliseconds)
}

function Magistral_SpecifyPageContent(selectionContent: HTMLElement|null) {
   Magistral.SpecifyPageContent(selectionContent)
}
function Magistral_SpecifyModalPopup(selectionContent: HTMLElement|null) {
   Magistral.SpecifyModalPopup(selectionContent)
}

//--------------------------------------------------------------------------------------------------

function Magistral_SetOperationFailure(errorMessage: string|null=null): string {
   return Magistral.SetOperationFailure( errorMessage )
}
function Magistral_ResetOperationFailure() {
   Magistral.ResetOperationFailure()
}

function Magistral_HasProblemIndication(): boolean {
   return Magistral.HasProblemIndication()
}
function Magistral_HasErrorIndication(): boolean {
   return Magistral.HasErrorIndication()
}
function Magistral_HasAbandomentIndication() {
   return Magistral.HasAbandomentIndication()
}

//==================================================================================================
// MAGISTRAL LAYOUT MENU-ITEM FUNCTIONS (NAVIGATION ITEMS CONTROL):
//--------------------------------------------------------------------------------------------------

function Magistral_MI_SetTitle(id: string, title: string) {
   let funcName = 'Magistral_MI_SetTitle'
   HArgChecking.PROVIDED(id, funcName, 'id')
   HArgChecking.PROVIDED(title, funcName, 'title')
   var element: any = HElement.ById(id)
   element.title = title
}

function Magistral_MI_Enable(id: string, enable: boolean=true) {
   HArgChecking.PROVIDED(id, 'Magistral_EnableMenuItem', 'id')
   var element: any = HElement.ById(id)
   element.disabled = HOps.BoolDefaultTrue(enable) ? null : 'disabled'
}
function Magistral_MI_SetVisible(id: string, visible: boolean=true) {
   HArgChecking.PROVIDED(id, 'Magistral_SetMenuItemVisible', 'id')
   HElement.ById(id).style.visibility = HOps.BoolDefaultTrue(visible) ? 'visible' : 'collapse'
}
function Magistral_MI_UseClass(id: string, className: string, use: boolean=true) {
   let funcName = 'Magistral_MI_UseClass'
   HArgChecking.PROVIDED(id, funcName, 'id')
   HArgChecking.PROVIDED(className, funcName, 'className')
   HElement.UseClass(HElement.ById(id), className, HOps.BoolDefaultTrue(use))
}

function Magistral_MI_SetInnerHtml(id: string, innerHTML: string) {
   let funcName = 'Magistral_MI_SetInnerHtml'
   HArgChecking.PROVIDED(id, funcName, 'id')
   HArgChecking.PROVIDED(innerHTML, funcName, 'innerHTML')
   HElement.ById(id).innerHTML = innerHTML
}

//==================================================================================================
