
// Kontroller
var DL_country = document.getElementById('UC_HovedSoegBlok1_DropDownList_country');
var DL_region = document.getElementById('UC_HovedSoegBlok1_DropDownList_region');
var DL_destination = document.getElementById('UC_HovedSoegBlok1_DropDownList_destination');

var TB_startdate = document.getElementById('UC_HovedSoegBlok1_TextBox_startdate');

var DL_numberofdays = document.getElementById('UC_HovedSoegBlok1_DropDownList_numberofdays');
var DL_waterdistance = document.getElementById('UC_HovedSoegBlok1_DropDownList_waterdistance');
var DL_seaview = document.getElementById('UC_HovedSoegBlok1_DropDownList_seaview');
var DL_persons = document.getElementById('UC_HovedSoegBlok1_DropDownList_persons');
var DL_pets = document.getElementById('UC_HovedSoegBlok1_DropDownList_pets');
var DL_total = document.getElementById('UC_HovedSoegBlok1_DropDownList_total');
var DL_category = document.getElementById('UC_HovedSoegBlok1_DropDownList_category');
var DL_bedrooms = document.getElementById('UC_HovedSoegBlok1_DropDownList_bedrooms');
var DL_toilets = document.getElementById('UC_HovedSoegBlok1_DropDownList_toilets');
var DL_housem2 = document.getElementById('UC_HovedSoegBlok1_DropDownList_housem2');
var DL_swimmingpool = document.getElementById('UC_HovedSoegBlok1_DropDownList_swimmingpool');
var DL_jacuzzi = document.getElementById('UC_HovedSoegBlok1_DropDownList_jacuzzi');
var DL_satellite = document.getElementById('UC_HovedSoegBlok1_DropDownList_satellite');
var DL_seaview = document.getElementById('UC_HovedSoegBlok1_DropDownList_seaview');
var DL_skiing_lift = document.getElementById('UC_HovedSoegBlok1_DropDownList_skiing_lift');

var CB_satellite = document.getElementById('UC_HovedSoegBlok1_CheckBox_satellite');
var CB_woodburning_stove = document.getElementById('UC_HovedSoegBlok1_CheckBox_woodburning_stove');
var CB_washingmachine = document.getElementById('UC_HovedSoegBlok1_CheckBox_washingmachine');
var CB_tumbler = document.getElementById('UC_HovedSoegBlok1_CheckBox_tumbler');
var CB_dishwasher = document.getElementById('UC_HovedSoegBlok1_CheckBox_dishwasher');
var CB_internet = document.getElementById('UC_HovedSoegBlok1_CheckBox_internet');
var CB_seaview = document.getElementById('UC_HovedSoegBlok1_CheckBox_seaview');
var CB_seaviewground = document.getElementById('UC_HovedSoegBlok1_CheckBox_seaviewground');
var CB_swimmingpool = document.getElementById('UC_HovedSoegBlok1_CheckBox_swimmingpool');
var CB_jacuzzi = document.getElementById('UC_HovedSoegBlok1_CheckBox_jacuzzi');
var CB_sauna = document.getElementById('UC_HovedSoegBlok1_CheckBox_sauna');
var CB_sunbed = document.getElementById('UC_HovedSoegBlok1_CheckBox_sunbed');
var CB_freezer = document.getElementById('UC_HovedSoegBlok1_CheckBox_freezer');
var CB_wheelchair = document.getElementById('UC_HovedSoegBlok1_CheckBox_wheelchair');
var CB_phone = document.getElementById('UC_HovedSoegBlok1_CheckBox_phone');

var CB_aqualandhouses = document.getElementById('UC_HovedSoegBlok1_CheckBox_aqualandhouses');
var CB_offerhouses = document.getElementById('UC_HovedSoegBlok1_CheckBox_offerhouses');
var CB_fishinghouses = document.getElementById('UC_HovedSoegBlok1_CheckBox_fishinghouses');
var CB_wellnesshouses = document.getElementById('UC_HovedSoegBlok1_CheckBox_wellnesshouses');
var CB_businesshouses = document.getElementById('UC_HovedSoegBlok1_CheckBox_businesshouses');
var CB_golfwellnesshouses = document.getElementById('UC_HovedSoegBlok1_CheckBox_golfwellnesshouses');
var CB_castlehouses = document.getElementById('UC_HovedSoegBlok1_CheckBox_castlehouses');
var CB_wheelchairhouses = document.getElementById('UC_HovedSoegBlok1_CheckBox_wheelchairhouses');
    
