function multiPSUsearch()
{
  with (window.document)
  {
    switch (searchengine.engine.selectedIndex)
    {
      case 0:
        aisgoogle.q.value=searchengine.search.value;
        aisgoogle.action="http://search-results.aset.psu.edu/search";
        aisgoogle.client.value="PennState";
        aisgoogle.proxystylesheet.value="PennState";
        aisgoogle.output.value="xml_no_dtd";
        aisgoogle.site.value="PennState";
        aisgoogle.as_sitesearch.value="ais.its.psu.edu";
        aisgoogle.target="_blank";
        aisgoogle.submit();
        break;
      case 1:
        itsgoogle.q.value=searchengine.search.value;
        itsgoogle.action="http://search-results.aset.psu.edu/search";
        itsgoogle.client.value="PennState";
        itsgoogle.proxystylesheet.value="PennState";
        itsgoogle.output.value="xml_no_dtd";
        itsgoogle.site.value="PennState";
        itsgoogle.as_sitesearch.value="its.psu.edu";
        itsgoogle.target="_blank";
        itsgoogle.submit();
        break;
      case 2:
        psugoogle.q.value=searchengine.search.value;
        psugoogle.action="http://search-results.aset.psu.edu/search";
        psugoogle.client.value="PennState";
        psugoogle.proxystylesheet.value="PennState";
        psugoogle.output.value="xml_no_dtd";
        psugoogle.site.value="PennState";
        psugoogle.target="_blank";
        psugoogle.submit();
        break;
      case 3:
        psupeople.cn.value=searchengine.search.value;
        psupeople.action="http://www.psu.edu/cgi-bin/ldap/ldap_query.cgi";
        psupeople.target="_blank";
        psupeople.submit();
        break;
      case 4:
        psudepts.dept_name.value=searchengine.search.value;
        psudepts.action="http://www.psu.edu/cgi-bin/ldap/dept_query.cgi";
        psudepts.target="_blank";
        psudepts.submit();
        break;
      case 5:
        google.q.value=searchengine.search.value;
        google.action="http://www.google.com/search";
        google.ie.value="UTF-8";
        google.oe.value="UTF-8";
        google.target="_blank";
        google.submit();
        break;
    }
  }
}

function fixRestrictedLinks()
{
  if ((location.hostname != 'webcontent.ais.psu.edu') && (location.hostname != 'rdtest.ais.psu.edu'))
  {
    var len = document.links.length
    for (var i=0; i<len; i++)
    {
      url = document.links[i].href
      intl = url.indexOf('/internal/')
      sec = url.indexOf('/secure/')
      if (document.links[i].hostname == location.hostname)
      {
        if ((location.protocol != 'https:') && ((intl != -1) || (sec != -1)))
        { 
          url = url.replace("http", "https")
          document.links[i].href = url
        }
        else if ((location.protocol == 'https:') && ((intl == -1) && (sec == -1)))
        {
          url = url.replace("https", "http")
          document.links[i].href = url
        }
      }    
    }
  }
}
