function NumClExposure_block(myWordClass, myWord, myWordTranslate, animateNounTranslate, inanimateNounTranslate, reps, exposure_text, task_type) {

    // myWordClass: ['Number Word', 'Class Word']
    // myWordTranslate: [['two','three'],['animate','inanimate']]
    // exposure_text: ['exposure text for Num','exposure text for Cl']
    // reps: repetitions for each word class
	var exposure_trials = [];
    
    // ******* create sequence of word classes
    var seq_all_trials_in_word_class = [];
    var s = 0;    
    for (var w=0; w<myWordClass.length; w++){
        for (var r=0; r<reps; r++){
            seq_all_trials_in_word_class[s] = myWordClass[w];
            s+=1;
        }
    }
    // seq_all_trials_in_word_class: ['Number Word','Number Word','Number Word',...,'Number Word','Class Word','Class Word','Class Word',...,'Class Word'];
    
    var total_number_of_trials = seq_all_trials_in_word_class.length;
    // randomise sequence
	var if_consecutive_items = true;
    var max_num_consecutive_items = 2;
    while (if_consecutive_items == true){
        seq_all_trials_in_word_class = shuffle(seq_all_trials_in_word_class);
        if_consecutive_items = if_consecutive(seq_all_trials_in_word_class, max_num_consecutive_items+1);		
        // ensure that a same word class does not present more than twice consecutively
    };
    // e.g., seq_all_trials_in_word_class: ['Class Word','Number Word','Number Word','Class Word','Class Word','Number Word','Class Word','Class Word','Number Word',...];

    // ******* create sequence of the first word for each word class
    var seq_first_word_withinWordClass = [];
    for (var w=0; w<myWordClass.length; w++){
        seq_first_word_withinWordClass[w] = [];
        var s = 0;
        for (var v=0; v<myWordTranslate[w].length; v++){
            for (var r=0; r<reps/2+1; r++){
                seq_first_word_withinWordClass[w][s] = myWordTranslate[w][v];
                s+=1;
            }
        }
    }
    
    // seq_words_withinWordClass: [['two','two',...,'two',..,'three','three',...,'three'],['animate','animate',...,'animate','inanimate','inanimate',...,'inanimate']]
    // shuffle this sequence
    var max_num_consecutive_items = 2;
    for (var w=0; w<myWordClass.length; w++){
        var if_consecutive_items = true;
        while (if_consecutive_items == true){
            seq_first_word_withinWordClass[w] = shuffle(seq_first_word_withinWordClass[w]);
            if_consecutive_items = if_consecutive(seq_first_word_withinWordClass[w], max_num_consecutive_items+1);		
            // ensure that a same word does not present more than twice consecutively within a word class
        }
    };

    // ******* initiate trial number for each word class
    var trl_num_currWrdClss = [];
    for (var w=0; w<myWordClass.length; w++){
        trl_num_currWrdClss[w] = 1;
    }

    // ******* construct the trials
    for (var t = 0; t < total_number_of_trials; t++) {

        var word_class_name = seq_all_trials_in_word_class[t]; // 'Number Word' or 'Class Word'
        var wordClassID = myWordClass.indexOf(word_class_name); // 0 if word_class_name=='Number Word'; 1 if word_class_name=='Class Word'
        var trl_num_currWordClass = trl_num_currWrdClss[wordClassID]; // the trial number for the current word class (initial value is 0 and are added up by 1 every loop)
        trl_num_currWrdClss[wordClassID] += 1; // add 1 for trial number for each word class per loop 
        var target_names = myWord[wordClassID]; // 'two' and 'three' if word_class_name=='Number Word'; 'animate' and 'inanimate' if word_class_name=='Cl Word'
        var target_names_trnsl = myWordTranslate[wordClassID]; 
        var wordname1_trnsl = seq_first_word_withinWordClass[wordClassID][trl_num_currWordClass];
        var wordID1 = target_names_trnsl.indexOf(wordname1_trnsl);
        var wordname1 = target_names[wordID1];
        if(wordID1==0){var wordID2=1}else{var wordID2=0};
        var wordname2 = target_names[wordID2];
        var wordname2_trnsl = target_names_trnsl[wordID2];
s
        // randomly choose the nouns
        var seq = range(0,100).slice(0, animateNounTranslate.length);
        seq = shuffle(seq);
        var animate_noun_trnsl = [animateNounTranslate[seq[0]],animateNounTranslate[seq[1]]];
        var inanimate_noun_trnsl = [inanimateNounTranslate[seq[0]],inanimateNounTranslate[seq[1]]];
        // if the word class is Num (e.g., the word_name_trnsl=='two'), then choose two nouns with the same class of animate/inanimate) for target (green frame) vs foil (dimmed) numbers
        // if the word class is Cl, then choose two nouns with the same number but different Cl, target (green frame) Cl vs foil Cl (dimmed)
        var image_name1;
        var image_name2;
        if (word_class_name=='Number Word'){ // if 'Number Word'
            var animate_or_inanimate = shuffle([0,1]);
            if (animate_or_inanimate[0]==0) {
                image_name1 = wordname1_trnsl+' '+animate_noun_trnsl[0];
                image_name2 = wordname2_trnsl+' '+animate_noun_trnsl[1];
            } else {
                image_name1 = wordname1_trnsl+' '+inanimate_noun_trnsl[0];
                image_name2 = wordname2_trnsl+' '+inanimate_noun_trnsl[1];
            }
        } else { // if 'Cl Word'
            var num_name_choice = shuffle([0,1]);
            var num_name_trnsl = myWordTranslate[myWordClass.indexOf('Number Word')][num_name_choice[0]];
            if (wordname1_trnsl=='animate') { // if animate
               image_name1 = num_name_trnsl+' '+animate_noun_trnsl[0];
               image_name2 = num_name_trnsl+' '+inanimate_noun_trnsl[0];
            } else { // if inanimate
               image_name1 = num_name_trnsl+' '+inanimate_noun_trnsl[0];
               image_name2 = num_name_trnsl+' '+animate_noun_trnsl[0];
            }       
        } 
        
        console.log([image_name1,image_name2])
        console.log([wordname1,wordname1_trnsl,wordname2,wordname2_trnsl])

        // assign images
		var imagePos = ['left','right']; // in exposure trials, image sequence is always illustration of image at left position first followed by right position
        var image_blank = '<img src="'+img_path+"empty_image.png"+'" class="Cntr0" >';
        // subtrial 2 image1 hightlighted with green frame with image2 dimmed
        var image_subtrial0 = [];
        image_subtrial0[0] = image_blank;
        image_subtrial0[1] = '<img src="'+img_path+image_name1+'.jpg" class="'+imagePos[0]+'" style="transform:none; box-shadow:none; opacity:0.2;">';
        image_subtrial0[2] = '<img src="'+img_path+image_name2+'.jpg" class="'+imagePos[1]+'" style="transform:none; box-shadow:none; opacity:0.2;">';
        var image_subtrial1 = [];
        image_subtrial1[0] = image_blank;
        image_subtrial1[1] = '<img src="'+img_path+image_name1+'.jpg" class="'+imagePos[0]+'" style="transform:none; box-shadow:none; border:6px solid green;">';
        image_subtrial1[2] = '<img src="'+img_path+image_name2+'.jpg" class="'+imagePos[1]+'" style="transform:none; box-shadow:none; opacity:0.2;">';
        // subtrial 1 image2 hightlighted with green frame with image1 dimmed
        var image_subtrial2 = [];
        image_subtrial2[0] = image_blank;
        image_subtrial2[1] = '<img src="'+img_path+image_name1+'.jpg" class="'+imagePos[0]+'" style="transform:none; box-shadow:none; opacity:0.2;">';
        image_subtrial2[2] = '<img src="'+img_path+image_name2+'.jpg" class="'+imagePos[1]+'" style="transform:none; box-shadow:none; border:6px solid green;">';
        
        // assign texts
        var instruction_text = exposure_text[wordClassID];
        var word_class_name_text = '<div class="top1"><strong>'+word_class_name+':</strong></div>';
        // for subtrial 1
        var wordname_text1 = '<div class="top2"><strong>'+wordname1+'</strong></div>';
        var wordclass_wordname_text1 = word_class_name_text+wordname_text1;
        var wordclass_wordname_instr_text1 = wordclass_wordname_text1+instruction_text;
        // for subtrial 2
        var wordname_text2 = '<div class="top2"><strong>'+wordname2+'</strong></div>';
        var wordclass_wordname_text2 = word_class_name_text+wordname_text2;
        var wordclass_wordname_instr_text2 = wordclass_wordname_text2+instruction_text;

        exposure_trials.push({trl_num:t+1, trl_num_wrdclss:trl_num_currWordClass, wrd_clss:word_class_name, 
            wrd1:wordname1, wrd1_trnsl:wordname1_trnsl, wrd2:wordname2, wrd2_trnsl:wordname2_trnsl,img_subtrl0:image_subtrial0,
            img_subtrl1:image_subtrial1, img_subtrl2:image_subtrial2, img_pos:imagePos, img_blank:image_blank, 
            img_name1:image_name1, img_name2:image_name2, 
            wrdclss_txt:word_class_name_text, wrdclss_wrd_txt1:wordclass_wordname_text1, 
            wrdclss_wrd_instr_txt1:wordclass_wordname_instr_text1, wrdclss_wrd_txt2:wordclass_wordname_text2, 
            wrdclss_wrd_instr_txt2:wordclass_wordname_instr_text2});
    }

	// for save csv
	var csv_header = ['','trial_overall','trial_wordClass','wordClass','exposure_word','Translate',
        'target_image','target_image_position','saveTime\n'];
	var data_to_save = csv_header;

    //// ******************* trial setup according to the randomised pairing *****************************
    var show_word_class_text = {
        type: 'html-keyboard-response',
        stimulus: jsPsych.timelineVariable('img_subtrl0'), 
        choices: jsPsych.NO_KEYS,
        prompt: jsPsych.timelineVariable('wrdclss_txt'),
        response_ends_trial: false,
        trial_duration: 800
    };
    
    var show_image_subtrial1 = {
        type: 'html-keyboard-response',
        stimulus: jsPsych.timelineVariable('img_subtrl1'), // calls image stimuli
        choices: jsPsych.NO_KEYS,
        prompt: jsPsych.timelineVariable('wrdclss_wrd_txt1'),
        response_ends_trial: false,
        trial_duration: 800
    };

    var show_instruction_hold_press_subtrial1 = {
		type: 'html-keyboard-response',
		stimulus: jsPsych.timelineVariable('img_subtrl1'),
		choices: jsPsych.NO_KEYS,
		prompt: jsPsych.timelineVariable('wrdclss_wrd_instr_txt1'),
		response_ends_trial: false, //prevents response from ending trial
		trial_duration: 500
	};

    var press_to_continue_subtrial1 = {
        // keeps displaying image until participant presses spacebar
        type: 'html-keyboard-response',
        stimulus: jsPsych.timelineVariable('img_subtrl1'), // calls image stimuli
        choices: [32], // only allows progression using spacebar
		prompt: jsPsych.timelineVariable('wrdclss_wrd_instr_txt1'),
    };

    var show_image_subtrial2 = {
        type: 'html-keyboard-response',
        stimulus: jsPsych.timelineVariable('img_subtrl2'), // calls image stimuli
        choices: jsPsych.NO_KEYS,
        prompt: jsPsych.timelineVariable('wrdclss_wrd_instr_txt2'),
        response_ends_trial: false,
        trial_duration: 800
    };

	var show_instruction_hold_press_subtrial2 = {
		type: 'html-keyboard-response',
		stimulus: jsPsych.timelineVariable('img_subtrl2'),
		choices: jsPsych.NO_KEYS,
		prompt: function(){
	  			           // ----------------------------- SAVE DATA (csv)------------------------------------
		 	 	           var trl_num_overall = jsPsych.timelineVariable('trl_num',true);
                           var trl_num_wordclass = jsPsych.timelineVariable('trl_num_wrdclss',true);
                           var wordClass = jsPsych.timelineVariable('wrd_clss',true);
			 	           var wordName1 = jsPsych.timelineVariable('wrd1',true);
			 	           var wordNameTranslate1 = jsPsych.timelineVariable('wrd1_trnsl',true);
                           var wordName2 = jsPsych.timelineVariable('wrd2',true);
			 	           var wordNameTranslate2 = jsPsych.timelineVariable('wrd12_trnsl',true);
                           var imageName1 = jsPsych.timelineVariable('img_name1',true);
                           var imageName2 = jsPsych.timelineVariable('img_name2',true);
                           var imagePos = jsPsych.timelineVariable('img_pos',true);
			 	           var time = getTime();
				           var data_snglTrl1 = [trl_num_overall, trl_num_wordclass, wordClass, wordName1, wordNameTranslate1,  
                                  imageName1, imagePos[0], time+'\n'];
                           var data_snglTrl2 = [trl_num_overall, trl_num_wordclass, wordClass, wordName2, wordNameTranslate2, 
                                  imageName2, imagePos[1], time+'\n'];
				           data_to_save = data_to_save.concat(data_snglTrl1).concat(data_snglTrl2);
				           var data_to_save_string = data_to_save.toString();
						   var csvName = window.saveFileNameHeader+'_'+task_type+'.csv';
				           saveData(csvName,data_to_save_string);
				           return jsPsych.timelineVariable('wrdclss_wrd_instr_txt2',true)
				         },
		response_ends_trial: false, //prevents response from ending trial
		trial_duration: 500
	    };

	var press_to_continue_subtrial2 = {
        // keeps displaying image until participant presses spacebar
        type: 'html-keyboard-response',
        stimulus: jsPsych.timelineVariable('img_subtrl2'), // calls image stimuli
        choices: [32], // only allows progression using spacebar
		prompt: jsPsych.timelineVariable('wrdclss_wrd_instr_txt2')
        };

	// var blank_page = {
		//type: 'html-keyboard-response',
		//choices: jsPsych.NO_KEYS,
		//stimulus: jsPsych.timelineVariable('img_blank'),
		//trial_duration: 100
	    //};
	
    // put them together
	var exposure_trial = {
        timeline: [
            show_word_class_text,
			show_image_subtrial1,
			show_instruction_hold_press_subtrial1,
			press_to_continue_subtrial1,
            show_image_subtrial2,
			show_instruction_hold_press_subtrial2,
			press_to_continue_subtrial2,
			//blank_page
        ],
        // add the trials as a variable
        timeline_variables: exposure_trials,
    };
 
 return exposure_trial

}