// Funktioner
function RegionDropDownOnChange() {
    UdfyldDestinationerDropDown(DL_region.options[DL_region.selectedIndex].value,0);
}

function UdfyldDestinationerDropDown(region, selectedDestination) {   
    if(DL_destination && arr_destinations.length > 1) {
        DL_destination.options.length = 0;        
        DL_destination.options[0] = new Option(arr_destinations[0].split('*')[1],"0");               
        if(region!=0) {
            var n = 1;
            for (i=0;i<arr_destinations.length;i++) {
                var element = arr_destinations[i].split('*');
                if (element[0] == region) {                    
                    DL_destination.options[n] = new Option(element[1],element[2]);
                    if (element[2] == selectedDestination) DL_destination.options[n].selected = true;        
                    n++;          
                }
            }
        }  
    }  
    
}
	
function LandImageOnClik(selected) {
    if(DL_region) {
        for (var i=0;i < DL_region.length; i++) {
            if(DL_region.options[i].value==selected) {
                DL_region.options[i].selected = true;
                UdfyldDestinationerDropDown(selected, "0");
            }
        }        
    }
    else if(DL_destination) {
        for (var i=0;i < DL_destination.length; i++) {
            if(DL_destination.options[i].value==selected) {
                DL_destination.options[i].selected = true;
            }
        }
    }
}
function ThemeCheckBoxChange(item)
{    
    if(CB_aqualandhouses && item.id!=CB_aqualandhouses.id) CB_aqualandhouses.checked = false;
    if(CB_offerhouses && item.id!=CB_offerhouses.id) CB_offerhouses.checked = false;
    if(CB_fishinghouses && item.id!=CB_fishinghouses.id) CB_fishinghouses.checked = false;
    if(CB_wellnesshouses && item.id!=CB_wellnesshouses.id) CB_wellnesshouses.checked = false;
    if(CB_businesshouses && item.id!=CB_businesshouses.id) CB_businesshouses.checked = false;
    if(CB_golfwellnesshouses && item.id!=CB_golfwellnesshouses.id) CB_golfwellnesshouses.checked = false;
    if(CB_castlehouses && item.id!=CB_castlehouses.id) CB_castlehouses.checked = false;
    if(CB_wheelchairhouses && item.id!=CB_wheelchairhouses.id) CB_wheelchairhouses.checked = false;
    
}

function UdfyldDropDown(obj, arr, selected) {
    if(obj) {
        for(var i=0;i<arr.length;i++) {
            var element = arr[i].split('*');
            obj.options[i] = new Option(element[0],element[1]);
            if (element[1] == selected) obj.options[i].selected = true;
        }
    }
}

