/*
*** Multiple dynamic combo boxes
*** by Mirko Elviro, 9 Mar 2005
*** Script featured and available on JavaScript Kit (http://www.javascriptkit.com)
***
***Please do not remove this comment
*/

// This script supports an unlimited number of linked combo boxed
// Their id must be "combo_0", "combo_1", "combo_2" etc.
// Here you have to put the data that will fill the combo boxes
// ie. data_2_1 will be the first option in the second combo box
// when the first combo box has the second option selected


// first combo box

	data_1 = new Option("Kaufen", "Kaufen");
	data_2 = new Option("Vermieten", "Vermieten");


// second combo box

	data_1_1 = new Option("Österreich", "A");
	data_1_2 = new Option("Deutschland", "D");
	data_1_3 = new Option("Schweiz", "CH");
	data_1_4 = new Option("USA", "USA");
	data_2_1 = new Option("Österreich", "A");
	data_2_2 = new Option("Deutschland", "D");
	data_2_3 = new Option("Schweiz", "CH");
	data_2_4 = new Option("USA", "USA");
	

// third combo box
	data_1_1_1 = new Option("Wien", "Wien");
	data_1_1_2 = new Option("Bgld", "Bgld");
	data_1_1_3 = new Option("Kärnten", "Kärnten");
	data_1_1_4 = new Option("NÖ", "NÖ");
	data_1_1_5 = new Option("OÖ", "OÖ");
	data_1_1_6 = new Option("Salzburg", "Salzburg");
	data_1_1_7 = new Option("Stmk", "Stmk");
	data_1_1_8 = new Option("Tirol", "Tirol");
	data_1_1_9 = new Option("Vorarlberg", "Vorarlberg");
	data_2_1_1 = new Option("Wien", "Wien");
	data_2_1_2 = new Option("Bgld", "Bgld");
	data_2_1_3 = new Option("Kärnten", "Kärnten");
	data_2_1_4 = new Option("NÖ", "NÖ");
	data_2_1_5 = new Option("OÖ", "OÖ");
	data_2_1_6 = new Option("salzburg", "salzburg");
	data_2_1_7 = new Option("Stmk", "Stmk");
	data_2_1_8 = new Option("Tirol", "Tirol");
	data_2_1_9 = new Option("Vorarlberg", "Vorarlberg");
	
	data_1_2_1 = new Option("Bade-W", "Bade-W");
	data_1_2_2 = new Option("Bayern", "Bayern");
	data_1_2_3 = new Option("Berlin", "Berlin");
	data_1_2_4 = new Option("Brandenburg", "Brandenburg");
	data_1_2_5 = new Option("Bremen", "Bremen");
	data_1_2_6 = new Option("Hamburg", "Hamburg");
	data_1_2_7 = new Option("Hessen", "Hessen");
	data_1_2_8 = new Option("Mecklenburg-V", "Mecklenburg-V");
	data_1_2_9 = new Option("Niedersachsen", "Niedersachsen");
	data_1_2_10 = new Option("Nordrhein-W", "Nordrhein-W");
	data_1_2_11 = new Option("Rheinland-P", "Rheinland-P");
	data_1_2_12 = new Option("Saarland", "Saarland");
	data_1_2_13 = new Option("Sachsen", "Sachsen");
	data_1_2_14 = new Option("Sachsen-A", "Sachsen-A");
	data_1_2_15 = new Option("Schleswig-H", "Schleswig-H");
	data_1_2_16 = new Option("Thüringen", "Thüringen");
	data_2_2_1 = new Option("Bade-W", "Bade-W");
	data_2_2_2 = new Option("Bayern", "Bayern");
	data_2_2_3 = new Option("Berlin", "Berlin");
	data_2_2_4 = new Option("Brandenburg", "Brandenburg");
	data_2_2_5 = new Option("Bremen", "Bremen");
	data_2_2_6 = new Option("Hamburg", "Hamburg");
	data_2_2_7 = new Option("Hessen", "Hessen");
	data_2_2_8 = new Option("Mecklenburg-V", "Mecklenburg-V");
	data_2_2_9 = new Option("Niedersachsen", "Niedersachsen");
	data_2_2_10 = new Option("Nordrhein-W", "Nordrhein-W");
	data_2_2_11 = new Option("Rheinland-P", "Rheinland-P");
	data_2_2_12 = new Option("Saarland", "Saarland");
	data_2_2_13 = new Option("Sachsen", "Sachsen");
	data_2_2_14 = new Option("Sachsen-A", "Sachsen-A");
	data_2_2_15 = new Option("Schleswig-H", "Schleswig-H");
	data_2_2_16 = new Option("Thüringen", "Thüringen");
	
	data_1_3_1 = new Option("Aargau", "Aargau");
	data_1_3_2 = new Option("Appenzell A", "Appenzell A");
	data_1_3_3 = new Option("Appenzell I", "Appenzell I");
	data_1_3_4 = new Option("Bassel-L", "Bassel-L");
	data_1_3_5 = new Option("Bassel-S", "Bassel-S");
	data_1_3_6 = new Option("Bern", "Bern");
	data_1_3_7 = new Option("Freiburg", "Freiburg");
	data_1_3_8 = new Option("Genf", "Genf");
	data_1_3_9 = new Option("Glarus", "Glarus");
	data_1_3_10 = new Option("Graubünden", "Graubünden");
	data_1_3_11 = new Option("Jura", "Jura");
	data_1_3_12 = new Option("Luzern", "Luzern");
	data_1_3_13 = new Option("Neuenburg", "Neuenburg");
	data_1_3_14 = new Option("Nidwalden", "Nidwalden");
	data_1_3_15 = new Option("Obwalden", "Obwalden");
	data_1_3_16 = new Option("Schaffausen", "Schaffausen");
	data_1_3_17 = new Option("schwyz", "schwyz");
	data_1_3_18 = new Option("Solothurn", "Solothurn");
	data_1_3_19 = new Option("St. gallen", "St. gallen");
	data_1_3_20 = new Option("Tessin", "Tessin");
	data_1_3_21 = new Option("Thurgau", "Thurgau");
	data_1_3_22 = new Option("Uri", "Uri");
	data_1_3_23 = new Option("Waadt", "Waadt");
	data_1_3_24 = new Option("Wallis", "Wallis");
	data_1_3_25 = new Option("Zug", "Zug");
	data_1_3_26 = new Option("Zürich", "Zürich");
	data_2_3_1 = new Option("Aargau", "Aargau");
	data_2_3_2 = new Option("Appenzell A", "Appenzell A");
	data_2_3_3 = new Option("Appenzell I", "Appenzell I");
	data_2_3_4 = new Option("Bassel-L", "Bassel-L");
	data_2_3_5 = new Option("Bassel-S", "Bassel-S");
	data_2_3_6 = new Option("Bern", "Bern");
	data_2_3_7 = new Option("Freiburg", "Freiburg");
	data_2_3_8 = new Option("Genf", "Genf");
	data_2_3_9 = new Option("Glarus", "Glarus");
	data_2_3_10 = new Option("Graubünden", "Graubünden");
	data_2_3_11 = new Option("Jura", "Jura");
	data_2_3_12 = new Option("Luzern", "Luzern");
	data_2_3_13 = new Option("Neuenburg", "Neuenburg");
	data_2_3_14 = new Option("Nidwalden", "Nidwalden");
	data_2_3_15 = new Option("Obwalden", "Obwalden");
	data_2_3_16 = new Option("Schaffausen", "Schaffausen");
	data_2_3_17 = new Option("schwyz", "schwyz");
	data_2_3_18 = new Option("Solothurn", "Solothurn");
	data_2_3_19 = new Option("St. gallen", "St. gallen");
	data_2_3_20 = new Option("Tessin", "Tessin");
	data_2_3_21 = new Option("Thurgau", "Thurgau");
	data_2_3_22 = new Option("Uri", "Uri");
	data_2_3_23 = new Option("Waadt", "Waadt");
	data_2_3_24 = new Option("Wallis", "Wallis");
	data_2_3_25 = new Option("Zug", "Zug");
	data_2_3_26 = new Option("Zürich", "Zürich");
	
	data_1_4_1 = new Option("SF", "SF");
	data_1_4_2 = new Option("Boston","Boston");
	data_1_4_3 = new Option("NYC", "NYC");
	data_1_4_4 = new Option("Alabama", "Alabama");
	data_1_4_5 = new Option("Alaska", "Alaska");
	data_1_4_6 = new Option("Arizona", "Arizona");
	data_1_4_7 = new Option("Arkansas", "Arkansas");
	data_1_4_8 = new Option("California", "California");
	data_1_4_9 = new Option("Colorado", "Colorado");
	data_1_4_10 = new Option("Connecticut", "Connecticut");
	data_1_4_11 = new Option("Delaware", "Delaware");
	data_1_4_12 = new Option("Florida", "Florida");
	data_1_4_13 = new Option("Georgia", "Georgia");
	data_1_4_14 = new Option("Hawaii", "Hawaii");
	data_1_4_15 = new Option("IdahoState", "IdahoState");
	data_1_4_16 = new Option("Illinois", "Illinois");
	data_1_4_17 = new Option("Indiana", "Indiana");
	data_1_4_18 = new Option("Iowa", "Iowa");
	data_1_4_19 = new Option("Kansas", "Kansas");
	data_1_4_20 = new Option("Kentucky", "Kentucky");
	data_1_4_21 = new Option("Louisiana", "Louisiana");
	data_1_4_22 = new Option("Maine", "Maine");
	data_1_4_23 = new Option("Maryland", "Maryland");
	data_1_4_24 = new Option("Massachusetts", "Massachusetts");
	data_1_4_25 = new Option("Michigan", "Michigan");
	data_1_4_26 = new Option("Minnesota", "Minnesota");
	data_1_4_27 = new Option("Mississippi", "Mississippi");
	data_1_4_28 = new Option("Missouri", "Missouri");
	data_1_4_29 = new Option("Montana", "Montana");
	data_1_4_30 = new Option("Nebraska", "Nebraska");
	data_1_4_31 = new Option("Nevada", "Nevada");
	data_1_4_32 = new Option("NewHampshire", "NewHampshire");
	data_1_4_33 = new Option("NewJersey", "NewJersey");
	data_1_4_34 = new Option("NewMexico", "NewMexico");
	data_1_4_35 = new Option("NewYork", "NewYork");
	data_1_4_36 = new Option("NorthCarolina", "NorthCarolina");
	data_1_4_37 = new Option("NorthDakota", "NorthDakota");
	data_1_4_38 = new Option("Ohio", "Ohio");
	data_1_4_39 = new Option("Oklahoma", "Oklahoma");
	data_1_4_40 = new Option("Oregon", "Oregon");
	data_1_4_41 = new Option("Pennsylvania", "Pennsylvania");
	data_1_4_42 = new Option("RhodeIsland", "RhodeIsland");
	data_1_4_43 = new Option("SouthCarolina", "SouthCarolina");
	data_1_4_44 = new Option("SouthDakota", "SouthDakota");
	data_1_4_45 = new Option("Tennessee", "Tennessee");
	data_1_4_46 = new Option("Texas", "Texas");
	data_1_4_47 = new Option("Utah", "Utah");
	data_1_4_48 = new Option("Vermont", "Vermont");
	data_1_4_49 = new Option("Virginia", "Virginia");
	data_1_4_50 = new Option("Washington", "Washington");
	data_1_4_51 = new Option("WestVirginia", "WestVirginia");
	data_1_4_52 = new Option("Wisconsin", "Wisconsin");
	data_1_4_53 = new Option("Wyoming", "Wyoming");
	
	data_2_4_1 = new Option("San Francisco", "San Francisco");
	data_2_4_2 = new Option("Boston", "Boston");
	data_2_4_3 = new Option("NYC", "NYC");
	data_2_4_4 = new Option("Alabama", "Alabama");
	data_2_4_5 = new Option("Alaska", "Alaska");
	data_2_4_6 = new Option("Arizona", "Arizona");
	data_2_4_7 = new Option("Arkansas", "Arkansas");
	data_2_4_8 = new Option("California", "California");
	data_2_4_9 = new Option("Colorado", "Colorado");
	data_2_4_10 = new Option("Connecticut", "Connecticut");
	data_2_4_11 = new Option("Delaware", "Delaware");
	data_2_4_12 = new Option("Florida", "Florida");
	data_2_4_13 = new Option("Georgia", "Georgia");
	data_2_4_14 = new Option("Hawaii", "Hawaii");
	data_2_4_15 = new Option("IdahoState", "IdahoState");
	data_2_4_16 = new Option("Illinois", "Illinois");
	data_2_4_17 = new Option("Indiana", "Indiana");
	data_2_4_18 = new Option("Iowa", "Iowa");
	data_2_4_19 = new Option("Kansas", "Kansas");
	data_2_4_20 = new Option("Kentucky", "Kentucky");
	data_2_4_21 = new Option("Louisiana", "Louisiana");
	data_2_4_22 = new Option("Maine", "Maine");
	data_2_4_23 = new Option("Maryland", "Maryland");
	data_2_4_24 = new Option("Massachusetts", "Massachusetts");
	data_2_4_25 = new Option("Michigan", "Michigan");
	data_2_4_26 = new Option("Minnesota", "Minnesota");
	data_2_4_27 = new Option("Mississippi", "Mississippi");
	data_2_4_28 = new Option("Missouri", "Missouri");
	data_2_4_29 = new Option("Montana", "Montana");
	data_2_4_30 = new Option("Nebraska", "Nebraska");
	data_2_4_31 = new Option("Nevada", "Nevada");
	data_2_4_32 = new Option("NewHampshire", "NewHampshire");
	data_2_4_33 = new Option("NewJersey", "NewJersey");
	data_2_4_34 = new Option("NewMexico", "NewMexico");
	data_2_4_35 = new Option("NewYork", "NewYork");
	data_2_4_36 = new Option("NorthCarolina", "NorthCarolina");
	data_2_4_37 = new Option("NorthDakota", "NorthDakota");
	data_2_4_38 = new Option("Ohio", "Ohio");
	data_2_4_39 = new Option("Oklahoma", "Oklahoma");
	data_2_4_40 = new Option("Oregon", "Oregon");
	data_2_4_41 = new Option("Pennsylvania", "Pennsylvania");
	data_2_4_42 = new Option("RhodeIsland", "RhodeIsland");
	data_2_4_43 = new Option("SouthCarolina", "SouthCarolina");
	data_2_4_44 = new Option("SouthDakota", "SouthDakota");
	data_2_4_45 = new Option("Tennessee", "Tennessee");
	data_2_4_46 = new Option("Texas", "Texas");
	data_2_4_47 = new Option("Utah", "Utah");
	data_2_4_48 = new Option("Vermont", "Vermont");
	data_2_4_49 = new Option("Virginia", "Virginia");
	data_2_4_50 = new Option("Washington", "Washington");
	data_2_4_51 = new Option("WestVirginia", "WestVirginia");
	data_2_4_52 = new Option("Wisconsin", "Wisconsin");
	data_2_4_53 = new Option("Wyoming", "Wyoming");
	


