// JavaScript Document
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Carl Leiby | http://leibys-place.com/ */
var otherStuff = {
   "Corporate Services" : [ "International Tax Planning", "Estate Planning and Asset Protection", "Accounting and Financial Advice", "Formation and administration of Companies", "Formation and administration of Trusts" ],
   "Yacht Services" : [ "Yacht and Ship registration", "Tax Optimisation", "Marine Finance", "Insurance services", "Crew services", "Technical services", "Management Administration", "Project Management" ],
   "item 4" : [ "subitem 4" ],
   "item 6" : [ "subitem 6.1", "subitem 6.2" ]
};

function selectAll(listName, selected) {
  var listBox = document.getElementById(listName);
  for(i=0; i<listBox.length; i++) {
    listBox.options[i].selected=selected;
  }
  if( listBox.onchange ) {
    listBox.onchange();
  }
}

function lstStuff_OnChange() {
  var listBox = document.getElementById("lstStuff");
  var subListBox = document.getElementById("lstOtherStuff");
  subListBox.options.length=0;
  for(i=0; i<listBox.length; i++) {
    if( listBox.options[i].selected ) {
      var key = listBox.options[i].text;
      if(otherStuff[key]) {
        for(j=0; j<otherStuff[key].length; j++) {
        subListBox.options.add(new Option(otherStuff[key][j],otherStuff[key][j]));
        }
      }
    }
  }
}
