// JavaScript Document

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  Andrew Berry (aberry@berrysystems.com) -->
<!-- Web Site:  http://www.berrysystems.com -->

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

arrItems1[0] = "Handymen";
arrItemsGrp1[0] = 1;
arrItems1[1] = "Exterminators";
arrItemsGrp1[1] = 1;
arrItems1[2] = "Childcare";
arrItemsGrp1[2] = 1;

arrItems1[3] = "Apparel";
arrItemsGrp1[3] = 2;
arrItems1[4] = "Groceries";
arrItemsGrp1[4] = 2;

arrItems1[5] = "Dentists";
arrItemsGrp1[5] = 5;
arrItems1[6] = "Doctors";
arrItemsGrp1[6] = 5;



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;
   // ADD Default Choice - in case there are no values
  myEle = document.createElement("option") ;
  myEle.value = 0 ;
  myEle.text = "Choose Sub Category" ;
  controlToPopulate.add(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.text = ItemArray[x] ;
          controlToPopulate.add(myEle) ;
        }
    }
}

team = new Array(
new Array(
new Array("Handymen", 0),
new Array("Exterminators", 1),
new Array("Childcare", 2)
),
new Array(
new Array("Apparel", 3),
new Array("Groceries", 4)
),
null,
null,
new Array(
new Array("Dentists", 5),
new Array("Doctors", 6)
), 
null,
null,
new Array(
new Array("All Listings", 8)
)
);
function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;
// empty existing items
for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null; 
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
}
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) {
selectCtrl.options[j].value = itemArray[i][1]; 
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
   }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


