this.searchfield=function(){var c="search_field";var j="Search U of M Web sites";var e=false;var m="above the fold, absolute link, accessibility, address bar, affordance, alt text, alt tag, anchor, animated GIF, anti-alias, applet, assumed knowledge, authoring, automagically, autoresponder";var k=document.getElementById(c);var l="sf_inactive";var h="sf_active";var f="sf_text";var n="sf_suggestion";this.safari=((parseInt(navigator.productSub)>=20020000)&&(navigator.vendor.indexOf("Apple Computer")!=-1));if(k&&!safari){k.value=j;k.c=k.className;k.className=k.c+" "+l;k.onfocus=function(){this.className=this.c+" "+h;this.value=(this.value==""||this.value==j)?"":this.value};k.onblur=function(){this.className=(this.value!=""&&this.value!=j)?this.c+" "+f:this.c+" "+l;this.value=(this.value!=""&&this.value!=j)?this.value:j;clearList()};if(e){var d=0;k.setAttribute("autocomplete","off");var b=document.createElement("div");var g=document.createElement("ul");g.style.display="none";b.className=n;g.style.width=k.offsetWidth+"px";b.appendChild(g);k.parentNode.appendChild(b);k.onkeypress=function(p){var o=getKeyCode(p);if(o==13){selectList();d=0;return false}};k.onkeyup=function(p){var o=getKeyCode(p);switch(o){case 13:return false;break;case 27:k.value="";d=0;clearList();break;case 38:navList("up");break;case 40:navList("down");break;default:startList();break}};this.startList=function(){var o=getListItems(k.value);if(k.value.length>0){createList(o)}else{clearList()}};this.getListItems=function(p){var o=new Array();var q=m;var q=q.replace(/, /g,",");var r=q.split(",");for(i=0;i<r.length;i++){if(r[i].substring(0,p.length).toLowerCase()==p.toLowerCase()){o.push(r[i])}}return o};this.createList=function(o){resetList();if(o.length>0){for(i=0;i<o.length;i++){li=document.createElement("li");a=document.createElement("a");a.href="javascript:void(0);";a.i=i+1;a.innerHTML=o[i];li.i=i+1;li.onmouseover=function(){navListItem(this.i)};a.onmousedown=function(){d=this.i;selectList(this.i);return false};li.appendChild(a);g.setAttribute("tabindex","-1");g.appendChild(li)}g.style.display="block"}else{clearList()}};this.resetList=function(){var p=g.getElementsByTagName("li");var o=p.length;for(var q=0;q<o;q++){g.removeChild(p[0])}};this.navList=function(o){d+=(o=="down")?1:-1;li=g.getElementsByTagName("li");if(d<1){d=li.length}if(d>li.length){d=1}navListItem(d)};this.navListItem=function(o){d=o;li=g.getElementsByTagName("li");for(var p=0;p<li.length;p++){li[p].className=(p==(d-1))?"selected":""}};this.selectList=function(){li=g.getElementsByTagName("li");a=li[d-1].getElementsByTagName("a")[0];k.value=a.innerHTML;clearList()}}}this.clearList=function(){if(g){g.style.display="none";d=0}};this.getKeyCode=function(p){var o;if(!p){var p=window.event}if(p.keyCode){o=p.keyCode}return o}};this.addEvent=function(d,c,b){if(d.attachEvent){d["e"+c+b]=b;d[c+b]=function(){d["e"+c+b](window.event)};d.attachEvent("on"+c,d[c+b])}else{d.addEventListener(c,b,false)}};addEvent(window,"load",searchfield);
