/* generated Sun Feb 12 20:40:47 EST 2012 */

var who;var ESC=27;var TAB=9;var ALT=18;var UP=38;var DOWN=40;var LEFT=37;var RIGHT=39;var ENTER=13;var SHIFT=16;var lastKey=0;function keyDown(c){var b=document.all?window.event.keyCode:c.which;var a=String.fromCharCode(b).toLowerCase();lastKey=b;if(who!=null){who(b,a)}}function keysInit(a){document.onkeydown=keyDown;who=a;if(document.layers){document.captureEvents(Event.KEYPRESS)}}function noEnter(){return lastKey!=ENTER}var _toolong,_lastsent,_timeout,_itemCount,_idletimer,_cursel,_target;var _prevsel;var _inputcode=null,_searchtype;var _targetBG;var _input=null;var _numChoices;var sbHttp=null;var _stop;var _chars=1;var _sboxminwidth;var _clientsbcb;var _sbcountrycode;var _kayakSmartUrl="/m/smarty?";var _forceSelection=true;var _forceSingle=false;var _sbextraargs="";function cancelSmartBox(){keysInit(null);if((_forceSelection||(_forceSingle&&_itemCount==1))&&_inputcode!=null&&_inputcode.value!=null&&_inputcode.value.length<1){_setValue(0)}abortSmartBox();closeSmartBox();_input=null;_stop=false}function abortSmartBox(){if(sbHttp!=null){if(sbHttp.inprogress){sbHttp.cancelRequest()}}}function closeSmartBox(){if(_target!=null){_target.style.display="none";_target.innerHTML=""}if(_targetBG!=null){_targetBG.style.display="none"}_stop=true}function initSmartBox(i,m,g,l,f,k,a,c,b,d){_inputcode=_input=null;if(c!=null){_forceSelection=c}else{_forceSelection=true}if(d!=null){_forceSingle=d}else{_forceSingle=false}if(a){_kayakSmartUrl=a}else{_kayakSmartUrl="/m/smarty?"}if(b){_sbextraargs=b}else{_sbextraargs=""}cancelSmartBox();var j=document.getElementsByTagName("body")[0];_target=document.getElementById("smartbox");if(!_target){_target=document.createElement("div");_target.id="smartbox";_target.style.zIndex=5001;_target.style.position="absolute";_target.style.display="none";_target.style.width="auto";j.appendChild(_target)}_target.className=g+"smartboxResults";_targetBG=document.getElementById("smartboxBG");if(!_targetBG){_targetBG=document.createElement("iframe");_targetBG.id="smartboxBG";_targetBG.style.zIndex=5000;_targetBG.setAttribute("scrolling","no");_targetBG.setAttribute("frameborder","0");_targetBG.style.position="absolute";_targetBG.style.display="none";j.appendChild(_targetBG)}try{i.setAttribute("autocomplete","off");i.setAttribute("autocapitalize","off");i.setAttribute("autocorrect","off")}catch(e){}if(isNaN(parseInt(f))){_sboxminwidth=-1}else{_sboxminwidth=parseInt(f)}keysInit(keypressed);_input=i;_inputcode=m;_searchtype=g;_lastsent="";_timeout=l;_clientsbcb=k;var h=jq(i).offset();_target.style.top=(h.top+i.offsetHeight+1)+"px";_target.style.left=h.left+"px";if(_idletimer){clearTimeout(_idletimer);_idletimer=""}_toolong=false;_lastsent="";_cursel=-1;_prevsel=-1;_stop=false}function _runSearch(a){if(_lastsent==_input.value||_input.value.length<_chars){return}window.status="searching...";_lastsent=_input.value;var b="where="+encodeURIComponent(_lastsent);b+="&lc=en&lc_cc=GB";if(_searchtype=="air"){b+="&s=1"}else{if(_searchtype=="car"){b+="&s=2"}else{if(_searchtype=="hotel"){b+="&s=3"}else{if(_searchtype=="any"){b+="&s=4"}else{if(_searchtype=="crc"){b+="&s=5"}else{if(_searchtype=="crcg"){b+="&s=6"}else{if(_searchtype=="deal"){b+="&s=7"}else{if(_searchtype=="crcga"){b+="&s=8"}else{if(_searchtype=="hotelname"){b+="&s=11"}else{b+="&s="+_searchtype}}}}}}}}}if(_sbcountrycode!=null&&_sbcountrycode.length>0){b+="&cc="+_sbcountrycode}b+="&f=h";b+=_sbextraargs;jq.post(_kayakSmartUrl,b,function(e){window.status="";if(_input==a){_target.innerHTML=e;var d=_getSmartboxList();if(d&&d.childNodes){_itemCount=d.childNodes.length}else{_itemCount=0}if(_itemCount>0){for(var c=0;c<d.childNodes.length;c++){li=d.childNodes[c];li.onmousedown=_sbMouseDown;li.onmouseover=_sbMouseOver;li.onmouseout=_sbMouseOut}_target.style.width="auto";_showChoices()}else{_hideChoices()}_cursel=(_forceSelection||(_forceSingle&&_itemCount==1)?0:-1);_prevsel=_cursel;selChoice(_cursel)}},"text")}function setSbCountryCode(a){_sbcountrycode=a}function clearSbCountryCode(){_sbcountrycode=null}function getSbIndex(e){var f=_getSmartboxList();var c=0;if(f&&f.childNodes){for(var b=0;b<f.childNodes.length;b++){var d=f.childNodes[b];if(e==d){c=b;break}var g=false;for(var a=0;a<d.childNodes.length;a++){if(e==d.childNodes[a]){c=b;g=true;break}}if(g){break}}}return c}function _sbMouseOut(a){var b=a?a.target:this;_cursel=-1;selChoice(-1)}function _sbMouseDown(a){var b=a?a.target:this;_cursel=getSbIndex(b);_setValue(_cursel);closeSmartBox()}function _sbMouseOver(a){var b=a?a.target:this;_cursel=getSbIndex(b);selChoice(_cursel)}function _showChoices(){_target.style.display="inline";if(_sbShowBGIframe()){_targetBG.style.display="inline"}if(_sboxminwidth>_target.offsetWidth){_targetBG.style.width=_sboxminwidth+"px";_target.style.width=_sboxminwidth+"px"}else{_targetBG.style.width=_target.offsetWidth+"px";_target.style.width=_target.offsetWidth+"px"}_targetBG.style.height=_target.offsetHeight+"px";_targetBG.style.top=_target.style.top;_targetBG.style.left=_target.style.left}function _hideChoices(){_target.style.display="none";_targetBG.style.display="none"}function _getSmartboxList(){var b;if(_target.childNodes){for(var a=0;a<_target.childNodes.length;a++){var c=_target.childNodes[a];if(c.nodeName=="UL"){b=c;break}}}return b}function _setValue(c){if(c<0){_lastsent="";try{var i=(_inputcode.value!="");_inputcode.value="";if(i){_clientsbcb(null)}}catch(g){}}else{if(_itemCount>0){var h=_getSmartboxList();if(h==null||h.childNodes==null){return}var d=h.childNodes[c];var f=d.id.split("-");var a;if(f.length>1){a=f[1]}_inputcode.value=a;if(d.innerText!=undefined){_input.value=d.innerText}else{_input.value=d.textContent}try{if(typeof _clientsbcb=="function"){var j=new Object();j.str=d.innerHTML;j.type=f[0];j.id=a;j.inputField=_input;j.inputCodeField=_inputcode;if(f.length>2){j.hc=f[2]}if(f.length>3){if(j.type=="hotel"){j.hid=f[3]}else{j.lmid=f[3]}}_clientsbcb(j)}}catch(b){}}}}function selChoice(a){var c=_getSmartboxList();if(c&&c.childNodes&&c.childNodes.length>0){if(_prevsel>=0){var b=c.childNodes[_prevsel];if(b.className){b.className=b.className.replace(/ *smartboxItemHi/,"")}else{b.className=""}}if(a>=0){if(c.childNodes.length>0){var d=c.childNodes[a];d.className=d.className+" smartboxItemHi"}_prevsel=a}}}var _pressed=0;function keypressed(a,b){clearTimeout(_idletimer);_pressed=new Date().getTime();switch(a){case LEFT:case UP:_cursel=_cursel-1;if(_cursel<0){_cursel=0}selChoice(_cursel);break;case RIGHT:case DOWN:_cursel++;if(_cursel>=_itemCount){_cursel=_itemCount-1}selChoice(_cursel);break;case ENTER:if(_itemCount>0){_setValue(_cursel);closeSmartBox()}break;case ESC:closeSmartBox();break;case TAB:if(_cursel>=0&&_cursel<_itemCount){_setValue(_cursel)}case ALT:case SHIFT:break;default:_setValue(-1);_idletimer=self.setTimeout("idle()",_timeout)}}function sbNoEnter(){var a=(_stop==null||_stop!=true);_stop=false;return(a?true:noEnter())}function idle(a){if(noEnter()){_input.focus();var b=new Date().getTime();if(b-_pressed>_timeout){clearTimeout(_idletimer);_typer(_input)}else{clearTimeout(_idletimer);_idletimer=self.setTimeout("idle()",_timeout)}}}function _typer(a){if((_input!=null)&&_input.value.length>0){abortSmartBox();_runSearch(a)}else{_setValue(-1);closeSmartBox()}}function _sbShowBGIframe(){return(window.opera)?false:true};

;var jsck_smartboxcore_en_gb="v428";
/* et=1, mt=4, c=p4, i=sparkle014, v=R114, cc=4, r=none */

