//URL-encode string: php.js
function urlencode(str) {var hexStr = function(dec){return '%' + dec.toString(16).toUpperCase();};var ret = '', unreserved = /[\w.-]/;str = (str+'').toString();for(var i = 0, dl = str.length; i < dl; i++){var ch = str.charAt(i);if (unreserved.test(ch)){ret += ch;}else {var code = str.charCodeAt(i);if (code === 32){ret += '+';}else if (code < 128){ret += hexStr(code);}else if (code >= 128 && code < 2048){ret += hexStr((code >> 6) | 0xC0);ret += hexStr((code & 0x3F) | 0x80);}else if (code >= 2048 && code < 65536){ret += hexStr((code >> 12) | 0xE0);ret += hexStr(((code >> 6) & 0x3F) | 0x80);ret += hexStr((code & 0x3F) | 0x80);}else if (code >= 65536){ret += hexStr((code >> 18) | 0xF0);ret += hexStr(((code >> 12) & 0x3F) | 0x80);ret += hexStr(((code >> 6) & 0x3F) | 0x80);ret += hexStr((code & 0x3F) | 0x80);}}}return ret;}

function HandleSearch(e, text){var CharCode = e.keyCode? e.keyCode : e.charCode; if(CharCode == 13){DoDCBSearch(text); return false;}else{return true;}}
function DoDCBSearch(text){if(text != 'search site' && text != ''){location.href='http://search1.du.edu/search?site=daniels_collection&client=daniels_frontend&proxystylesheet=daniels_frontend&output=xml_no_dtd&lr=&ie=utf8&oe=utf8&q=' + urlencode(text);}}
function DoDUSearch(text){if(text != 'search site' && text != ''){location.href='http://search1.du.edu/search?site=du_collection&client=du_frontend&proxystylesheet=du_frontend&output=xml_no_dtd&lr=&ie=utf8&oe=utf8&q=' + urlencode(text);}}

