function SearchTab(tab) {
  switch(tab) {
    case "search_discover":
      document.getElementById('search_scroll').style.top = "0px";
      document.getElementById('input_discover').focus();
      changeColors('tab_discover');
    break;
    case "search_databases":
      document.getElementById('search_scroll').style.top = "-105px";
      document.getElementById('input_databases').focus();
      changeColors('tab_databases');
    break;
    case "search_articles":
      document.getElementById('search_scroll').style.top = "-210px";
      document.getElementById('input_articles').focus();
      changeColors('tab_articles');
    break;
    case "search_ejournals":
      document.getElementById('search_scroll').style.top = "-315px";
      document.getElementById('input_ejournals').focus();
      changeColors('tab_ejournals');
    break;
    //case "search_google":
    //  document.getElementById('search_scroll').style.top = "-420px";
    //  document.getElementById('input_google').focus();
    //  changeColors('tab_google');
    //break;
    
  }
}

function changeColors(tab) {
  document.getElementById('tab_discover').style.background = '#bbbbbb';
  document.getElementById('tab_databases').style.background = '#bbbbbb';
  document.getElementById('tab_articles').style.background = '#bbbbbb';
  document.getElementById('tab_ejournals').style.background = '#bbbbbb';
  
  document.getElementById('tab_discover').style.color = '#333333';
  document.getElementById('tab_databases').style.color = '#333333';
  document.getElementById('tab_articles').style.color = '#333333';
  document.getElementById('tab_ejournals').style.color = '#333333';
  
  //document.getElementById('tab_google').style.background = '#333333';
  
  document.getElementById(tab).style.background = '#8A2003';
  document.getElementById(tab).style.color = '#ffffff';
  
}

function matchText(strText) {
  
  document.getElementById('input_discover').value = strText;
  document.getElementById('input_databases').value = strText;
  document.getElementById('input_articles').value = strText;
  document.getElementById('input_ejournals').value = strText;
  //document.getElementById('input_google').value = strText;
  
}

function matchSearchText(tab) {
  /*
  switch(tab) {
    case "input_discover":
      document.catalog.SAB1.value            = document.all.search.value;
      document.articles.find_request_1.value = document.all.search.value;
      document.ej.param_pattern_value.value  = document.all.search.value;
      document.google.q.value                = document.all.search.value
    break;
    case "input_databases":
      document.all.search.value              = document.catalog.SAB1.value;
      document.articles.find_request_1.value = document.catalog.SAB1.value;
      document.ej.param_pattern_value.value  = document.catalog.SAB1.value;
      document.google.q.value                = document.catalog.SAB1.value;
    break;
    case "input_articles":
      document.all.search.value              = document.articles.find_request_1.value;
      document.catalog.SAB1.value            = document.articles.find_request_1.value;
      document.ej.param_pattern_value.value  = document.articles.find_request_1.value;
      document.google.q.value                = document.articles.find_request_1.value;
    break;
    case "input_ejournals":
      document.all.search.value              = document.ej.param_pattern_value.value;
      document.catalog.SAB1.value            = document.ej.param_pattern_value.value;
      document.articles.find_request_1.value = document.ej.param_pattern_value.value;
      document.google.q.value                = document.ej.param_pattern_value.value;
    break;
    case "input_google":
      document.all.search.value              = document.google.q.value;
      document.catalog.SAB1.value            = document.google.q.value;
      document.articles.find_request_1.value = document.google.q.value;
      document.ej.param_pattern_value.value  = document.google.q.value;
    break;
  }
  */
  //alert(tab);
  //document.google.q.value = document.all.search.value;
  /*
  document.getElementById('input_all').value    = document.getElementById(tab).value;
  document.getElementById('input_cat').value    = document.getElementById(tab).value;
  document.getElementById('input_db').value     = document.getElementById(tab).value;
  document.getElementById('input_ej').value     = document.getElementById(tab).value;
  document.getElementById('input_google').value = document.getElementById(tab).value;
  */
}

function SecondSearchTabRadio(rb) {
  rb.checked = rb.checked ? false : true;
  return true;
}

function SecondSearchTabBackground(span) {
  
  if (span == "tab_all") { span = "tab_discover"; }
  
  document.getElementById('tab_discover').style.background = "";
  document.getElementById('tab_discover').style.color = "#000000";
  
  document.getElementById('tab_databases').style.background = "";
  document.getElementById('tab_databases').style.color = "#000000";
  
  document.getElementById('tab_articles').style.background = "";
  document.getElementById('tab_articles').style.color = "#000000";
  
  document.getElementById('tab_ejournals').style.background = "";
  document.getElementById('tab_ejournals').style.color = "#000000";
  
  //document.getElementById('tab_google').style.background = "";
  //document.getElementById('tab_google').style.color = "#000000";
    
  if(/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
    
    //document.getElementById(span).style.backgroundPosition = "center 10";
    //document.getElementById(span).style.backgroundColor = "#ffffff";
    var bgPos;
    
    /*
    if(span=='tab_discover')  { bgPos = '425px'; }
    if(span=='tab_databases') { bgPos = '485px'; }
    if(span=='tab_ejournals') { bgPos = '548px'; }
    if(span=='tab_articles')  { bgPos = '605px'; }
    if(span=='tab_google')    { bgPos = '652px'; }
    */
    
    if(span=='tab_discover')  { bgPos = '473px'; }
    if(span=='tab_databases') { bgPos = '533px'; }
    if(span=='tab_ejournals') { bgPos = '597px'; }
    if(span=='tab_articles')  { bgPos = '653px'; }
    if(span=='tab_google')    { bgPos = '700px'; }
    
    document.getElementById('second_search_tabs').style.height = "18px";
    document.getElementById('second_search_tabs').style.background = "url('http://library.syr.edu/img/search/tab_triangle.png') no-repeat bottom " + bgPos;
    document.getElementById('second_search_box').style.margin = "-7px 3px 0px 0px";
    //document.getElementById('input_all').style.width = "305px";
    
  } else {

    document.getElementById(span).style.background = "url('http://library.syr.edu/img/search/tab_triangle.png') no-repeat bottom center";
 
  }
  
  //document.getElementById(span).style.background = "#929292";
  document.getElementById(span).style.color = "#ffffff";

}
