var autos=new Array();var tid=0;var startswithServlet="startswith";var resultCache;var keycode=0;var req=null;var currentfid;var enter=false;var autodivMaxHeight=240;var isIE=(navigator.userAgent.toLowerCase().indexOf("msie")!=-1);if(typeof wahost=="undefined"){if(location.host=="www.answers.com"){var wahost="http://wiki.answers.com";}else{var wahost="";}}if(typeof rahost=="undefined"){if(location.host=="wiki.answers.com"){var rahost="http://www.answers.com";}else{var rahost="";}}var wikiAnswers=false;if(rahost){wikiAnswers=true;}var httpBaseURL;var aLoc;if(wikiAnswers){httpBaseURL=rahost+"/main";aLoc="WA.FAYT-";}else{httpBaseURL="http://"+location.host+"/main";aLoc="RA.FAYT-";}var SW_RESULT_TYPE_RA=0;var SW_RESULT_TYPE_WA=1;function AutoForm(_1,_2,_3){this.id=_1;this.autoid=_2;var _4=document.getElementById(_1);this.inputfield=_4.head_ask;this.rows=0;this.rowDivList=null;this.highlightedSuggestionIndex=-1;this.highlightedSuggestionDiv=null;this.topics=new Array(12);this.topicTitles=new Array(12);this.types=new Array(12);this.cursorUpDownPressed=false;this.currentInputFieldValue="";this.partialquery="";this.currentTopic="";this.currentTitle="";this.currentType="";this.keycode=0;this.dir=_3;this.thisform=_4;}function returnFalse(){return false;}function returnTrue(){return true;}function InitForm(_5,_6,_7){var _8=new AutoForm(_5,_6,_7);autos[_5]=_8;resultCache=new Object();}function DeInitForm(_9){if(typeof autos!="undefined"&&typeof autos[_9]!="undefined"){if(autos[_9].thisform.onsubmitOld){autos[_9].thisform.onsubmit=autos[_9].thisform.onsubmitOld;autos[_9].thisform.onsubmitOld=null;}if(autos[_9].inputfield.removeEventListener){autos[_9].inputfield.removeEventListener("keypress",KeyPress,true);}}}function BodyLoad(s,_b){var _c=document.getElementById(s);if(_c&&_c.value==""&&_b===true){_c.focus();}}function KeyDown(_d,_e){var _f=0;if(!_e&&window.event){_e=window.event;}if(document.layers){_f=(_e.modifiers&Event.CONTROL_MASK)>0;}else{_f=_e.ctrlKey;}if(tid){return;}keycode=_e.keyCode;if(_f){return true;}if(isCtrlKey(keycode)){return true;}if(isSendKey(keycode)){tid=setTimeout("SendQuery('"+_d+"')",150);}return UpDown(_d,keycode);}function KeyPress(_10){if(_10.which==0&&!isShowKey(keycode)){if(_10.preventDefault){_10.preventDefault();}return false;}}UpDown=function(fid,_12){var _13=autos[fid].inputfield;var _14=_13.value;autos[fid].keycode=_12;if(handleCursorUpDownEnter(_12,fid,_14)||isShowKey(_12)){return true;}else{return false;}};function handleCursorUpDownEnter(_15,fid,_17){var _18=autos[fid].highlightedSuggestionIndex;var _19=document.getElementById(autos[fid].autoid);if(_15==33){if(_19.style.visibility=="visible"){setStyleForElement(autos[fid].highlightedSuggestionDiv,"1");autos[fid].highlightedSuggestionIndex=0;highlightNewValue(fid,0);}return false;}else{if(_15==34){if(_19.style.visibility=="visible"){setStyleForElement(autos[fid].highlightedSuggestionDiv,"1");autos[fid].highlightedSuggestionIndex=autos[fid].rows-1;highlightNewValue(fid,autos[fid].rows-1);}return false;}else{if(_15==40){if(_19.style.visibility=="visible"){highlightNewValue(fid,_18+1);return false;}}else{if(_15==38){if(_19.style.visibility=="visible"){highlightNewValue(fid,_18-1);return false;}}else{if(_15==13||_15==3){if(_15==13){enter=true;return submitHandlerIncr1(fid);}return false;}}}}}if(keycode!=0){ForEachKeyPressed(_17,fid);}return true;}function highlightNewValue(fid,C){autos[fid].currentInputFieldValue=autos[fid].partialquery;if(!autos[fid].rowDivList){return;}ShowDiv(fid);if(C>=autos[fid].rows){if(autos[fid].dir=="up"){C=autos[fid].rows;}else{C=autos[fid].rows-1;autos[fid].highlightedSuggestionDiv=autos[fid].rowDivList.item(C);}}if(C<0){if(autos[fid].dir=="up"){C=0;autos[fid].highlightedSuggestionDiv=autos[fid].rowDivList.item(C);}else{C=-1;autos[fid].highlightedSuggestionIndex=-1;autos[fid].highlightedSuggestionDiv=null;setStyleForElement(autos[fid].rowDivList.item(0),"1");}}if(autos[fid].highlightedSuggestionIndex!=-1&&C!=autos[fid].highlightedSuggestionIndex){setStyleForElement(autos[fid].highlightedSuggestionDiv,"1");autos[fid].highlightedSuggestionIndex=-1;}if(C>=0){autos[fid].highlightedSuggestionIndex=C;autos[fid].highlightedSuggestionDiv=autos[fid].rowDivList.item(C);setStyleForElement(autos[fid].highlightedSuggestionDiv,"0");currentInputFieldValue=autos[fid].partialquery;var q=valueOfAutodiv(autos[fid].highlightedSuggestionDiv);autos[fid].currentTopic=autos[fid].topics[C];autos[fid].currentTitle=autos[fid].topicTitles[C];autos[fid].currentType=autos[fid].types[C];}else{autos[fid].currentTopic="";autos[fid].currentTitle="";autos[fid].currentType="";}}function ForEachKeyPressed(_1d,fid){var _1f=autos[fid].inputfield;var _20=autos[fid].autoid;var _21=document.getElementById(_20);var _22=autos[fid].highlightedSuggestionIndex;var J=_21.getElementsByTagName("LI");var _24=J.length;autos[fid].rows=_24;autos[fid].rowDivList=J;autos[fid].partialquery=_1d;autos[fid].currentTopic="";autos[fid].currentTitle="";autos[fid].currentType="";var s=_1f.value;if(s==""||_24==0||keycode==27||s.search(/\S/)==-1||(_21.style.visibility=="hidden"&&(keycode==35||keycode==36))){HideDiv(fid);}for(var f=0;f<_24;f++){setStyleForElement(J.item(f),"1");}var _27=autos[fid].highlightedSuggestionDiv;var _28=false;switch(autos[fid].keycode){case 8:case 33:case 34:case 35:case 36:case 37:case 39:case 45:case 46:_28=true;break;default:break;}if(!_28&&_27){setStyleForElement(_27,"0");var z;z=valueOfAutodiv(_27);if(z!=_1f.value){if(_1f.value!=_1d){return;}}}else{_22=-1;}}function valueOfAutodiv(i){if(!i){return null;}return findSpanValueForClass(i,"5");}function findSpanValueForClass(i,dc){var ga=i.getElementsByTagName("span");if(ga){for(var f=0;f<ga.length;++f){if(ga[f].className==dc){var _2f=ga[f].innerHTML;if(_2f=="&nbsp;"){return "";}else{var z=stripCRFromString(_2f);return z;}}}}else{return "";}}function stripCRFromString(va){for(var f=0,oa="",zb="\n\r";f<va.length;f++){if(zb.indexOf(va.charAt(f))==-1){oa+=va.charAt(f);}else{oa+=" ";}}return oa;}function submitHandlerIncr1(fid,_36,ts){if(autos[fid].autoid){var _38=document.getElementById(autos[fid].autoid);if(_38.style.visibility=="visible"){var _39=autos[fid].highlightedSuggestionIndex;if(autos[fid].currentTopic||_39==autos[fid].topicTitles.length||_39==(autos[fid].topicTitles.length+1)){setLocation(fid,_36,ts);}else{if(checkSubmit(autos[fid].thisform)){return autos[fid].thisform.submit();}}setTimeout("HideDiv('"+fid+"')",300);return false;}else{HideDiv(fid);if(checkSubmit(autos[fid].thisform)){return autos[fid].thisform.submit();}}}else{if(checkSubmit(autos[fid].thisform)){return autos[fid].thisform.submit();}}}function setLocation(fid,_3b,ts){if(location.search.indexOf("gwp=13")>-1||location.search.indexOf("ff=1")>-1){if(_3b){_3b+="&ff=1";}else{_3b="ff=1";}}var _3d=autos[fid].highlightedSuggestionIndex;var _3e="";var val=getSelectedRadio("lookup1","searchType");switch(val){case "wa":_3e="QandA";break;case "all":_3e="all";break;case "ra":default:_3e="RefA";break;}var _40=(autos[fid].currentType==SW_RESULT_TYPE_RA?"RA":"WA");if(_3d==autos[fid].topicTitles.length){_40="SearchWeb";var url=rahost+"/main/Record?a="+aLoc+"Search&url="+encodeURIComponent("/"+autos[fid].partialquery+"?web.x=1"+(_3b?"&"+_3b:""));setTimeout("window.location='"+url+"'",300);return;}if(_3d==(autos[fid].topicTitles.length+1)){_40="Shop";url=rahost+"/main/Record?a="+aLoc+"Shop&url="+encodeURIComponent("/"+autos[fid].partialquery+"?shop.x=1"+(_3b?"&"+_3b:""));setTimeout("window.location='"+url+"'",300);return;}autos[fid].inputfield.value=autos[fid].currentTitle;assignParam("navinfo","method|22");if(_3b&&(_3b.indexOf("web.x")>-1||_3b.indexOf("shop.x")>-1)){window.location.href="/"+encodeURIComponent(autos[fid].currentTitle)+(_3b?"?"+_3b:"");}else{var _42,_43;if(autos[fid].currentType==SW_RESULT_TYPE_RA){_42=rahost+"/topic/";_43="RA";}else{var _44=(wahost?wahost:("http://"+location.host));_42=_44+"/Q/";_43="WA";}url=_42+autos[fid].currentTopic+(_3b?"?"+_3b:"");url=rahost+"/main/Record?a="+aLoc+_43+"&url="+encodeURIComponent(url);window.location.href=url;}}function trackWSS(_45,_46){cv=_hbEvent("cv");_hbSet("cv.c15",_45+"|"+_46);_hbLink("FAYT");}function goToUrl(url){window.location.href=url;}if(wikiAnswers){function assignParam(a,b){}}function SendQuery(fid){tid=0;var _4b=autos[fid].autoid;var s=autos[fid].inputfield;var _4d=s.value;if(_4d.length!=0&&_4d.search(/\S/)!=-1){var _4e=resultCache[_4d];if(_4e){ShowDiv(_4b);anis_startswithResult(_4d,_4e[0],_4e[1],_4e[2],_4e[3],fid);}else{var url=httpBaseURL+"/"+startswithServlet+"?s="+encodeURIComponent(_4d)+"&type="+getSelectedRadio("lookup1","searchType");if(!wikiAnswers){if(req){req.abort();}req=(!window.XMLHttpRequest)?(ActiveXObject?(new ActiveXObject("Microsoft.XMLHTTP")):""):(new XMLHttpRequest());req.open("GET",url,true);req.onreadystatechange=new Function("Process('"+fid+"')");req.send(null);}else{url+="&output=fun";loadScript("anisJS",url);}}}else{HideDiv(fid);}}function loadScript(id,url){var _52=document.getElementById(id);var _53=document.getElementsByTagName("head")[0];var _54;_54=document.createElement("script");_54.type="text/javascript";_54.src=url;_54.id=id;if(_52){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){_52.src=url;}else{_53.replaceChild(_54,_52);}}else{_53.appendChild(_54);}return false;}function Process(fid){if(req.readyState==4){try{if(req.status==200){if(req.responseText==""){HideDiv(fid);}else{eval("anis_startswithResult("+req.responseText+"\""+fid+"\");");}}}catch(e){}}}function ShowDiv(fid){if(autos[fid]){HideRelatedAds();SuppressFlash(fid);document.getElementById(autos[fid].autoid).style.visibility="visible";hideGoButtonMenu();showHideSelects(fid,false);}}function HideDiv(fid){if(autos[fid]){document.getElementById(autos[fid].autoid).style.visibility="hidden";RestoreFlash();showHideSelects(fid,true);ShowRelatedAds();}}function onBlurHandler(fid,evt){if(!evt&&window.event){evt=window.event;}setTimeout("HideDiv('"+fid+"')",300);}anis_startswithResult=function(_5a,_5b,_5c,_5d,_5e,fid){if(fid==null){fid="lookup1";}resultCache[_5a]=new Array(_5b,_5c,_5d,_5e);autos[fid].topics=_5d;autos[fid].topicTitles=_5b;autos[fid].partialquery=_5a;autos[fid].types=_5e;if(_5b.length==0){autos[fid].rows=0;autos[fid].rowDivList=null;}ShowDiv(fid);if(autos[fid].dir=="up"){autos[fid].highlightedSuggestionIndex=_5b.length+2;}else{autos[fid].highlightedSuggestionIndex=-1;}displayFoundList(_5b,_5c,fid,_5e);ForEachKeyPressed(_5a,fid);};startswithResult=anis_startswithResult;function displayFoundList(_60,_61,fid,_63){if(typeof staticFileHost=="undefined"){staticFileHost="";}var _64=autos[fid].autoid;var _65=document.getElementById(_64);var s=autos[fid].inputfield;var _67=s.value;if(_67!=null){_67=_67.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;");}while(_65.childNodes.length>0){_65.removeChild(_65.childNodes[0]);}var su=document.createElement("SPAN");setStyleForElement(su,"1");var _69=document.createElement("SPAN");setStyleForElement(_69,"2");var _6a=document.createElement("SPAN");_6a.innerHTML="<b>Choose a suggestion...</b>";setStyleForElement(_6a,"7");var _6b=document.createElement("SPAN");var url=httpBaseURL+"/transoptform?method=22";_6b.innerHTML="<A  onClick=\"assignParam('navinfo','method|22');\" href="+url+"> Hide Suggestions</A>";setStyleForElement(_6b,"6");su.displaySpan=_6b;_69.appendChild(_6b);_69.appendChild(_6a);su.appendChild(_69);_65.appendChild(su);var pp=document.createElement("DIV");var mm=document.createElement("UL");mm.style.marginLeft="0px";var _6f=staticFileHost+"/images/RA/SmallBookIcon.png";var _70=staticFileHost+"/images/RA/SmallQuestionIcon.png";if(wikiAnswers){_6f=staticFileHost+"/main/images/RA/SmallBookIcon.png";_70=staticFileHost+"/main/images/RA/SmallQuestionIcon.png";}currentfid=fid;for(var f=0;f<_60.length+2;++f){var ac=document.createElement("ACRONYM");var u=document.createElement("LI");if(_63[f]=="1"){ac.title="Community Q&A";}else{ac.title="Reference Topic";}u.style.listStyleType="none";u.style.listStylePosition="outside";ac.appendChild(u);var _74=document.createElement("img");if(_63[f]=="1"){_74.src=_70;}else{_74.src=_6f;}_74.style.verticalAlign="bottom";_74.style.position="relative";_74.style.marginRight="5px";if(f<_60.length){u.appendChild(_74);}var ua=document.createElement("SPAN");u.displaySpan=ua;if(typeof (document.addEventListener)!="undefined"){u.addEventListener("mousedown",mdown,false);}else{u.onmousedown=mdown;}if(f==_60.length||f==_60.length+1){var _76="";ac.title="";setStyleForElement(u,"9");if(location.search.indexOf("gwp=13")>-1||location.search.indexOf("ff=1")>-1){_76="&ff=1";}if(f==_60.length){ua.innerHTML="<span ><A style='color:black;font-size:12px;"+(isIE?"margin-left:10px;":"")+"' rel='nofollow' href='javascript:void(0);'> Search Web for <B>"+_67+"</B></A></span>";u.style.listStyleImage="";}if(f==(_60.length+1)){ua.innerHTML="<span><A style='font-size:12px;"+(isIE?"margin-left:10px;":"")+"' id='shop_fayt' rel='nofollow' href='javascript:void(0);'> Shop for <B>"+_67+"</B></A></span>";u.style.listStyleImage="";}}else{setStyleForElement(u,"1");var _77=_60[f];var _78="";if(_61[f].length>0){if(_61[f].charAt(0)!="("&&_61[f].charAt(_61[f].length-1)!=")"){_61[f]="("+_61[f]+")";}_78=" <span style='text-decoration:none;color:black;font-size:12px;'>"+_61[f]+"</span>";}ua.innerHTML="<span style='color:#003399;font-size:12px;text-decoration:underline;'>"+_77+"</span>"+_78;}u.appendChild(ua);u.onmouseover=new Function("mover('"+fid+"',"+f+")");u.onmouseout=new Function("mout('"+fid+"')");mm.appendChild(ac);}var _79=document.createElement("DIV");_79.innerHTML="<b>...or finish typing and press Enter.</b>";setStyleForElement(_79,"8");pp.appendChild(mm);pp.appendChild(_79);_65.appendChild(pp);}var mdown=function(_7a){if(isLeftButton(_7a)){setLocation(currentfid,"");}};var mover=function(fid,_7c){if(autos[fid].highlightedSuggestionIndex!=-1&&_7c!=autos[fid].highlightedSuggestionIndex){setStyleForElement(autos[fid].highlightedSuggestionDiv,"1");autos[fid].highlightedSuggestionIndex=-1;}var _7d=autos[fid].autoid;var _7e=document.getElementById(_7d);var J=_7e.getElementsByTagName("LI");autos[fid].highlightedSuggestionIndex=_7c;autos[fid].rowDivList=J;autos[fid].highlightedSuggestionDiv=autos[fid].rowDivList.item(_7c);autos[fid].currentTopic=autos[fid].topics[_7c];autos[fid].currentTitle=autos[fid].topicTitles[_7c];autos[fid].currentType=autos[fid].types[_7c];setStyleForElement(autos[fid].highlightedSuggestionDiv,"0");};var mout=function(fid){autos[fid].currentTopic="";autos[fid].currentTitle="";autos[fid].currentType="";autos[fid].highlightedSuggestionIndex=-1;setStyleForElement(autos[fid].highlightedSuggestionDiv,"1");};function setStyleForElement(c,_82){if(c!=null&&typeof (c)!="undefined"){c.className=_82;switch(_82.charAt(0)){case "0":c.style.backgroundColor="#3366cc";c.style.color="black";c.style.cursor="pointer";if(c.displaySpan){var _83=c.displaySpan.getElementsByTagName("span");var _84=c.displaySpan.getElementsByTagName("a");if(_83.item(0)){_83.item(0).style.color="white";}if(_83.item(1)){_83.item(1).style.color="white";}if(_84.item(0)){_84.item(0).style.color="white";}}break;case "1":c.style.backgroundColor="white";c.style.color="black";if(c.displaySpan){var _83=c.displaySpan.getElementsByTagName("span");var _84=c.displaySpan.getElementsByTagName("a");if(_83.item(0)){_83.item(0).style.color="#003399";}if(_83.item(1)){_83.item(1).style.color="black";}if(_84.item(0)){if(_84.item(0).id=="shop_fayt"){_84.item(0).style.color="#6E0902";}else{_84.item(0).style.color="black";}}}break;case "2":c.style.display="block";c.style.paddingRight="3";c.style.height="15px";c.style.overflow="hidden";break;case "6":c.style.styleFloat="right";c.style.cssFloat="right";c.style.width=40+"%";c.style.fontSize="11px";c.style.textAlign="right";c.style.whiteSpace="nowrap";break;case "7":c.style.width=60+"%";c.style.cssFloat="left";c.style.textAlign="left";c.style.fontSize="11px";c.style.whiteSpace="nowrap";break;case "8":c.style.textAlign="right";c.style.whiteSpace="nowrap";c.style.fontSize="11px";break;case "9":c.style.color="black";c.style.listStyle="none";break;}if(screen.width<=800){c.style.fontSize="8px";c.style.Height="auto";}}}function showHideSelects(fid,_86){var _87=document.getElementsByTagName("SELECT");var _88=document.getElementById(autos[fid].autoid);for(var i=0;i<_87.length;i++){if(ObjectOverlap(_88,_87[i],autodivMaxHeight)||_87[i].id=="menu"||_87[i].id=="topic"||_87[i].id=="categories"){goMenu=document.getElementById("lookupMenuHeader");if(goMenu&&goMenu.style.display=="block"){goShown=true;}else{goShown=false;}_87[i].style.visibility=(_86==true&&!goShown?"visible":"hidden");}}}function ObjectOverlap(_8a,_8b,_8c){var _8d=getLeft(_8a);var _8e=getTop(_8a);var _8f=getLeft(_8a)+_8a.offsetWidth;var _90=getTop(_8a)+_8a.offsetHeight;if(_90<_8c){_90=_8c;}var _91=getLeft(_8b);var _92=getTop(_8b);var _93=getLeft(_8b)+_8b.offsetWidth;var _94=getTop(_8b)+_8b.offsetHeight;var _95=(_8d<_93&&_91<_8f);var _96=(_8e<_94&&_92<_90);return (_95&&_96);}function getObjLeft(_97){return (_97.offsetParent?(getObjLeft(_97.offsetParent)+_97.offsetLeft):_97.offsetLeft);}function getObjTop(_98){return (_98.offsetParent?(getObjTop(_98.offsetParent)+_98.offsetTop):_98.offsetTop);}function getLeft(_99){return (getObjLeft(_99));}function getTop(_9a){return (getObjTop(_9a));}function isSendKey(_9b){var _9c=true;switch(_9b){case 10:case 11:case 12:case 13:case 27:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 45:_9c=false;break;default:break;}return _9c;}function isShowKey(_9d){if(_9d==40||_9d==38||_9d==33||_9d==34||_9d==13){return false;}else{return true;}}function isCtrlKey(_9e){if(_9e==16||_9e==17||_9e==18){return true;}else{return false;}}function isLeftButton(e){var _a0;if(!e){var e=window.event;}if(e.which){_a0=(e.which==1);}else{if(e.button){_a0=(e.button==0||e.button==1);}}return _a0;}function hideGoButtonMenu(){var _a1=document.getElementById("lookupMenuHeader");var _a2=document.getElementById("lookupMenuFooter");if(_a1){_a1.style.display="none";}if(_a2){_a2.style.display="none";}}function SuppressFlash(fid){var _a4=document.getElementsByTagName("EMBED");var _a5=document.getElementById(autos[fid].autoid);for(var i=0;i<_a4.length;i++){if(_a4[i].balloonMember!="true"){if(_a4[i].style.visibility=="visible"||_a4[i].style.visibility==""){if(ObjectOverlap(_a5,_a4[i],autodivMaxHeight)){var _a7=_a4[i].getAttribute("wmode");if(_a7==null||_a7=="undefined"){_a7="window";}else{_a7=_a7.toLowerCase();}if(_a7=="window"){_a4[i].style.visibility="hidden";_a4[i].baloonHidden=true;}}}}}_a4=document.getElementsByTagName("OBJECT");for(var i=0;i<_a4.length;i++){if(_a4[i].balloonMember!="true"){if(_a4[i].style.visibility=="visible"||_a4[i].style.visibility==""){if(ObjectOverlap(_a5,_a4[i],autodivMaxHeight)){var _a7=_a4[i].getAttribute("wmode");if(_a7==null||_a7=="undefined"){_a7="window";}else{_a7=_a7.toLowerCase();}if(_a7=="window"){_a4[i].style.visibility="hidden";_a4[i].baloonHidden=true;}}}}}}function RestoreFlash(){var _a8=document.getElementsByTagName("EMBED");for(var i=0;i<_a8.length;i++){if(_a8[i].baloonHidden){_a8[i].style.visibility="visible";_a8[i].baloonHidden=false;}}_a8=document.getElementsByTagName("OBJECT");for(var i=0;i<_a8.length;i++){if(_a8[i].baloonHidden){_a8[i].style.visibility="visible";_a8[i].baloonHidden=false;}}}function HideRelatedAds(){var _aa=document.getElementById("top_radlinks");if(_aa!=null&&_aa!="undefined"){_aa.style.visibility="hidden";}}function ShowRelatedAds(){var _ab=document.getElementById("top_radlinks");if(_ab!=null&&_ab!="undefined"){_ab.style.visibility="visible";}}