gObjCountries = "CountriesList"; gObjRetCountries = "CountriesList"; gObjTopLoc = "TopList"; gObjSTAList = "StationsSTAList"; gObjILCList = "StationsILCList"; gObjCarList = "CarGroupsList"; gObjCarTypeList = "GRPTypeList"; iFrameDivID = "DropdownIFrame"; dropdownDivID = "Dropdown"; scrollDivID = "Scroll"; gSelected = ""; function setSelectedIntoDiv(pThis, pWhere) { document.getElementById(pWhere).innerHTML = pThis.innerHTML; document.getElementById(pWhere).setAttribute('valueSelected', pThis.id); CloseDropdown(); switch( pWhere ) { case 'Country': // run AJAX to display stations var selectedCTR = document.getElementById(pWhere); var xCTR = selectedCTR.getAttribute('valueSelected'); if( selectedCTR && (selectedCTR.getAttribute('valueSelected') != '') ) { toogleCarTypeList( selectedCTR.getAttribute('valueSelected') ); getAJAXData( 'toggleLocations', gStationsURL + "/AjaxWebService?OpenAgent&SOURCE=QB&RAN=" + Math.random() + "&F=getLocationsPerCountry&MST=" + gMST + '&MSTPATH=' + gMstPath + gAgentParam, xCTR, 'STAList'); getAJAXData( 'toggleCarGroups', gFleetURL + "/AjaxWebService?OpenAgent&RAN=" + Math.random() + "&F=getCarGroupsPerCountry&MST=" + gMST + '&MSTPATH=' + gMstPath + gAgentParam, xCTR, 'GRP1'); readRemoteData( gStationsURL+ "/AjaxWebService?OpenAgent&RAN=" + Math.random() + "&F=getSEPerCountryAndLocation&MST=" + gMST + '&MSTPATH=' + gMstPath + '&AWD=' + gAWD + '&SEDEFAULT=' + gDefaultSE + gAgentParam + xCTR + '&STA=' , '' , 'ExtrasLine'); // delete opening hours from div removeStationInformation('ETA'); removeStationInformation('ETT'); } break; case 'RetCountry': // run AJAX to display return stations var selectedCTR = document.getElementById(pWhere); var xCTR = selectedCTR.getAttribute('valueSelected'); if( selectedCTR && (selectedCTR.getAttribute('valueSelected') != '') ) { getAJAXData( 'toggleLocations', gStationsURL + "/AjaxWebService?OpenAgent&SOURCE=QB&RAN=" + Math.random() + "&F=getLocationsPerCountry&MST=" + gMST + '&MSTPATH=' + gMstPath + '&TARGET=ILC' + '&SEDEFAULT=' + gDefaultSE + gAgentParam, xCTR, 'ILCList'); // delete opening hours from div removeStationInformation('ETT'); } break; case 'TOP': // run AJAX to display car groups and Extras var selectedSTA = document.getElementById(pWhere); if( selectedSTA && (selectedSTA.getAttribute('valueSelected') != '') ) { var xCTR = selectedSTA.getAttribute('valueSelected').split('-')[1] var xSTA = selectedSTA.getAttribute('valueSelected').split('-')[0] getAJAXData( 'toggleCarGroups', gFleetURL + "/AjaxWebService?OpenAgent&RAN=" + Math.random() + "&F=getCarGroupsPerCountry&MST=" + gMST + '&MSTPATH=' + gMstPath + gAgentParam, xCTR , 'GRP1'); readRemoteData( gStationsURL+ "/AjaxWebService?OpenAgent&RAN=" + Math.random() + "&F=getSEPerCountryAndLocation&MST=" + gMST + '&MSTPATH=' + gMstPath + '&AWD=' + gAWD + '&SEDEFAULT=' + gDefaultSE + gAgentParam + xCTR + '&STA=' + xSTA, '' , 'ExtrasLine'); } break; case 'STA': // run AJAX to display opening hours var selectedSTA = document.getElementById(pWhere); var selectedCTR = document.getElementById('Country'); if( selectedSTA && (selectedSTA.getAttribute('valueSelected') != '') ) { xSTA = selectedSTA.getAttribute('valueSelected'); xCTR = selectedCTR.getAttribute('valueSelected'); getAJAXData('toggleOpeningHours', gStationsURL + "/AjaxWebService?OpenAgent&RAN=" + Math.random() + gAgentParam + "&F=getOpeningHoursPerLocation&STA=", selectedSTA.getAttribute('valueSelected'), 'openingHoursPickup'); selectReturnLocation( selectedSTA, gStationsURL + "/AjaxWebService?OpenAgent&RAN=" + Math.random() + gAgentParam + "&F=getOpeningHoursPerLocation&STA=" ); readRemoteData( gStationsURL+ "/AjaxWebService?OpenAgent&RAN=" + Math.random() + "&F=getSEPerCountryAndLocation&MST=" + gMST + '&MSTPATH='+ gMstPath + '&AWD=' + gAWD + '&SEDEFAULT=' + gDefaultSE + gAgentParam + xCTR + '&STA=' + xSTA, '' , 'ExtrasLine'); } break; case 'ILC': // run AJAX to display opening hours var selectedILC = document.getElementById(pWhere); if( selectedILC && (selectedILC.getAttribute('valueSelected') != '') ) { getAJAXData('toggleOpeningHours', gStationsURL + "/AjaxWebService?OpenAgent&RAN=" + Math.random() + gAgentParam + "&F=getOpeningHoursPerLocation&STA=", selectedILC.getAttribute('valueSelected'), 'openingHoursReturn'); ReturnLocationFixed=true; } break; default: break; } } function CreateDivDropdown(xObjectName, xSection, xGetValuesFromField) { var BelowObject = document.getElementById(xSection); gSelected = xObjectName; document.onmousedown = CloseIfClickOutsideDropdown; displayDropdown(xObjectName, BelowObject, xGetValuesFromField); } function CloseIfClickOutsideDropdown(e) { var eventbutton = (navigator.appName == "Netscape") ? e.which : event.button; if (eventbutton>0) { // check to see if the div exists var dropdownDiv = document.getElementById( dropdownDivID + gSelected ); var scrollDiv = document.getElementById(scrollDivID + gSelected ); if (scrollDiv && dropdownDiv) { var dp_mouseX = 0; var dp_mouseY = 0; if (e != '') //if (document.layers) if (navigator.appName == "Netscape") { dp_mouseX = e.pageX; dp_mouseY = e.pageY; } else { dp_mouseX = event.x; dp_mouseY = event.y + document.body.scrollTop; } var dp_posX = 0; var dp_posY = 0; var dp_Height = 0; var dp_Width = 0; dp_posX = parseInt(dropdownDiv.style.left); dp_posY = parseInt(dropdownDiv.style.top); dp_Width = parseInt(scrollDiv.offsetWidth); dp_Height = parseInt(scrollDiv.offsetHeight); // Checking that the clik is if ( (dp_mouseX < dp_posX || dp_mouseX > (dp_posX + dp_Width)) ||(dp_mouseY < dp_posY || dp_mouseY > (dp_posY + dp_Height)) ) CloseDropdown(); } } } function CloseDropdown() { var dropdownDiv = document.getElementById( dropdownDivID + gSelected ); if (dropdownDiv) { document.onmousedown = null; dropdownDiv.style.visibility = "hidden"; dropdownDiv.style.display = "none"; var iFrameDiv = document.getElementById( iFrameDivID + gSelected ); if (iFrameDiv) try { iFrameDiv.style.visibility = dropdownDiv.style.visibility; iFrameDiv.style.display = dropdownDiv.style.display; } catch(e) { } } gSelected = ""; } // ============ DISPLAY ======================= function displayDropdown(pObjectName, displayBelowObject, pGetValuesFromField) { var x = displayBelowObject.offsetLeft; var y = displayBelowObject.offsetTop + displayBelowObject.offsetHeight; var parent = displayBelowObject; while (parent.offsetParent) { parent = parent.offsetParent; x += parent.offsetLeft; y += parent.offsetTop ; } drawDropdown(pObjectName, x, y, pGetValuesFromField); } //============= DRAW ========================= function drawDropdown(pObjectName, x, y, pGetValuesFromField) { var CompleteDropdownID = dropdownDivID + pObjectName; if (!document.getElementById(CompleteDropdownID)) { var newNode = document.createElement("div"); newNode.setAttribute("id", CompleteDropdownID); newNode.setAttribute("class", "dropdownDiv"); newNode.setAttribute("style", "visibility: hidden;"); document.body.appendChild(newNode); } var dropdownDiv = document.getElementById(CompleteDropdownID); dropdownDiv.style.position = "absolute"; dropdownDiv.style.left = x - 1 + "px"; dropdownDiv.style.top = y + 1 + "px"; dropdownDiv.style.visibility = (dropdownDiv.style.visibility == "visible" ? "hidden" : "visible"); dropdownDiv.style.display = (dropdownDiv.style.display == "block" ? "none" : "block"); dropdownDiv.style.zIndex = 10000; refreshDropdown(pObjectName, CompleteDropdownID, pGetValuesFromField); } function refreshDropdown(pObjectName, pCompleteDropdownID, pGetValuesFromField) { var CompleteScrollID = scrollDivID + pObjectName; var DIV_1 = '
| "; var xDIV = ""; var xTABLE = " |