// fourth combo box

	data_1_1_1_1 = new Option("alle Bezirke", "");
	data_1_1_1_2 = new Option("1010", "1010");
	data_1_1_1_3 = new Option("1020", "1020");
	data_1_1_1_4 = new Option("1030", "1030");
	data_1_1_1_5 = new Option("1040", "1040");
	data_1_1_1_6 = new Option("1050", "1050");
	data_1_1_1_7 = new Option("1060", "1060");
	data_1_1_1_8 = new Option("1070", "1070");
	data_1_1_1_9 = new Option("1080", "1080");
	data_1_1_1_10 = new Option("1090", "1090");
	data_1_1_1_11 = new Option("1100", "1100");
	data_1_1_1_12 = new Option("1110", "1110");
	data_1_1_1_13 = new Option("1120", "1120");
	data_1_1_1_14 = new Option("1130", "1130");
	data_1_1_1_15 = new Option("1140", "1140");
	data_1_1_1_16 = new Option("1150", "1150");
	data_1_1_1_17 = new Option("1160", "1160");
	data_1_1_1_18 = new Option("1170", "1170");
	data_1_1_1_19 = new Option("1180", "1080");
	data_1_1_1_20 = new Option("1190", "1190");
	data_1_1_1_21 = new Option("1200", "1200");
	data_1_1_1_22 = new Option("1210", "1210");
	data_1_1_1_23 = new Option("1220", "1220");
	data_1_1_1_24 = new Option("1230", "1230");
	data_2_1_1_1 = new Option("Alle", "Alle");
	data_2_1_1_2 = new Option("1010", "1010");
	data_2_1_1_3 = new Option("1020", "1020");
	data_2_1_1_4 = new Option("1030", "1030");
	data_2_1_1_5 = new Option("1040", "1040");
	data_2_1_1_6 = new Option("1050", "1050");
	data_2_1_1_7 = new Option("1060", "1060");
	data_2_1_1_8 = new Option("1070", "1070");
	data_2_1_1_9 = new Option("1080", "1080");
	data_2_1_1_10 = new Option("1090", "1090");
	data_2_1_1_11 = new Option("1100", "1100");
	data_2_1_1_12 = new Option("1110", "1110");
	data_2_1_1_13 = new Option("1120", "1120");
	data_2_1_1_14 = new Option("1130", "1130");
	data_2_1_1_15 = new Option("1140", "1140");
	data_2_1_1_16 = new Option("1150", "1150");
	data_2_1_1_17 = new Option("1160", "1160");
	data_2_1_1_18 = new Option("1170", "1170");
	data_2_1_1_19 = new Option("1180", "1080");
	data_2_1_1_20 = new Option("1190", "1190");
	data_2_1_1_21 = new Option("1200", "1200");
	data_2_1_1_22 = new Option("1210", "1210");
	data_2_1_1_23 = new Option("1220", "1220");
	data_2_1_1_24 = new Option("1230", "1230");

