﻿var base_url="/gsdl/cgi-bin/library";

////////////////////////////////////////////////////////
// Function for general search
////////////////////////////////////////////////////////
function addSpace(inString) {
  var modtext = "";
  var j;
  for (j=0; j < inString.length; j++) {
    if (modtext != "") {
      modtext = modtext + " " + inString.charAt(j);
    }
    else {
      modtext = inString.charAt(j);
    }
  }
  modtext = "\"" + modtext + "\"";

  return modtext;
}

function getstdargs() {
  return "a=q&r=0&hs=1&t=1&fqa=0&l=zh";
}

function getqueryargs() {
  qryarg = "";
  qryarg = "fqv='" + document.hkoh.fqv.value + "'";
//  qryarg = "fqv=" + escape(addSpace(document.hkoh.fqv.value));
  qryarg = qryarg + "&fqf=ZZ";

  var i = document.hkoh.no_result.selectedIndex;
  var no_of_result = document.hkoh.no_result.options[i].value;
  qryarg = qryarg + "&e=q-000-00---0hkoh--00-1-0--0prompt-10---4------0-1l--1-en-2600---" + no_of_result + "-about---00021-001-1-0utfZz-8-00";

  return qryarg;
}

////////////////////////////////////////////////////////
// Function for search on Themes
////////////////////////////////////////////////////////
function getSearchThemeQueryArgs(themeCode) {
  qryarg = "";
  qryarg = "fqv='" + themeCode + "'";
  qryarg = qryarg + "&fqf=TE";
  qryarg = qryarg + "&e=q-000-00---0hkoh--00-1-0--0prompt-10---4------0-1l--1-en-2600---10-about---00021-001-1-0utfZz-8-00";

  return qryarg;
}

function SearchTheme(themeCode) {
  this.location = base_url + "?" + getstdargs() + "&" + getSearchThemeQueryArgs(themeCode);
}

