// Javascript 1.2 (?) control file for control of card and embellishment colours on the 
// sample and order forms.

var arrayData = new Array(); 

// Design ... R=red, S=silver, G=gold, B=blue, K=black, W=white, V=violet,
//   P=purple, C=cream, L=lilac, Y=yellow, H=hot Raspberry, U=bubblegum Pink,
//   I=pink, E=cerise pink, i=glitter pink, b=glitter blue, p=glitter purple,
//   a=black/white, T=chocolate/brown, O=See Notes
// Note that the O option is only valid on the order form (not on the
//  sample form)

arrayData[0] = 'Herminie|X|'  // new design
arrayData[1] = 'Sammie|X|'  // new design
arrayData[2] = 'Jinnie|X|'  // new design
arrayData[3] = 'Octavie|xz|'  // new design
arrayData[4] = 'Yolandie|X|'  // new design
arrayData[5] = 'Candie|X|'  // new design
arrayData[6] = 'Kizzie|X|'  // new design
arrayData[7] = 'Queenie|X|'  // new design
arrayData[8] = 'Chantillie|ge|'
arrayData[9] = 'Maddie|X|'
arrayData[10] = 'Mollie|X|'
arrayData[11] = 'Poppie|X|'
arrayData[12] = 'Sigournie|X|'  // new design - options ?
arrayData[13] = 'Anamarie|X|'  // new design
arrayData[14] = 'Lizzie|BWRPLpmbrcsGkyM|'
arrayData[15] = 'Mackenzie|BWRPLpmbrcsGkyM|'  // new design
arrayData[16] = 'Bettie|BWRPLpmbrcsGkyM|'  // new design
arrayData[17] = 'Anastasie|BWRPLpmbrcsGkyM|'  // new design
arrayData[18] = 'Carrie|BWRPLpmbrcsGkyM|'
arrayData[19] = 'Billie|BWRPLpmbrcsGkyM|'
arrayData[20] = 'Sophie|BWRPLpmbrcsGkyM|'
arrayData[21] = 'Harmonie|X|'
arrayData[22] = 'Libbie|X|'
arrayData[23] = 'Eternitie|X|'
arrayData[24] = 'Tiffanie|X|'
arrayData[25] = 'Melanie|X|'
arrayData[26] = 'Felicitie|lh|'
arrayData[27] = 'Kylie|X|'
arrayData[28] = 'Dannie|X|'
arrayData[29] = 'Jessie|X|'
arrayData[30] = 'Kellie|X|'  // new design
arrayData[31] = 'Josie|X|'
arrayData[32] = 'Kittie|BWRPLpmbrcsGkyM|'
arrayData[33] = 'Purdie|BWRPLpmbrcsGkyM|'
arrayData[34] = 'Ollie|BWRPLpmbrcsGkyM|'
arrayData[35] = 'Minnie|BWRPLpmbrcsGkyM|'
arrayData[36] = 'Huxlie|BWRPLpmbrcsGkyM|'  // new design
arrayData[37] = 'Tootsie|BWRPLpmbrcsGkyM|'  // new design
arrayData[38] = 'Loralie|pPS|'
arrayData[39] = 'Chrissie|BRLPUIKYHF|'
arrayData[40] = 'Meggie|BRLPUIKYHF|'
arrayData[41] = 'Merlie|BRLPUIKYHF|'
arrayData[42] = 'Maudie|pPB|'
arrayData[43] = 'Dottie|BRLPUIKYHF|'
arrayData[44] = 'Amberlie|BRLPUIKYHF|'  // new design
arrayData[45] = 'Millie|X|'
arrayData[46] = 'Roxie|pP|'
arrayData[47] = 'Debbie|LPUIH|'
arrayData[48] = 'Rubie|pE|'
arrayData[49] = 'Pollie|pLrWRPB|'
arrayData[50] = 'Hollie|W|'
arrayData[51] = 'Lottie|SG|'
arrayData[52] = 'Tildie|RLPUIKYHF|'

// deleted designs
//  arrayData[10] = 'Gracie|X|'
//  arrayData[11] = 'Konnie|X|'
//  arrayData[14] = 'Lucie|pPB|'
//  arrayData[29] = 'Wendie|SGW|'
 
