$(document).ready(function(){

  var color = [/*Dependent On: 2_design */ 
  /* antique rose */{
    'When': 'antique_rose',
    'Value': 'black',
    'Text': 'black'
  }, {
    'When': 'antique_rose',
    'Value': 'brown',
    'Text': 'brown'
  }, {
    'When': 'antique_rose',
    'Value': 'hunter',
    'Text': 'hunter'
  }, {
    'When': 'antique_rose',
    'Value': 'mauve',
    'Text': 'mauve'
  }, /* bar_mitzvah */ {
    'When': 'bar_mitzvah',
    'Value': 'default',
    'Text': 'default'
  }, /* bat_mitzvah */ {
    'When': 'bat_mitzvah',
    'Value': 'default',
    'Text': 'default'
  },/* bib */ {
    'When': 'bib',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'bib',
    'Value': 'blue_brown',
    'Text': 'blue/brown'
  }, {
    'When': 'bib',
    'Value': 'green',
    'Text': 'green'
  }, {
    'When': 'bib',
    'Value': 'green_brown',
    'Text': 'green/brown'
  }, {
    'When': 'bib',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'bib',
    'Value': 'pink_brown',
    'Text': 'pink/brown'
  }, {
    'When': 'bib',
    'Value': 'yellow',
    'Text': 'yellow'
  }, {
    'When': 'bib',
    'Value': 'yellow_brown',
    'Text': 'yellow/brown'
  },/* bird */ {
    'When': 'bird',
    'Value': 'brown',
    'Text': 'brown'
  }, {
    'When': 'bird',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'bird',
    'Value': 'light_blue',
    'Text': 'light blue'
  }, {
    'When': 'bird',
    'Value': 'lime',
    'Text': 'lime'
  }, {
    'When': 'bird',
    'Value': 'orange',
    'Text': 'orange'
  }, {
    'When': 'bird',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'bird',
    'Value': 'red',
    'Text': 'red'
  }, {
    'When': 'bird',
    'Value': 'sage',
    'Text': 'sage'
  }, {
    'When': 'bird',
    'Value': 'turquoise',
    'Text': 'turquoise'
  }, /*birthday_balloon*/ {
    'When': 'birthday_balloon',
    'Value': 'default',
    'Text': 'default'
  },/*birthday_cake*/ {
    'When': 'birthday_cake',
    'Value': 'default',
    'Text': 'default'
  },/* carriage */ {
    'When': 'carriage',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'carriage',
    'Value': 'blue_brown',
    'Text': 'blue/brown'
  }, {
    'When': 'carriage',
    'Value': 'green',
    'Text': 'green'
  }, {
    'When': 'carriage',
    'Value': 'green_brown',
    'Text': 'green/brown'
  }, {
    'When': 'carriage',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'carriage',
    'Value': 'pink_brown',
    'Text': 'pink/brown'
  }, {
    'When': 'carriage',
    'Value': 'yellow',
    'Text': 'yellow'
  }, {
    'When': 'carriage',
    'Value': 'yellow_brown',
    'Text': 'yellow/brown'
  },/* damask */ {
    'When': 'damask',
    'Value': 'aqua',
    'Text': 'aqua'
  }, {
    'When': 'damask',
    'Value': 'black',
    'Text': 'black'
  }, {
    'When': 'damask',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'damask',
    'Value': 'cocoa',
    'Text': 'cocoa'
  }, {
    'When': 'damask',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'damask',
    'Value': 'lime',
    'Text': 'lime'
  }, {
    'When': 'damask',
    'Value': 'navy',
    'Text': 'navy'
  }, {
    'When': 'damask',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'damask',
    'Value': 'red',
    'Text': 'red'
  }, {
    'When': 'damask',
    'Value': 'sage',
    'Text': 'sage'
  }, /* damask photo */ {
    'When': 'damask_photo',
    'Value': 'aqua',
    'Text': 'aqua'
  }, {
    'When': 'damask_photo',
    'Value': 'black',
    'Text': 'black'
  }, {
    'When': 'damask_photo',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'damask_photo',
    'Value': 'orange',
    'Text': 'orange'
  }, {
    'When': 'damask_photo',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'damask_photo',
    'Value': 'sage',
    'Text': 'sage'
  }, /* double_happiness */ {
    'When': 'double_happiness',
    'Value': 'default',
    'Text': 'default'
  },/* falling_leaves */ {
    'When': 'falling_leaves',
    'Value': 'default',
    'Text': 'default'
  },/* falling_snow */ {
    'When': 'falling_snow',
    'Value': 'aqua',
    'Text': 'aqua'
  }, {
    'When': 'falling_snow',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'falling_snow',
    'Value': 'brown',
    'Text': 'brown'
  }, {
    'When': 'falling_snow',
    'Value': 'fuchsia',
    'Text': 'fuchsia'
  }, {
    'When': 'falling_snow',
    'Value': 'green',
    'Text': 'green'
  }, {
    'When': 'falling_snow',
    'Value': 'grey',
    'Text': 'grey'
  }, {
    'When': 'falling_snow',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'falling_snow',
    'Value': 'navy_blue',
    'Text': 'navy blue'
  }, {
    'When': 'falling_snow',
    'Value': 'red',
    'Text': 'red'
  }, /* flip_flops */ {
    'When': 'flip_flops',
    'Value': 'fushia',
    'Text': 'fushia'
  }, {
    'When': 'flip_flops',
    'Value': 'lime',
    'Text': 'lime'
  }, {
    'When': 'flip_flops',
    'Value': 'orange',
    'Text': 'orange'
  }, {
    'When': 'flip_flops',
    'Value': 'purple',
    'Text': 'purple'
  }, {
    'When': 'flip_flops',
    'Value': 'red',
    'Text': 'red'
  }, {
    'When': 'flip_flops',
    'Value': 'turquoise',
    'Text': 'turquoise'
  },/* gingham_blue_cross */ {
    'When': 'gingham_blue_cross',
    'Value': 'default',
    'Text': 'default'
  },/* gingham_pink_cross */ {
    'When': 'gingham_pink_cross',
    'Value': 'default',
    'Text': 'default'
  },/* graduation_caps */ {
    'When': 'graduation_caps',
    'Value': 'default',
    'Text': 'default'
  },/* graduation_stripes */ {
    'When': 'graduation_stripes',
    'Value': 'blue_brown',
    'Text': 'blue/brown'
  }, {
    'When': 'graduation_stripes',
    'Value': 'green_brown',
    'Text': 'green/brown'
  }, {
    'When': 'graduation_stripes',
    'Value': 'orange_brown',
    'Text': 'orange/brown'
  }, {
    'When': 'graduation_stripes',
    'Value': 'pink_brown',
    'Text': 'pink/brown'
  }, {
    'When': 'graduation_stripes',
    'Value': 'purple_brown',
    'Text': 'purple/brown'
  }, /* halloween_ghost */ {
    'When': 'halloween_ghost',
    'Value': 'default',
    'Text': 'default'
  }, /* halloween_pumpkin */ {
    'When': 'halloween_pumpkin',
    'Value': 'default',
    'Text': 'default'
  },/* holiday_decorations */ {
    'When': 'holiday_decorations',
    'Value': 'default',
    'Text': 'default'
  },/* holiday_ornaments */ {
    'When': 'holiday_ornaments',
    'Value': 'default',
    'Text': 'default'
  },/* icon_photo */ {
    'When': 'icon_photo',
    'Value': '',
    'Text': ''
  }, /* las_vegas */ {
    'When': 'las_vegas',
    'Value': 'default',
    'Text': 'default'
  },/* monogram_filigree */ {
    'When': 'monogram_filigree',
    'Value': 'aqua',
    'Text': 'aqua'
  }, {
    'When': 'monogram_filigree',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'monogram_filigree',
    'Value': 'cocoa',
    'Text': 'cocoa'
  }, {
    'When': 'monogram_filigree',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'monogram_filigree',
    'Value': 'lime_green',
    'Text': 'lime green'
  }, {
    'When': 'monogram_filigree',
    'Value': 'navy',
    'Text': 'navy'
  }, {
    'When': 'monogram_filigree',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'monogram_filigree',
    'Value': 'red',
    'Text': 'red'
  }, {
    'When': 'monogram_filigree',
    'Value': 'sage',
    'Text': 'sage'
  }, /* onesie */ {
    'When': 'onesie',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'onesie',
    'Value': 'blue_brown',
    'Text': 'blue/brown'
  }, {
    'When': 'onesie',
    'Value': 'green',
    'Text': 'green'
  }, {
    'When': 'onesie',
    'Value': 'green_brown',
    'Text': 'green/brown'
  }, {
    'When': 'onesie',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'onesie',
    'Value': 'pink_brown',
    'Text': 'pink/brown'
  }, {
    'When': 'onesie',
    'Value': 'yellow',
    'Text': 'yellow'
  }, {
    'When': 'onesie',
    'Value': 'yellow_brown',
    'Text': 'yellow/brown'
  },/* pacifier*/ {
    'When': 'pacifier',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'pacifier',
    'Value': 'blue_brown',
    'Text': 'blue/brown'
  }, {
    'When': 'pacifier',
    'Value': 'green',
    'Text': 'green'
  }, {
    'When': 'pacifier',
    'Value': 'green_brown',
    'Text': 'green/brown'
  }, {
    'When': 'pacifier',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'pacifier',
    'Value': 'pink_brown',
    'Text': 'pink/brown'
  }, {
    'When': 'pacifier',
    'Value': 'yellow',
    'Text': 'yellow'
  }, {
    'When': 'pacifier',
    'Value': 'yellow_brown',
    'Text': 'yellow/brown'
  },/* pair_of_aces */ {
    'When': 'pair_of_aces',
    'Value': 'default',
    'Text': 'default'
  },/* polka dots */ {
    'When': 'polka_dots',
    'Value': 'beach_aqua',
    'Text': 'beach aqua'
  }, {
    'When': 'polka_dots',
    'Value': 'brown_orange',
    'Text': 'brown & orange'
  }, {
    'When': 'polka_dots',
    'Value': 'candy_red',
    'Text': 'candy red'
  }, {
    'When': 'polka_dots',
    'Value': 'pink_brown',
    'Text': 'pink & brown'
  }, {
    'When': 'polka_dots',
    'Value': 'vintage_green',
    'Text': 'vintage green'
  }, /* roulette */ {
    'When': 'roulette',
    'Value': 'default',
    'Text': 'default'
  }, /* snowflakes */ {
    'When': 'snowflakes',
    'Value': 'aqua',
    'Text': 'aqua'
  }, {
    'When': 'snowflakes',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'snowflakes',
    'Value': 'brown',
    'Text': 'brown'
  }, {
    'When': 'snowflakes',
    'Value': 'fuchsia',
    'Text': 'fuchsia'
  }, {
    'When': 'snowflakes',
    'Value': 'green',
    'Text': 'green'
  }, {
    'When': 'snowflakes',
    'Value': 'grey',
    'Text': 'grey'
  }, {
    'When': 'snowflakes',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'snowflakes',
    'Value': 'navy_blue',
    'Text': 'navy blue'
  }, {
    'When': 'snowflakes',
    'Value': 'red',
    'Text': 'red'
  }, /* snow_couple */ {
    'When': 'snow_couple',
    'Value': 'default',
    'Text': 'default'
  },/* stripes_monogram */ {
    'When': 'stripes_monogram',
    'Value': 'beach_aqua',
    'Text': 'beach aqua'
  }, {
    'When': 'stripes_monogram',
    'Value': 'blue_brown',
    'Text': 'blue & brown'
  }, {
    'When': 'stripes_monogram',
    'Value': 'brown_orange',
    'Text': 'brown & orange'
  }, {
    'When': 'stripes_monogram',
    'Value': 'candy_red',
    'Text': 'candy red'
  }, {
    'When': 'stripes_monogram',
    'Value': 'pink_brown',
    'Text': 'pink & brown'
  }, {
    'When': 'stripes_monogram',
    'Value': 'sweet_cocoa',
    'Text': 'sweet cocoa'
  }, {
    'When': 'stripes_monogram',
    'Value': 'vintage_pink',
    'Text': 'vintage pink'
  }, /*sweet_sixteen */ {
    'When': 'sweet_sixteen',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'sweet_sixteen',
    'Value': 'fuchsia',
    'Text': 'fuchsia'
  }, {
    'When': 'sweet_sixteen',
    'Value': 'green',
    'Text': 'green'
  }, {
    'When': 'sweet_sixteen',
    'Value': 'purple',
    'Text': 'purple'
  }, /* wedding_cake*/ {
    'When': 'wedding_cake',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'wedding_cake',
    'Value': 'light_blue',
    'Text': 'light blue'
  }, {
    'When': 'wedding_cake',
    'Value': 'pink',
    'Text': 'pink'
  }, /*  */ {
    'When': 'birthday_numbers',
    'Value': 'default',
    'Text': 'default'
  },/* diamond ring */ {
    'When': 'diamond_ring',
    'Value': 'blue',
    'Text': 'blue'
  }, {
    'When': 'diamond_ring',
    'Value': 'gold',
    'Text': 'gold'
  }, {
    'When': 'diamond_ring',
    'Value': 'green',
    'Text': 'green'
  }, {
    'When': 'diamond_ring',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'diamond_ring',
    'Value': 'silver',
    'Text': 'silver'
  },/* summer flowers */ {
    'When': 'summer_flowers',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'summer_flowers',
    'Value': 'lime',
    'Text': 'lime'
  }, {
    'When': 'summer_flowers',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'summer_flowers',
    'Value': 'turquoise',
    'Text': 'turquoise'
  },{
    'When': 'christmas_tree_frame',
    'Value': 'default',
    'Text': 'default'
  },{
    'When': 'christmas_tree_ornament',
    'Value': 'default',
    'Text': 'default'
  },{
    'When': 'merry_christmas',
    'Value': 'default',
    'Text': 'default'
  }, ];
  var animal = [/*Dependent On: 2_design */{
    'When': 'jungle_animals',
    'Value': 'elephant',
    'Text': 'elephant'
  }, {
    'When': 'jungle_animals',
    'Value': 'giraffe',
    'Text': 'giraffe'
  }, {
    'When': 'jungle_animals',
    'Value': 'hippo',
    'Text': 'hippo'
  }, {
    'When': 'jungle_animals',
    'Value': 'monkey',
    'Text': 'monkey'
  }, {
    'When': 'jungle_animals',
    'Value': 'tiger',
    'Text': 'tiger'
  }, {
    'When': 'jungle_animals',
    'Value': 'zebra',
    'Text': 'zebra'
  }, ];
  var icon = [/*Dependent On: 2_design */{
    'When': 'icon_photo',
    'Value': 'balloons',
    'Text': 'balloons'
  }, {
    'When': 'icon_photo',
    'Value': 'carriage',
    'Text': 'carriage'
  }, {
    'When': 'icon_photo',
    'Value': 'cherry_blossoms',
    'Text': 'cherry blossoms'
  }, {
    'When': 'icon_photo',
    'Value': 'cross',
    'Text': 'cross'
  }, {
    'When': 'icon_photo',
    'Value': 'double_happiness',
    'Text': 'double happiness'
  }, {
    'When': 'icon_photo',
    'Value': 'flip_flops',
    'Text': 'flip flops'
  }, {
    'When': 'icon_photo',
    'Value': 'graduation_cap',
    'Text': 'graduation cap'
  }, {
    'When': 'icon_photo',
    'Value': 'leaf',
    'Text': 'leaf'
  }, {
    'When': 'icon_photo',
    'Value': 'linked_hearts',
    'Text': 'linked hearts'
  }, {
    'When': 'icon_photo',
    'Value': 'snowflake',
    'Text': 'snowflake'
  }, {
    'When': 'icon_photo',
    'Value': 'star_of_david',
    'Text': 'star of david'
  }, {
    'When': 'icon_photo',
    'Value': 'text',
    'Text': 'text'
  }, ];
  var icontxcolor = [/*Dependent On: 2_design */{
    'When': 'icon_photo',
    'Value': 'black',
    'Text': 'black'
  }, {
    'When': 'icon_photo',
    'Value': 'white',
    'Text': 'white'
  }, ];
  var iconbkcolor = [/*Dependent On: 2_design */{
    'When': 'icon_photo',
    'Value': 'aqua',
    'Text': 'aqua'
  }, {
    'When': 'icon_photo',
    'Value': 'black',
    'Text': 'black'
  }, {
    'When': 'icon_photo',
    'Value': 'brown',
    'Text': 'brown'
  }, {
    'When': 'icon_photo',
    'Value': 'fuchsia',
    'Text': 'fuchsia'
  }, {
    'When': 'icon_photo',
    'Value': 'lavender',
    'Text': 'lavender'
  }, {
    'When': 'icon_photo',
    'Value': 'light_blue',
    'Text': 'light blue'
  }, {
    'When': 'icon_photo',
    'Value': 'lime',
    'Text': 'lime'
  }, {
    'When': 'icon_photo',
    'Value': 'navy_blue',
    'Text': 'navy blue'
  }, {
    'When': 'icon_photo',
    'Value': 'orange',
    'Text': 'orange'
  }, {
    'When': 'icon_photo',
    'Value': 'pink',
    'Text': 'pink'
  }, {
    'When': 'icon_photo',
    'Value': 'red',
    'Text': 'red'
  }, {
    'When': 'icon_photo',
    'Value': 'sage',
    'Text': 'sage'
  }, ];
  var fee = [/*Dependent On: 2_design */{
    'When': 'damask_photo',
    'Value': 'photo_setup_fee',
    'Text': '$20 photo set up fee'
  }, {
    'When': 'icon_photo',
    'Value': 'photo_setup_fee',
    'Text': '$20 photo set up fee'
  }, ];
  
  /* Connect #3_color to #2_design */
  $("#3_color").cascade("#2_design", {
    list: color,
    template: commonTemplate,
    match: commonMatch
  });
  $("#4_animal").cascade("#2_design", {
    list: animal,
    template: commonTemplate,
    match: commonMatch
  });
  $("#5_icon").cascade("#2_design", {
    list: icon,
    template: commonTemplate,
    match: commonMatch
  });
  $("#6_icon_textcolor").cascade("#2_design", {
    list: icontxcolor,
    template: commonTemplate,
    match: commonMatch
  });
  $("#7_bkcolor").cascade("#2_design", {
    list: iconbkcolor,
    template: commonTemplate,
    match: commonMatch
  });
  /* Connect #8_fee to #2_design */
  $("#8_fee").cascade("#2_design", {
    list: fee,
    template: commonTemplate,
    match: commonMatch
  });
  
  $("#2_design").change(morf);
  $("#5_icon").change(morf);
  function morf(){
    var opt = $("#2_design").val();
    //var opt = this.options[this.selectedIndex].value;
    var icon = $("#5_icon").val();
    
    //alert (icon);
    $('#9_names').val('');
    $('#10_age').val('');
    $('#11_year').val('');
    $('#12_monogram').val('');
    $('#13_text').val('');
    $('#14_text1').val('');
    $('#15_text2').val('');
    $('#16_text3').val('');
    $('#17_text4').val('');
    
    if (opt == "damask_photo") {
    
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide();
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 30);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 30);
      $('#16_text3div').hide();
      $('#17_text4div').hide();
      
    }
    
    
    if ((opt == "antique_rose") || (opt == "summer_flowers")) {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').show();
      setMaxLength('#9_names', 24);
      $('#10_agediv').hide();
      $('#11_yeardiv').hide();
      $('#12_monogramdiv').hide();
      $('#13_textdiv').show();
      setMaxLength('#13_text', 30);
      $('#14_text1div').hide();
      $('#15_text2div').hide();
      $('#16_text3div').hide();
      $('#17_text4div').hide();
      
    };
    if ((opt == "bar_mitzvah") || (opt == "bat_mitzvah") || (opt == "bib") || (opt == "bird") || (opt == "carriage") || (opt == "damask") || (opt == "double_happiness") || (opt == "falling_leaves") || (opt == "falling_snow") || (opt == "flip_flops") || (opt == "gingham_blue_cross") || (opt == "gingham_pink_cross") || (opt == "halloween_ghost") || (opt == "halloween_pumpkin") || (opt == "holiday_decorations") || (opt == "holiday_ornaments") || (opt == "las_vegas") || (opt == "onesie") || (opt == "pacifier") || (opt == "pair_of_aces") || (opt == "polka_dots") || (opt == "roulette") || (opt == "snowflakes") || (opt == "snow_couple") || (opt == "sweet_sixteen") || (opt == "wedding_cake")) {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide();
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 30);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 30);
      $('#16_text3div').hide();
      $('#17_text4div').hide();
      
    };
    if (opt == "jungle_animals") {
      $('#icondiv').hide();
      $('#3_colordiv').hide();
      $('#animaldiv').show();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide();
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 30);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 30);
      $('#16_text3div').hide();
      $('#17_text4div').hide();
    }
    
    if (opt == "birthday_balloon") {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      
      $('#10_agediv').show();
      setMaxLength('#10_age', 3);
      $('#11_yeardiv').hide();
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 24);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 30);
      $('#16_text3div').hide();
      $('#17_text4div').hide();
      
    };
    if (opt == "birthday_cake") {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide();
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 24);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 30);
      $('#16_text3div').show();
      setMaxLength('#16_text3', 30);
      $('#17_text4div').hide();
      
    };
    if (opt == "birthday_numbers") {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').show();
      setMaxLength('#10_age', 3);
      $('#11_yeardiv').hide();
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 24);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 24);
      $('#16_text3div').show();
      setMaxLength('#16_text3', 30);
      $('#17_text4div').hide();
    };
    if (opt == "graduation_caps") {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').show();
      setMaxLength('#11_year', 4);
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 24);
      $('#15_text2div').hide();
      $('#16_text3div').hide();
      $('#17_text4div').hide();
      
    };
    if (opt == "graduation_stripes") {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').show();
      setMaxLength('#11_year', 4);
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 24);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 24);
      $('#16_text3div').hide();
      $('#17_text4div').hide();
      
    };
    if ((opt == "stripes_monogram") || (opt == "monogram_filigree")) {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide();
      
      $('#12_monogramdiv').show();
      setMaxLength('#12_monogram', 1);
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 30);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 30);
      $('#16_text3div').hide();
      $('#17_text4div').hide();
      
    };
    if ((opt == "diamond_ring")) {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide(); 
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 15);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 20);
      $('#16_text3div').show();
      setMaxLength('#16_text3', 20);
      $('#17_text4div').hide(); 
    };
	if ((opt == "merry_christmas")) {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide(); 
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 20);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 24);
      $('#16_text3div').hide();
      $('#17_text4div').hide(); 
    };
	if ((opt == "christmas_tree_frame")) {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide(); 
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 30);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 30);
      $('#16_text3div').hide();
      $('#17_text4div').hide(); 
    };
	if ((opt == "christmas_tree_ornament")) {
      $('#icondiv').hide();
      $('#3_colordiv').show();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide(); 
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 30);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 30);
      $('#16_text3div').hide();
      $('#17_text4div').hide(); 
    };
    
    if ((opt == "icon_photo") && (icon == "text")) {
      $('#icondiv').show();
      $('#3_colordiv').hide();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide();
      
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 6);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 20);
      $('#16_text3div').show();
      setMaxLength('#16_text3', 24);
      $('#17_text4div').show();
      setMaxLength('#17_text4', 24);
      
    };
    if ((opt == "icon_photo") && (icon != "text")) {
      $('#icondiv').show();
      $('#3_colordiv').hide();
      $('#animaldiv').hide();
      $('#8_feediv').hide();
      $('#9_namesdiv').hide();
      $('#10_agediv').hide();
      $('#11_yeardiv').hide();
      
      $('#12_monogramdiv').hide();
      $('#13_textdiv').hide();
      $('#14_text1div').show();
      setMaxLength('#14_text1', 24);
      $('#15_text2div').show();
      setMaxLength('#15_text2', 20);
      $('#16_text3div').hide();
      $('#17_text4div').hide();
      
    };
      };
  /* ----------- Code For Input Length Changes -----------------*/
  
  function setMaxLength(element_id, length){
    $(element_id).attr("maxlength", length);
    
    //$(element_id).attr("size", length);
    note = element_id + '_note';
    if (length < 2) {
      $(note).html('(up to ' + length + ' characters)');
      $(element_id).css({
        'width': '20px'
      });
    }
    else {
      $(note).html('(up to ' + length + ' characters)');
      $(element_id).css({
        'width': 'auto'
      });
    }
  }
  $('#2_design').trigger("change");
  $('#2_design').trigger("change.cascade");
});
