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 TABLE_main1 = ""; var TR = ""; var TD = "
"; var xDIV = ""; var xTABLE = "
"; var xTR = ""; var xTD = ""; var html = ''; html += DIV_1; html += TABLE_main1; html += getDropdownData(pGetValuesFromField); html += xTABLE; html += xDIV; document.getElementById(pCompleteDropdownID).innerHTML = html; adjustiFrame(pObjectName, pCompleteDropdownID, CompleteScrollID); } function getDropdownData(pGetValuesFromField) { var xAction = ' onClick="setSelectedIntoDiv(this, \'Country\');" onMouseOver="this.className=\'dropdownEntryHover\';" onMouseOut="this.className=\'dropdownEntry\';"'; var xAction1 = ' onClick="setSelectedIntoDiv(this, \'RetCountry\');" onMouseOver="this.className=\'dropdownEntryHover\';" onMouseOut="this.className=\'dropdownEntry\';"'; var xAction2 = ' onClick="setSelectedIntoDiv(this, \'TOP\');" onMouseOver="this.className=\'dropdownEntryHover\';" onMouseOut="this.className=\'dropdownEntry\';"'; var xAction3 = ' onClick="openAllLocations();" onMouseOver="this.className=\'dropdownEntryHover\';" onMouseOut="this.className=\'dropdownEntry\';"'; var entryList = new Array(); entryList = document.getElementById(pGetValuesFromField).value.split('#|#'); var html = ''; for( var i=0; i 2 && iMode != 'SILENT') { getAJAXData( 'toggleCarGroups', gFleetURL + "/AjaxWebService?OpenAgent&RAN=" + Math.random() + "&F=getCarGroupsPerCountry&MST=" + gMST + '&MSTPATH=' + gMstPath + gAgentParam, xCTR , 'GRP1'); getAJAXData( 'toggleLocations', gStationsURL + "/AjaxWebService?OpenAgent&SOURCE=QB&RAN=" + Math.random() + "&F=getLocationsPerCountry&MST=" + gMST + '&MSTPATH=' + gMstPath + gAgentParam, xCTR, 'STAList'); if( xSTA && xSTA.length > 2) readRemoteData( gStationsURL+ "/AjaxWebService?OpenAgent&RAN=" + Math.random() + "&F=getSEPerCountryAndLocation&MST=" + gMST + '&MSTPATH=' + gMstPath + '&AWD=' + gAWD + '&SEDEFAULT=' + gDefaultSE + gAgentParam + xCTR + '&STA=' + xSTA , '' , 'ExtrasLine'); } } function toggleReturnLocation( iElement , iCBEnabled) { if( iElement .value == '1' & iElement.checked == true) { gDivILC.style.display='block'; gRetLocEnabled = true; if( iCBEnabled == true) gDivRetCTR.style.display='block'; } else { gDivILC.style.display='none'; gRetLocEnabled = false; if( iCBEnabled == true) gDivRetCTR.style.display='none'; } } function cleanSESection( ) { var xEl = document.getElementById('ExtrasLine'); if( xEl ) xEl.innerHTML = ''; } function reloadSESection( ) { var xCTR = getDivValue('Country'); var xSTA = getDivValue( 'STA' ); xTopLocation = getDivValue( 'TOP' ); if( gTopLocationEnabled == true ){ xSTA= xTopLocation.substr(0,3); xCTR= xTopLocation.substr(4,7); } readRemoteData( gStationsURL+ "/AjaxWebService?OpenAgent&RAN=" + Math.random() + "&F=getSEPerCountryAndLocation&MST=" + gMST + '&MSTPATH=' + gMstPath + '&SEDEFAULT=' + gDefaultSE + gAgentParam + xCTR + '&AWD=' + gAWD + '&STA=' , xSTA , 'ExtrasLine'); } function openAllLocations( ) { var xEl = document.getElementById('LocationType2'); var xCountry = document.getElementById( 'Country'); if( xEl ) { xEl.checked = true; gDivTOP.style.display='none'; gDivCTR.style.display='block'; gDivSTA.style.display='block'; gDivTICKBOX.style.display='block'; gTopLocationEnabled = false; xCTR = xCountry.getAttribute('valueSelected'); if( xCTR.length > 2) getAJAXData( 'toggleCarGroups', gFleetURL + '/AjaxWebService?OpenAgent&RAN=' + Math.random() + gAgentParam + '&F=getCarGroupsPerCountry&MST=' + gMST + '&MSTPATH=' + gMstPath +'&COUNTRY=', xCTR, 'GRP1'); } CloseDropdown(); }