// JavaScript Document

//This is a simple Javacript file to control the colours in the Pants Selection Boxes 

// 9-12 Months
color = new Array(
new Array(
new Array("Twilight/Candyfloss", "Twilight/Candyfloss"),
new Array("Ruby/Midnight", "Ruby/Midnight"),
new Array("Midnight/Ruby", "Midnight/Ruby")
),
// 12-18 Months
new Array(
new Array("Twilight/Candyfloss", "Twilight/Candyfloss"),
new Array("Ruby/Midnight", "Ruby/Midnight"),
new Array("Midnight/Ruby", "Midnight/Ruby")
),
// 2 Years
new Array(
new Array("Ruby/Midnight", "Ruby/Midnight"),
new Array("Midnight/Ruby", "Midnight/Ruby")
),
// 3 Years
new Array(
new Array("Ruby/Midnight", "Ruby/Midnight")
),
// 4 Years
new Array(
)
);


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;
   }
}

