﻿/// <reference path="../Global.js" />
// JScript File
/*
Author: Simon Yang
Create: 2010-04-16
*/

function Kiosk() {
   /// <summary>Kiosk for the logic of Kiosk Search</summary>
}

Kiosk.prototype = {
   AjaxParent: null,
   search: function(nKioskID, nExtra, sLibID) {
   $("KioskLoading").style.display = "";
   $("divKioskSearch").style.display = "none";
   $("ResultMainDIV").style.display = "none";
   this.AjaxParent.AjaxKioskInfo(nKioskID, sLibID, nExtra, 
      function(res) {
         if (res) {
            $("KioskLoading").style.display = "none";
            $("divKioskSearch").style.display = "";
            $("divKioskSearch").innerHTML = res.getValue("strHTMLImg");
            $("ResultLoading").style.display = "";
            LazyLoad.loadOnce(JsPath.NarrowSearch, function() {
               var narrowSearch = new NarrowSearchTable();
               narrowSearch.narrowLoading();
            }, this, true, true);
            $("ResultTableShow").style.display = "none";
            $("ResultMainDIV").style.display = "";
            var table = res.getValue("dt");
            searchResultsTable = table;
            if (table == null || typeof (table) != "object" || table.Rows == null || table.Rows.length == null || table.Rows.length == 0) {
               $("ResultMainDIV").style.display = "none";
            }
            else {
               Util.show_Results(1);
               Util.show_NarrowSearch(null);
            }
         }
      },
      function(res) {
         Util.showError(res);
      });
   }
}
