if (typeof languageCode == 'undefined') var languageCode = 'de'; if (typeof level == 'undefined') level = new Array(); if (typeof level[1] == 'undefined') level[1] = new Object(); if (typeof countryValue == 'undefined') countryValue = ''; var mainCounter = 0; var refreshLocations = new Array(); var getRegionRequest = new Array(); var getLocationRequest = new Array(); function refreshLocation(levelID, selectedValue, refresh) { locationChanged = true; if (!levelID) levelID = 1; if (typeof refresh == 'undefined') refresh = false; var levelValue = new Array(); /* changed needed request type */ if (refresh == false && document.getElementById('searchMethod')) document.getElementById('searchMethod').value = 'form'; for(i = 1; i <= 5; i++) { levelElement = "sfLevel" + i; if(document.getElementById(levelElement)) { levelValue[i] = document.getElementById(levelElement).value; if (i > levelID) document.getElementById(levelElement).selectedIndex = 0; } else if(document.all && document.all.levelElement) { levelValue[i] = document.levelElement.value; if (i > levelID) document.levelElement.selectedIndex = 0; } } if (level[levelID][selectedValue]) { var levelSelectOptions = document.getElementById("sfLevel" + levelID).options; levelSelectOptions.length = 0; for (var locationID in level[levelID][selectedValue]) { levelSelectOptions[levelSelectOptions.length] = new Option(level[levelID][selectedValue][locationID], locationID, false, (levelValue[levelID] == locationID) ? true : false); } } else { refreshQuery = getRefreshQuery(levelID); //dropped TO from scriptpath to avoid in portal source code, thomas var scriptpath = "/js/locationselects8.js.php?r=" + Math.floor(Math.random()*1000000) + "&" + refreshQuery + "&portal="; /* var htmlhead = document.getElementsByTagName("head")[0]; var script_id = "updatescript"; */ // abort old requests if new request is given if(typeof getLocationRequest['0'] != 'undefined') { getLocationRequest['0'].abort(); } if(typeof getRegionRequest['0'] != 'undefined') { getRegionRequest['0'].abort(); } getLocationRequest['0'] = jQuery.ajax({ url: scriptpath, dataType: "script", success:function(){ if(typeof isImageFilter != 'undefined') setImageCounts(locationImageCounts); } }); /* if(document.getElementById(script_id)) { htmlhead.removeChild(document.getElementById(script_id)); } var updatescript = document.createElement("script"); //updatescript.id = script_id; //updatescript.src = scriptpath; updatescript.setAttribute('id', script_id); updatescript.setAttribute('type', 'text/javascript'); updatescript.setAttribute('src', scriptpath); htmlhead.appendChild(updatescript); */ } } function getRefreshQuery(levelID) { if (!levelID) levelID = 1; var refreshQuery = "languageCode=" + languageCode; if (document.getElementById('sfCountry')) { countryValue = document.getElementById('sfCountry').value; } else if (document.all && document.all.sfCountry) { countryValue = document.sfCountry.value; } if (typeof countryValue != "undefined" && countryValue != '') refreshQuery = refreshQuery + "&country=" + countryValue; else refreshQuery = refreshQuery + "&reset=Y"; var levelValue = new Array(); for(i = 1; i < levelID; i++) { levelElement = "sfLevel" + i; if(document.getElementById(levelElement)) { levelValue[i] = document.getElementById(levelElement).value; } else if(document.all && document.all.levelElement) { levelValue[i] = document.levelElement.value; } } for(i = 1; i <= 5; i++) { if (typeof levelValue[i] != "undefined") { refreshQuery = refreshQuery + '&level' + i + '=' + levelValue[i]; } } var objectGroup = ''; if (document.getElementById('group') && document.getElementById('group').value) { objectGroup = document.getElementById('group').value; } else if (document.getElementById('group') && document.getElementById('searchfrm') && document.getElementById('searchfrm').group.length > 0) { for(i = 0; i <= document.getElementById('searchfrm').group.length; i++) { if (document.getElementById('searchfrm').group[i].checked == true) { objectGroup = document.getElementById('searchfrm').group[i].value; break; } } } if (objectGroup != '') refreshQuery = refreshQuery + '&objectTypeGroup=' + objectGroup; if (typeof filenameType != 'undefined') refreshQuery += '&method=' + filenameType; if (typeof isRating != 'undefined' && isRating == true) refreshQuery += '&isRating=Y'; return refreshQuery; } function getSmallestLocationID() { var locationIDs = Array(); if (jQuery("#sfCountry").length > 0 && jQuery("#sfCountry").val() != '') locationIDs.push(jQuery("#sfCountry").val()); if (jQuery("#sfLevel1").length > 0 && jQuery("#sfLevel1").val() != '' && jQuery("#sfLevel1").val() != null) locationIDs.push(jQuery("#sfLevel1").val()); if (jQuery("#sfLevel2").length > 0 && jQuery("#sfLevel2").val() != '' && jQuery("#sfLevel2").val() != null) locationIDs.push(jQuery("#sfLevel2").val()); if (jQuery("#sfLevel3").length > 0 && jQuery("#sfLevel3").val() != '' && jQuery("#sfLevel3").val() != null) locationIDs.push(jQuery("#sfLevel3").val()); if (jQuery("#sfLevel4").length > 0 && jQuery("#sfLevel4").val() != '' && jQuery("#sfLevel4").val() != null) locationIDs.push(jQuery("#sfLevel4").val()); return locationIDs.pop(); } function setFormAction(locationID) { if (locationID == '') locationID = getSmallestLocationID(); if (locationID != '' && locationUrls[locationID] != '' && typeof locationUrls[locationID] != 'undefined') { jQuery("#mainSearchForm").attr("action", locationUrls[locationID] + '#result'); } } function getRegionPlaces(locationID) { locationChanged = true; if (locationID == '') locationID = getSmallestLocationID(); if (locationID != '') { jQuery("#locationPlaceLoading").html(''); jQuery("#locationPlaces option:first").nextAll().remove(); /* jQuery.getScript('/xmlProcessing/getLocationPlaces.php?country=' + countryValue + '&locationID=' + locationID + ((typeof filenameType != 'undefined') ? '&method=' + filenameType : '')); */ // abort old requests if new request is given if(typeof getRegionRequest['0'] != 'undefined') { getRegionRequest['0'].abort(); } getRegionRequest['0'] = jQuery.ajax({ url: '/xmlProcessing/getLocationPlaces.php?country=' + countryValue + '&locationID=' + locationID + ((typeof filenameType != 'undefined') ? '&method=' + filenameType : ''), dataType: "script" }); } }