function SetCheckBox(arr) {
    if(arr) {    
        for(var i=0;i<arr.length;i++)
            if(arr[i]) arr[i].checked = true; 
    }	    
}
var tmp_regions ="Jyllands vestkyst*2";var arr_regions = tmp_regions.split("#");
var tmp_destinations ="0*Alle destinationer*0#2*Arrild*287#2*Ballum*60#2*Højer*292#2*Ribe*548#2*Rudbøl*478#2*Rømø, Bolilmark*475#2*Rømø, Havneby*245#2*Rømø, Kongsmark*61#2*Rømø, Lakolk*488#2*Rømø, Sydøen*489#2*Rømø, Toftum*487#2*Rømø, Vadehav*492#2*Rømø, Vesterhede*493";var arr_destinations = tmp_destinations.split("#");
var tmp_numberofdays ="2 overnatninger*2#3 overnatninger*3#4 overnatninger*4#5 overnatninger*5#7 overnatninger*7#8 overnatninger*8#9 overnatninger*9#10 overnatninger*10#11 overnatninger*11#12 overnatninger*12#13 overnatninger*13#14 overnatninger*14#15 overnatninger*15#16 overnatninger*16#17 overnatninger*17#18 overnatninger*18#19 overnatninger*19#20 overnatninger*20#21 overnatninger*21#22 overnatninger*22#23 overnatninger*23#24 overnatninger*24#25 overnatninger*25#26 overnatninger*26#27 overnatninger*27#28 overnatninger*28";
var tmp_waterdistance="Ikke vigtig*0#Max. 150 meter*150#Max. 500 meter*500#Max. 1000 meter*1000#Max. 2000 meter*2000#Max. 5000 meter*5000#Max. 10000 meter*10000";
var tmp_seaview="Ikke vigtig*#Ja*yes#Nej*no";
var tmp_persons="Ikke vigtigt*0#1 person*1#2 personer*2#3 personer*3#4 personer*4#5 personer*5#6 personer*6#7 personer*7#8 personer*8#9 personer*9#10 personer*10#11 personer*11#12 personer*12#13 personer*13#14 personer*14#15 personer*15#16 personer*16#17 personer*17#18 personer*18#19 personer*19#20 personer*20#21 personer*21";
var tmp_pets="Ikke vigtigt*0#1 husdyr*1#2 husdyr*2#3 husdyr eller flere*3#Husdyr ikke tilladt*no";
var tmp_total="Ikke vigtigt*0#DKK 2.000,-*2000#DKK 3.000,-*3000#DKK 4.000,-*4000#DKK 5.000,-*5000#DKK 6.000,-*6000#DKK 7.000,-*7000#DKK 8.000,-*8000#DKK 9.000,-*9000#DKK 10.000,-*10000#DKK 12.000,-*12000#DKK 15.000,-*15000#DKK 20.000,-*20000";
var tmp_category="Ikke vigtig*#Standard*A#Standard Plus*P#Særklasse*S#Topklasse*T#Eksklusiv*X";
var tmp_bedrooms="Ikke vigtigt*0#Min. 1 soverum*1#Min. 2 soverum*2#Min. 3 soverum*3#Min. 4 soverum*4#Min. 5 soverum*5";
var tmp_toilets="Ikke vigtig*#Min. 1 toilet*1#Min. 2 toiletter*2#Min. 3 toiletter*3#Min. 4 toiletter*4";
var tmp_swimmingpool="Ikke vigtigt*#Ja tak*yes#Nej tak*no#Privat indendørs*private#Fælles indendørs*shared#Kun indendørs*indoor#Kun udendørs*outdoor";
var tmp_jacuzzi="Ikke vigtigt*#Ja tak*yes#Nej tak*no#Kun indendørs*indoor#Kun udendørs*outdoor";
var tmp_housem2="Ikke vigtig*#Min. 50 m2*50#Min. 200 m2*200#Min. 300 m2*300#Min. 500 m2*500";

function SBInit() { 
UdfyldDropDown(DL_region, arr_regions,2);
UdfyldDestinationerDropDown(2,488);
TB_startdate.value="18-09-2010";
UdfyldDropDown(DL_numberofdays, tmp_numberofdays.split("#"),7);
UdfyldDropDown(DL_waterdistance, tmp_waterdistance.split("#"),'null');
UdfyldDropDown(DL_seaview, tmp_seaview.split("#"),'null');
UdfyldDropDown(DL_persons, tmp_persons.split("#"),'null');
UdfyldDropDown(DL_pets, tmp_pets.split("#"),'null');
UdfyldDropDown(DL_total, tmp_total.split("#"),'null');
UdfyldDropDown(DL_category, tmp_category.split("#"),'null');
UdfyldDropDown(DL_bedrooms, tmp_bedrooms.split("#"),'null');
UdfyldDropDown(DL_toilets, tmp_toilets.split("#"),'null');
UdfyldDropDown(DL_swimmingpool, tmp_swimmingpool.split("#"),'null');
UdfyldDropDown(DL_jacuzzi, tmp_jacuzzi.split("#"),'null');
UdfyldDropDown(DL_housem2, tmp_housem2.split("#"),'null');

}
SBInit();