// other parameters

    displaywhenempty=""
    valuewhenempty=-1

    displaywhennotempty="- - -Bitte auswählen- - -"
    valuewhennotempty=0


function change(currentbox) {
	numb = currentbox.id.split("_");
	currentbox = numb[1];

    i=parseInt(currentbox)+1

// I empty all combo boxes following the current one

    while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) &&
           (document.getElementById("combo_"+i)!=null)) {
         son = document.getElementById("combo_"+i);
	     // I empty all options except the first one (it isn't allowed)
	     for (m=son.options.length-1;m>0;m--) son.options[m]=null;
	     // I reset the first option
	     son.options[0]=new Option(displaywhenempty,valuewhenempty)
	     i=i+1
    }


// now I create the string with the "base" name ("stringa"), ie. "data_1_0"
// to which I'll add _0,_1,_2,_3 etc to obtain the name of the combo box to fill

    stringa='data'
    i=0
    while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) &&
           (document.getElementById("combo_"+i)!=null)) {
           eval("stringa=stringa+'_'+document.getElementById(\"combo_"+i+"\").selectedIndex")
           if (i==currentbox) break;
           i=i+1
    }


// filling the "son" combo (if exists)

    following=parseInt(currentbox)+1

    if ((eval("typeof(document.getElementById(\"combo_"+following+"\"))!='undefined'")) &&
       (document.getElementById("combo_"+following)!=null)) {
       son = document.getElementById("combo_"+following);
       stringa=stringa+"_"
       i=0
       while ((eval("typeof("+stringa+i+")!='undefined'")) || (i==0)) {

       // if there are no options, I empty the first option of the "son" combo
	   // otherwise I put "-select-" in it

	   	  if ((i==0) && eval("typeof("+stringa+"0)=='undefined'"))
	   	      if (eval("typeof("+stringa+"1)=='undefined'"))
	   	         eval("son.options[0]=new Option(displaywhenempty,valuewhenempty)")
	   	      else
	             eval("son.options[0]=new Option(displaywhennotempty,valuewhennotempty)")
	      else
              eval("son.options["+i+"]=new Option("+stringa+i+".text,"+stringa+i+".value)")
	      i=i+1
	   }
       //son.focus()
       i=1
       combostatus=''
       cstatus=stringa.split("_")
       while (cstatus[i]!=null) {
          combostatus=combostatus+cstatus[i]
          i=i+1
          }
       return combostatus;
    }
}



