﻿// KGIndexedDocListControl JScript File

function KGIndexedDocListControl_documentSelectionDropListIndexChanged(_documentSelectionDropList, _theGrid, _GridType)
{
  var options = _documentSelectionDropList.getElementsByTagName("option");
  var selectedItem = options[_documentSelectionDropList.selectedIndex];
  // confirm the item is in the list before applying the filter
  if (selectedItem.className == "docList_dropList_availableItem")
  {
    // set the session property (used to determine what to include in the grid population)
    SetSessionProperty("KGIndexedDocList_docTypeFilter", _documentSelectionDropList.value);
    SetSessionProperty("KGIndexedDocList_repopulateByDropList", true);
    if(savedConcept != 0)
			SetSessionProperty('KGIndexedDocList_repopulateByConceptId', savedConcept);
		else
			SetSessionProperty('KGIndexedDocList_repopulateByKnowdeId',returnKnowdeID(globalLastSelectedKnowde));
    
    // force the indexed doc tab to repopulate
    globalIndexedDocsPageLoaded = false;
    setTimeout("KGTabbedWindowsControl_SelectTabById('Indexed Documents');", 20);
  }
  else
	{
		var sortList = document.getElementById("sortListDiv");
		sortList.style.visibility = "hidden";
		SetSessionProperty("KGIndexedDocList_docTypeFilter", _documentSelectionDropList.value);
	}
}

function KGIndexedDocListControl_sortDropListIndexChanged(_sortDropList, _theGrid, GridType, _dropListSelector)
{
  var options = _sortDropList.getElementsByTagName("option");
  var selectedItem = options[_sortDropList.selectedIndex];
  // confirm the item is in the list before applying the filter
  if (selectedItem.className == "docList_dropList_availableItem")
  {
    // set the session property (used to determine what to include in the grid population)
    switch (_dropListSelector)
    {
      case "All":
        SetSessionProperty("KGIndexedDocList_sortAllFilter", _sortDropList.value);
        break;
      case "AllFeatured":
        SetSessionProperty("KGIndexedDocList_sortAllFeaturedFilter", _sortDropList.value);
        break;
      case "KG":
        SetSessionProperty("KGIndexedDocList_sortKGFilter", _sortDropList.value);
        break;
      case "Web":
        SetSessionProperty("KGIndexedDocList_sortWebFilter", _sortDropList.value);
        break;
      case "News":
        SetSessionProperty("KGIndexedDocList_sortWebFilter", _sortDropList.value);
        break;
      case "Blogs":
        SetSessionProperty("KGIndexedDocList_sortWebFilter", _sortDropList.value);
        break;
    }
    SetSessionProperty("KGIndexedDocList_repopulateByDropList", true);
    if(savedConcept != 0)
			SetSessionProperty('KGIndexedDocList_repopulateByConceptId', savedConcept);
		else
			SetSessionProperty('KGIndexedDocList_repopulateByKnowdeId',returnKnowdeID(globalLastSelectedKnowde));

    // force the indexed doc tab to repopulate
    globalIndexedDocsPageLoaded = false;
    setTimeout("KGTabbedWindowsControl_SelectTabById('Indexed Documents');", 20);
  }
}

function closeIndexedDocuments()
{
//debugger;
//check for a docked help window
var dockedHelp = document.getElementById("DockedHelpWindowContainer")

if(dockedHelp != null)
{
  dockedHelp.style.width = screen.width;
  document.getElementById("DockedHelpWindow").style.width = "100%";
  if(document.frames)
  {
    document.frames['DockedHelpWindow'].location.reload(true);
  }
  
  document.getElementById("KGTabbedWindowsControl1").style.height = dockedHelp.style.height;
  document.getElementById("KGTabbedWindowsControl1").style.overflowY = "hidden";
}
else
{
	DoExpandMapViewPane('map');
}

globalHideIndexedDocs = true;

}