function populateData( type_num, design_name ) { 
  // type_num=1 means the first sample card
  if(type_num == 1) {
    selectd = window.document.sample_form.Samp1_colour; 
  }
  // type_num=2 means the second sample card
  if(type_num == 2) {
    selectd = window.document.sample_form.Samp2_colour; 
  }
  // type_num=3 means the second sample card
  if(type_num == 3) {
    selectd = window.document.sample_form.Samp3_colour; 
  }
  // type_num=4 means the order form card
  if(type_num == 4) {
    selectd = window.document.order_form.Design_colour; 
  }
  string = ""; 

  // 0 - will display the new options only 
  // 1 - will display the first existing option plus the new options 
  countd = 1; 

  // Clear the old list (above element 0) 
  selectd.options.length = countd; 

    // Place all matching categories into Options. 
  for( i = 0; i < arrayData.length; i++ ) { 
    string = arrayData[i].split( "|" ); 
    if( string[0] == design_name ) { 
      // Find the design colour options
      if( string[1].indexOf("X") != -1 ) selectd.options[countd++] = new Option( "Not Applicable" );
      if( string[1].indexOf("B") != -1 ) selectd.options[countd++] = new Option( "Black" );
      if( string[1].indexOf("E") != -1 ) selectd.options[countd++] = new Option( "Purple/Lilac" );
      if( string[1].indexOf("F") != -1 ) selectd.options[countd++] = new Option( "Fresh Green" );
      if( string[1].indexOf("G") != -1 ) selectd.options[countd++] = new Option( "Gold" );
      if( string[1].indexOf("H") != -1 ) selectd.options[countd++] = new Option( "Hot Raspberry" );
      if( string[1].indexOf("I") != -1 ) selectd.options[countd++] = new Option( "Baby Pink" );
      if( string[1].indexOf("K") != -1 ) selectd.options[countd++] = new Option( "Kingfisher Blue" );
      if( string[1].indexOf("L") != -1 ) selectd.options[countd++] = new Option( "Lilac" );
	  if( string[1].indexOf("M") != -1 ) selectd.options[countd++] = new Option( "Marigold" );
      if( string[1].indexOf("P") != -1 ) selectd.options[countd++] = new Option( "Purple" );
      if( string[1].indexOf("R") != -1 ) selectd.options[countd++] = new Option( "Red" );
      if( string[1].indexOf("S") != -1 ) selectd.options[countd++] = new Option( "Silver" );
      if( string[1].indexOf("U") != -1 ) selectd.options[countd++] = new Option( "Bubblegum Pink" );
      if( string[1].indexOf("V") != -1 ) selectd.options[countd++] = new Option( "Violet" );
      if( string[1].indexOf("W") != -1 ) selectd.options[countd++] = new Option( "White" );
      if( string[1].indexOf("Y") != -1 ) selectd.options[countd++] = new Option( "Baby Blue" );
	  if( string[1].indexOf("b") != -1 ) selectd.options[countd++] = new Option( "Blueberry" );
	  if( string[1].indexOf("c") != -1 ) selectd.options[countd++] = new Option( "Copper" );
      if( string[1].indexOf("e") != -1 ) selectd.options[countd++] = new Option( "Green & Black" );
      if( string[1].indexOf("g") != -1 ) selectd.options[countd++] = new Option( "Green & White" );
      if( string[1].indexOf("h") != -1 ) selectd.options[countd++] = new Option( "White on Black" );
	  if( string[1].indexOf("k") != -1 ) selectd.options[countd++] = new Option( "Sky Blue" );
      if( string[1].indexOf("l") != -1 ) selectd.options[countd++] = new Option( "Black on White" );
	  if( string[1].indexOf("m") != -1 ) selectd.options[countd++] = new Option( "Meadow Green" );
	  if( string[1].indexOf("p") != -1 ) selectd.options[countd++] = new Option( "Pink" );
	  if( string[1].indexOf("r") != -1 ) selectd.options[countd++] = new Option( "Raspberry" );
	  if( string[1].indexOf("s") != -1 ) selectd.options[countd++] = new Option( "Silver Grey" );
	  if( string[1].indexOf("x") != -1 ) selectd.options[countd++] = new Option( "Khaki" );
	  if( string[1].indexOf("y") != -1 ) selectd.options[countd++] = new Option( "Yellow" );
	  if( string[1].indexOf("z") != -1 ) selectd.options[countd++] = new Option( "Light Green" );

      if(( type_num == 4 ) && ( string[1].indexOf("O") != -1 ))
             selectd.options[countd++] = new Option( "See notes" );
    } 
  } 

  // Set which option from subcategory is to be selected 
  selectd.options.selectedIndex = 0; 
  // Give subcategory focus and select it 
  // select.focus(); 
} 
