<!-- OPTIONAL INPUT with id="encoreSearchTab" -->
<select name="encoreSearchTab" id="encoreSearchTab">
<option value="plus/">Everything</option>
<option value="search/">Library Catalog</option>
<option value="eds/">Articles</option>
</select>
<script type="text/javascript">
function searchEncore(){
var encoreBaseURLInput,encoreBaseURL, searchInput, scopeInput, searchString, scopeString;
var locationHref, charRegExString, base64Regex, encoreSuite, tabInput, searchTab;
var justEbooks, limitSubject;
/*
base64_encoding_map includes special characters that need to be
encoded using base64 - these chars are "=","/", "\", "?"
character : base64 encoded
*/
var base64_encoding_map = {"=":"PQ==", "/": "Lw==", "\\":"XA==", "?":"Pw=="};
var escapeRegExp = function(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
encoreBaseURLInput = document.getElementById("encoreBase");
encoreSuite = document.getElementById("encoreSuite");
searchInput = document.getElementById("encoreSearchInput");
tabInput = document.getElementById("encoreSearchTab");
justEbooks = document.getElementById("justEbooks");
justStream = document.getElementById("justStream");
limitSubject = document.getElementById("subject");
if (tabInput != null) {
searchTab = tabInput.options[tabInput.selectedIndex].value;
}
if (justEbooks != null) {
justEbooks = justEbooks.value;
}
if (justStream != null) {
justStream = justStream.value;
}
if (limitSubject != null) {
limitSubject = limitSubject.value;
}
if (searchInput && encoreBaseURLInput) {
encoreBaseURL = encoreBaseURLInput.value;
searchString = searchInput.value;
for(var specialChar in base64_encoding_map) {
charRegExString = escapeRegExp(specialChar);
base64Regex = new RegExp(charRegExString, "g");
searchString = searchString.replace(base64Regex, base64_encoding_map[specialChar])
}
searchString = encodeURIComponent(searchString);
scopeInput = document.getElementById('encoreSearchLocation');
if (scopeInput) {
scopeString = scopeInput.value;
}
if (searchTab) {
encoreBaseURL += searchTab;
} else {
encoreBaseURL += "search/";
}
if (limitSubject) {
searchString = "d%3A%28" + searchString + "%29";
}
if (justEbooks && justStream) {
searchString += " f:(ab1 | gv5)";
}
else if (justStream) {
searchString += " f:gv5";
}
else if (justEbooks) {
searchString += " f:ab1";
}
if (scopeString) {
scopeString = encodeURIComponent(scopeString);
locationHref = encoreBaseURL + "C__S" + searchString + scopeString + "__Orightresult__U";
} else {
locationHref = encoreBaseURL + "C__S" + searchString + "__Orightresult__U";
}
languageSetting = document.getElementById("encoreLanguage");
if (languageSetting) {
locationHref = locationHref + "?lang=" + languageSetting.value;
}
if (encoreSuite) {
locationHref += "?lang=eng&suite=" + encoreSuite.value;
locationHref = locationHref.replace("discover.falsc", encoreSuite.value + ".discover.falsc");
}
window.open(locationHref, '_blank');
}
return false;
}
</script>
<form action="?" onsubmit="return searchEncore()">
beginform
<!-- REQUIRED INPUT with id="encoreSearchInput" -->
<input id="encoreSearchInput" type="text"/>
tabSelect
<!-- REQUIRED INPUT with id="encoreBase" -->
<input type="hidden" id="encoreBase" value="http://discover.falsc.org/iii/encore/" />
<!-- REQUIRED INPUT with id="encoreSuite" -->
<input type="hidden" id="encoreSuite" value="" />
<!-- OPTIONAL INPUT with id="justEbooks" -->
<input type="hidden" id="justEbooks" value="" />
<!-- OPTIONAL INPUT with id="justStream" -->
<input type="hidden" id="justStream" value="" />
<!-- OPTIONAL INPUT with id="subject" -->
<input type="hidden" id="subject" value="" />
<!-- OPTIONAL search location hidden field to limit to a predefined scope -->
<!-- <input type="hidden" id="encoreSearchLocation" value="__Lf:facetcollections:<Scope_#>:<Scope_#>:<Scope Label>::" /> -->
<input type="submit" value="Search" />
endform
</form>