/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Revised by: DeWayne Whitaker :: http://www.aecdfw.com
Original by: Andrew Berry */

var arrItems1 = new Array();
var arrItemsGrp1 = new Array();

// Dzieci

arrItems1[3] = "konny";
arrItemsGrp1[3] = 1;
arrItems1[4] = "staropolski";
arrItemsGrp1[4] = 1;
arrItems1[5] = "językowy";
arrItemsGrp1[5] = 1;
arrItems1[6] = "sportowy";
arrItemsGrp1[6] = 1;
arrItems1[7] = "artystyczny";
arrItemsGrp1[7] = 1;
arrItems1[8] = "żagle";
arrItemsGrp1[8] = 1;

// Młodzież

arrItems1[9] = "konny";
arrItemsGrp1[9] = 2;
arrItems1[10] = "staropolski";
arrItemsGrp1[10] = 2;
arrItems1[11] = "językowy";
arrItemsGrp1[11] = 2;
arrItems1[12] = "sportowy";
arrItemsGrp1[12] = 2;
arrItems1[13] = "artystyczny";
arrItemsGrp1[13] = 2;
arrItems1[14] = "żagle";
arrItemsGrp1[14] = 2;
arrItems1[15] = "wypoczynkowo-globtroterski";
arrItemsGrp1[15] = 2;
arrItems1[16] = "rowerowy";
arrItemsGrp1[16] = 2;
arrItems1[17] = "wędrowny";
arrItemsGrp1[17] = 2;

// Studenci

arrItems1[18] = "rowerowy";
arrItemsGrp1[18] = 3;
arrItems1[19] = "wędrowny";
arrItemsGrp1[19] = 3;

// Dorośli

arrItems1[20] = "rowerowy";
arrItemsGrp1[20] = 4;
arrItems1[21] = "kolonia dla dorosłych";
arrItemsGrp1[21] = 4;

var arrItems2 = new Array();
var arrItemsGrp2 = new Array();

// Dzieci
arrItems2[21] = "Polska, nad wodą";
arrItemsGrp2[21] = 3
arrItems2[22] = "Polska, nad wodą";
arrItemsGrp2[22] = 4
arrItems2[23] = "Polska, nad wodą";
arrItemsGrp2[23] = 5
arrItems2[24] = "Polska, nad wodą";
arrItemsGrp2[24] = 6
arrItems2[25] = "Polska, nad wodą";
arrItemsGrp2[25] = 7
arrItems2[39] = "Polska, nad wodą";
arrItemsGrp2[39] = 8

// Młodzież
arrItems2[26] = "Polska, nad wodą";
arrItemsGrp2[26] = 9
arrItems2[27] = "Polska, nad wodą";
arrItemsGrp2[27] = 10
arrItems2[28] = "zagranica, miasto";
arrItemsGrp2[28] = 11
arrItems2[29] = "Polska, nad wodą";
arrItemsGrp2[29] = 12
arrItems2[30] = "Polska, nad wodą";
arrItemsGrp2[30] = 13
arrItems2[31] = "Polska, nad wodą";
arrItemsGrp2[31] = 14
arrItems2[32] = "zagranica, nad wodą";
arrItemsGrp2[32] = 15
arrItems2[33] = "zagranica, góry";
arrItemsGrp2[33] = 16
arrItems2[34] = "Polska, góry";
arrItemsGrp2[34] = 17

// Studenci
arrItems2[35] = "zagranica, góry";
arrItemsGrp2[35] = 18
arrItems2[36] = "Polska, góry";
arrItemsGrp2[36] = 19

// Dorośli
arrItems2[37] = "zagranica, góry";
arrItemsGrp2[37] = 20
arrItems2[38] = "Polska, góry";
arrItemsGrp2[38] = 21


function selectChange(control, controlToPopulate, ItemArray, GroupArray) {
  var myEle ;
  var x ;
  // Empty the second drop down box of any choices
  for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
  if (control.name == "firstChoice") {
    // Empty the third drop down box of any choices
    for (var q=window.document.form.thirdChoice.options.length;q>=0;q--) form.thirdChoice.options[q] = null;
 }
  // ADD Default Choice - in case there are no values
  myEle = document.createElement("option") ;
  myEle.value = 0 ;
  myEle.text = "[wybierz]" ;
  // controlToPopulate.add(myEle) ;
  controlToPopulate.appendChild(myEle)
  // Now loop through the array of individual items
  // Any containing the same child id are added to
  // the second dropdown box
  for ( x = 0 ; x < ItemArray.length  ; x++ ) {
    if ( GroupArray[x] == control.value ) {
      myEle = document.createElement("option") ;
      //myEle.value = x ;
      myEle.setAttribute('value',x);
      // myEle.text = ItemArray[x] ;
      var txt = document.createTextNode(ItemArray[x]);
      myEle.appendChild(txt)
      // controlToPopulate.add(myEle) ;
      controlToPopulate.appendChild(myEle)
    }
  }
}

function selectChange(control, controlToPopulate, ItemArray, GroupArray) {
  var myEle ;
  var x ;
  // Empty the second drop down box of any choices
  for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
  if (control.name == "firstChoice") {
    // Empty the third drop down box of any choices
    for (var q=window.document.form.thirdChoice.options.length;q>=0;q--) window.document.form.thirdChoice.options[q] = null;
  }
  // ADD Default Choice - in case there are no values
  myEle=document.createElement("option");
  theText=document.createTextNode("[wybierz]");
  myEle.appendChild(theText);
  myEle.setAttribute("value","0");
  controlToPopulate.appendChild(myEle);
  // Now loop through the array of individual items
  // Any containing the same child id are added to
  // the second dropdown box
  for ( x = 0 ; x < ItemArray.length  ; x++ ) {
    if ( GroupArray[x] == control.value ) {
      myEle = document.createElement("option") ;
      //myEle.value = x ;
      myEle.setAttribute("value",x);
      // myEle.text = ItemArray[x] ;
      var txt = document.createTextNode(ItemArray[x]);
      myEle.appendChild(txt)
      // controlToPopulate.add(myEle) ;
      controlToPopulate.appendChild(myEle)
    }
  }
}

