/*
    Note this javascript was taken from the existing library page with the following exceptions:
    
        (1) In two places 'document.InputForm' was changed to 'document.forms[0]'
            XHTML does not allow the "name" attribute in a <form> tag as in '<form name="InputForm>'
            
            An alternative is to use an id tag: '<form id="InputForm>'.  This would require javascript changes such as:
            
                document.getElementByid('InputForm').value, etc.
                
            Since 'document.forms[0]' is already used in several other places, this change was made
            
        (2) The 'showPopUpCaption' function was removed.  A similar function may be found in 'pop_detail_page.js'
        

*/

function register(){

    var myNameProp=document.title;
    var theBrowser='No need to determine Browser';
    var aTest='0';
    var bTest='0';
    var bValue='0';
    var theIndex = 0;
    var iTest = 'none';
    var str1;
        var selsearch;
}

function dud()
{
return true;
}

function submitForm(){
register ();
var FullSearchURL = "http://orbis.library.yale.edu/cgi-bin/Pwebrecon.cgi?Search_Arg=" + searchits + "&Search_Code=NAME_&DB=local&CNT=50" 
var searchits =  document.forms[0].q.value
var list=document.forms[0].qt
var status2=list.options[list.selectedIndex].value
if (status2 == "T") { 
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://neworbexpress.library.yale.edu/vwebv/search?searchArg=" + searchits + "&searchCode=TALL&CNT=50&searchType=1"
}
else if (status2 == "J") {
// currently not used, left in in case it is added later
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL ="http://orbis.library.yale.edu/cgi-bin/Pwebrecon.cgi?Search_Arg=" + searchits + "&Search_Code=JALL&DB=local&CNT=50"
}
else if (status2 == "AN") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://neworbexpress.library.yale.edu/vwebv/search?searchArg=" + searchits + "&searchCode=NAME&CNT=50&searchType=1"
}
else if (status2 == "Orbis") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://google.yale.edu/search?q=" + searchits + "&spell=1&site=Yale_Libraries&output=xml_no_dtd&client=library_frontend_test&ie=UTF-8&proxystylesheet=library_frontend_test&access=p"
}
else if (status2 == "NewOrbis") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://neworbexpress.library.yale.edu/vwebv/search?searchCode=GKEY^*&limitTo=none&recCount=50&searchType=1&searchArg=" + searchits
}
else if (status2 == "Journals") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://sfx.library.yale.edu/sfx_local/azlist/default?param_type_value=textSearch&param_pattern_value=" + searchits + "&param_textSearchType_value=contains"
}
else if (status2 == "Databases") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://databases.library.yale.edu:8331/V/?func=find-db-1-title&mode=titles&azlist=N&scan_utf=&scan_start=" + searchits + "&search_type=contains&restricted=all"
}
else if (status2 == "Images") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://digitalcollections.library.yale.edu/Search.dl?q=" + searchits
}
else if (status2 == "Google%20Scholar") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://scholar.google.com/scholar?q=" + searchits
}
else if (status2 == "People") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://resources.library.yale.edu/StaffDirectory/results.aspx?qm=keyword&q=" + searchits
}
else if (status2 == "Yufind") {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://yufind.library.yale.edu/yufind/Search/Results?lookfor=" + searchits
}
else if (status2 == "FindingAids") {
    var pattern = / /g;
    searchits = searchits.replace(pattern, '+')
    var FullSearchURL = "http://drs.library.yale.edu:8083/fedoragsearch/rest?filter=&operation=solrQuery&query=" + searchits
}
else if (status2 == "Guides") {
    var pattern = / /g;
    searchits = searchits.replace(pattern, '+')
    var FullSearchURL = "http://guides.library.yale.edu/search.php?iid=169&c=0&search=" + searchits
}
else {
var pattern = / /g;
searchits = searchits.replace(pattern,'+')
var FullSearchURL = "http://google.yale.edu/search?q=" + searchits + "&spell=1&site=Yale_Libraries&output=xml_no_dtd&client=library_frontend_test&ie=UTF-8&proxystylesheet=library_frontend_test&access=p"
}
/*
<option value="Orbis">Orbis Keyword</option>
<option value="Journals">E-journals</option>
<option value="Databases">Databases</option>
<option value="Images">Images</option>
<option value="Library%20Web" selected="selected">Library Web</option>
<option value="Google%20Scholar">Google Scholar</option>
<option value="People">Library People</option>
*/
location.href=FullSearchURL
    }
