$(document).ready(function(){
	
 var color = [/*Dependent On: 2_personalization */   
    {
        'When': 'yes',
        'Value': 'black-foil',
        'Text': 'black foil'
   }, 
   {
        'When': 'yes',
        'Value': 'blue-foil',
        'Text': 'blue foil'
   },
   {
        'When': 'yes',
        'Value': 'blush-foil_non-metallic',
        'Text': 'blush foil (non-metallic)'
   },
   {
        'When': 'yes',
        'Value': 'ecru-foil_non-metallic',
        'Text': 'ecru foil (non-metallic)'
   },
   {
        'When': 'yes',
        'Value': 'fuchsia-foil_non-metallic',
        'Text': 'fuchsia foil (non-metallic)'
   },
   {
        'When': 'yes',
        'Value': 'gold-foil',
        'Text': 'gold foil'
   },
   {
        'When': 'yes',
        'Value': 'hunter-foil',
        'Text': 'hunter foil'
   },
   {
        'When': 'yes',
        'Value': 'lilac-foil',
        'Text': 'lilac foil'
   },
   {
        'When': 'yes',
        'Value': 'midnight-foil_non-metallic',
        'Text': 'midnight foil (non-metallic)'
   },
   {
        'When': 'yes',
        'Value': 'pink-foil_non-metallic',
        'Text': 'pink foil (non-metallic)'
   },
   {
        'When': 'yes',
        'Value': 'purple-foil',
        'Text': 'purple foil'
   },
   {
        'When': 'yes',
        'Value': 'sage-foil',
        'Text': 'sage foil'
   },
   {
        'When': 'yes',
        'Value': 'silver-foil',
        'Text': 'silver foil'
   },
   {
        'When': 'yes',
        'Value': 'red-foil',
        'Text': 'red foil'
   },
   {
        'When': 'yes',
        'Value': 'rose-foil',
        'Text': 'rose foil'
   },
   {
        'When': 'yes',
        'Value': 'royal-foil',
        'Text': 'royal foil'
   },
   {
        'When': 'yes',
        'Value': 'teal-foil',
        'Text': 'teal foil'
   },{
        'When': 'yes',
        'Value': 'white-foil_non-metallic',
        'Text': 'white foil (non-metallic)'
   },
   {
        'When': 'yes',
        'Value': 'wine-foil',
        'Text': 'wine foil'
   },
    {
        'When': 'no',
        'Value': '',
        'Text': ''
   }];
	/* Connect #5_color to #2_personalization */
    jQuery("#5_color").cascade("#2_personalization", {
        list: color,
        template: commonTemplate,
        match: commonMatch
    });
	
	$("#2_personalization").bind("change", function(){
		 $('#3_text1').val(''); //set value to none when onchange
        $('#4_text2').val(''); //set value to none when onchange
        var opt = this.options[this.selectedIndex].value;
		
		if (opt == 'yes') {
			$('#personalization_div').show();
		}
		else{
			$('#personalization_div').hide();
		}
		});
		  $('#2_personalization').trigger("change");
	    $('#2_personalization').trigger("change.cascade");
});