/************************************************************************************************************ (C) www.dhtmlgoodies.com, April 2006 This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website. Terms of use: You are free to use this script as long as the copyright message is kept intact. However, you may not redistribute, sell or repost it without our permission. Thank you! www.dhtmlgoodies.com Alf Magne Kalleland ************************************************************************************************************/ var ajaxBox_offsetX = 0; var ajaxBox_offsetY = 0; var ajax_list_externalFile_hire = 'index.php?method=hiresearch'; // Path to external file var minimumLettersBeforeLookup = 2; // Number of letters entered before a lookup is performed. var ajax_list_objects_hire = new Array(); var ajax_list_cachedLists_hire = new Array(); var ajax_list_activeInput_hire = false; var ajax_list_activeItem_hire = null; var ajax_list_optionDivFirstItem_hire = false; var ajax_list_currentLetters_hire = new Array(); var ajax_optionDiv_hire = false; var ajax_optionDiv_hire_iframe = false; var ajax_list_MSIE = false; if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)ajax_list_MSIE=true; var currentListIndex = 0; function ajax_getTopPos_hire(inputObj) { var returnValue = inputObj.offsetTop; while((inputObj = inputObj.offsetParent) != null){ returnValue += inputObj.offsetTop; } return returnValue; } function ajax_list_cancelEvent() { return false; } function ajax_getLeftPos(inputObj) { var returnValue = inputObj.offsetLeft; while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft; return returnValue; } function ajax_option_setValue_hire(e,inputObj) { if(!inputObj)inputObj=this; //var tmpValue = inputObj.innerHTML; // if(ajax_list_MSIE) // tmpValue = inputObj.innerText; // else // tmpValue = inputObj.textContent; // if(!tmpValue) // tmpValue = inputObj.innerHTML; // All above lines commented out by Greg for VI - so we can have detail alongside the model, we put the model into the DIV title // otherwise just getting the DIVs innerHTML will return the model AND the description - which is useless! var tmpValue = inputObj.title; ajax_list_activeInput_hire.value = tmpValue; if(document.getElementById(ajax_list_activeInput_hire.name + '_hidden')) document.getElementById(ajax_list_activeInput_hire.name + '_hidden').value = inputObj.id; ajax_options_hide_hire(); //alert(document.getElementById("hireSearch").value); //document.hireSearch.submit(); if(document.getElementById("search_hire_1")&&(document.getElementById("search_hire_1").value!=''&&document.getElementById("search_hire_1").value!='Rental Product Search'))document.getElementById("hireSearch_1").submit(); if(document.getElementById("search_hire_2")&&(document.getElementById("search_hire_2").value!=''&&document.getElementById("search_hire_2").value!='Rental Product Search'))document.getElementById("hireSearch_2").submit(); } function ajax_options_hide_hire() { if(ajax_optionDiv_hire) ajax_optionDiv_hire.style.display='none'; if(ajax_optionDiv_hire_iframe) ajax_optionDiv_hire_iframe.style.display='none'; } function ajax_options_rollOverActiveItem_hire(item,fromKeyBoard) { if(ajax_list_activeItem_hire) ajax_list_activeItem_hire.className='optionDiv'; item.className='optionDivSelected'; ajax_list_activeItem_hire = item; if(fromKeyBoard){ if(ajax_list_activeItem_hire.offsetTop>ajax_optionDiv_hire.offsetHeight){ ajax_optionDiv_hire.scrollTop = ajax_list_activeItem_hire.offsetTop - ajax_optionDiv_hire.offsetHeight + ajax_list_activeItem_hire.offsetHeight + 2 ; } if(ajax_list_activeItem_hire.offsetTop"; div.title = descriptions[0]; //ADDED BY GREG FOR VI OTHERWISE WHEN WE SELECT THE ITEM, IT TAKES THE MODEL *AND* DESCRIPTION //ALSO HAD TO MAKE CHANGES IN ajax_option_setValue_hire div.id = items[0]; div.className='optionDiv'; div.onmouseover = function(){ ajax_options_rollOverActiveItem_hire(this,false) } div.onclick = ajax_option_setValue_hire; if(!ajax_list_optionDivFirstItem_hire) ajax_list_optionDivFirstItem_hire = div; ajax_optionDiv_hire.appendChild(div); } if(optionsAdded){ ajax_optionDiv_hire.style.display='block'; if(ajax_optionDiv_hire_iframe) ajax_optionDiv_hire_iframe.style.display=''; //************************************************next line commented by Greg //ajax_options_rollOverActiveItem_hire(ajax_list_optionDivFirstItem_hire,true); } } function ajax_option_list_showContent_hire(ajaxIndex,inputObj,paramToExternalFile,whichIndex) { if(whichIndex!=currentListIndex)return; var letters = inputObj.value; var content = ajax_list_objects_hire[ajaxIndex].response; var elements = content.split('|'); ajax_list_cachedLists_hire[paramToExternalFile][letters.toLowerCase()] = elements; ajax_option_list_buildList_hire(letters,paramToExternalFile); } function ajax_option_resize_hire(inputObj) { ajax_optionDiv_hire.style.top = (ajax_getTopPos_hire(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY) + 'px'; ajax_optionDiv_hire.style.left = (ajax_getLeftPos(inputObj) + ajaxBox_offsetX) + 'px'; if(ajax_optionDiv_hire_iframe){ ajax_optionDiv_hire_iframe.style.left = ajax_optionDiv_hire.style.left; ajax_optionDiv_hire_iframe.style.top = ajax_optionDiv_hire.style.top; } } function ajax_showOptions_hire(inputObj,paramToExternalFile,e,boxw) //boxw added by Greg for VI { if (boxw=='undefined') boxw=0; if(e.keyCode==13 || e.keyCode==9)return; if(ajax_list_currentLetters_hire[inputObj.name]==inputObj.value)return; if(!ajax_list_cachedLists_hire[paramToExternalFile])ajax_list_cachedLists_hire[paramToExternalFile] = new Array(); ajax_list_currentLetters_hire[inputObj.name] = inputObj.value; if(!ajax_optionDiv_hire){ ajax_optionDiv_hire = document.createElement('DIV'); ajax_optionDiv_hire.id = 'ajax_listOfOptions'; document.body.appendChild(ajax_optionDiv_hire); if(ajax_list_MSIE){ ajax_optionDiv_hire_iframe = document.createElement('IFRAME'); ajax_optionDiv_hire_iframe.border='0'; ajax_optionDiv_hire_iframe.style.width = ajax_optionDiv_hire.clientWidth + 'px'; ajax_optionDiv_hire_iframe.style.height = ajax_optionDiv_hire.clientHeight + 'px'; ajax_optionDiv_hire_iframe.id = 'ajax_listOfOptions_iframe'; document.body.appendChild(ajax_optionDiv_hire_iframe); } var allInputs = document.getElementsByTagName('INPUT'); for(var no=0;no