var userpwdFocus = false;
document.write("<script type='text/javascript' src='clientsniffer.js'><\/script>");

function browserchk()
{
  var supported = false;
  // no longer checking if java is enabled.
  var javaEnabled = true;
  if ( navigator.javaEnabled() )
  {
    javaEnabled = true;
  }
  if ((is_nav8) || (is_nav7) || (is_moz1_7) || (is_win && is_ie5up) || (is_win && is_ie6) || (is_saf1_3) || (is_fox1_5) || (is_win && is_fox1)||(is_fox2)||is_fox3||is_chrome0)
  {
    supported = true;
  }
   return (supported && javaEnabled);
}

function hadFocus(set)
{
    if (set) userpwdFocus = true;
    return userpwdFocus;
}
function getCookie(name) {
        var search = name + "="
        if (document.cookie.length > 0) {
                offset = document.cookie.indexOf(search)
                if (offset != -1) { 
                offset += search.length 
                end = document.cookie.indexOf(";", offset) 
                if (end == -1)
                        end = document.cookie.length
                return unescape(document.cookie.substring(offset, end))
                }
        }
}
function clearCache()
{
     var name="usid"
     var value="chocolate-chip-cookies"
     cookie= name + "=" + value + "; path=/cp; domain=.langara.bc.ca; expires=" +
        (new Date(0)).toGMTString();
     if (getCookie (name) != value) document.cookie = cookie;
     doCancel();
}
function doCancel()
{
     document.userid.user.value='';
     document.cplogin.user.value='';
     document.cplogin.pass.value='';
}
function xferFocus()
{
   document.cplogin.pass.focus();
}

function langlogin()
{
  if (browserchk() == true && navigator.cookieEnabled)  
     login();
  else
     top.location="ancillary/badbrw.html";
}

function login()
{  
   setQueryAsCookie();
   document.cplogin.user.value=document.userid.user.value;
   document.cplogin.submit();
}
function setQueryAsCookie()
{
   var query = document.location.search;
   if (query.length > 1) {
      document.cookie = "query=" + escape(query) + "; path=/cp; domain=.langara.bc.ca;"
   } else {
      document.cookie = "query=; path=/cp; domain=.langara.bc.ca; expires=" +
        (new Date(0)).toGMTString();
   }
}
var size = "15";
if ( ( is_nav4up || is_ie4up ) && is_mac ) { size = "12"; }
else if ( is_nav4_7up) { size = "10"; }
