/* 11a - T1 test template
 * requires:
 * jquery.js
 * player_test_template.js
 * iliustraData.js
 */

console.log('> template11a-T1.js is iniciated;');

function template11ascript() {
	console.log("function template11ascript(); sectionName=" +sectionName + "; slideName=" +slideName);
	var mainVars = initMainVars(tObj,sectionName,slideName);
	var tO = mainVars.tO;
        var items = tO['items'];	
	
	// append background
	
	if (tO['background']) {
		loadSlideBackground();
	}
	
	// count items
	var itemsCount = tO['items_count']; 	console.log('items count: ' +itemsCount);
	
	var p = {	// properties
            end :{
                    min:{
                        x:120,
                        y:10
                    },
                    max:{
                        x:600,
                        y:350
                    },
            },
            text:{
                css:{
                    main:{
                        "position":"absolute",
                        //'width':'778px','
                        'width':'1180px',
                        'height':'48px',
                        'top':'350px',
                        'left':'200px',
                        "cursor": "move",
                        "z-index": "10",
                        "border": "1px solid rgb(255,255,255)",
                        "background":"#e0f7fd",
						"-webkit-box-shadow": "0px 2px 1px 0px rgba(0,0,0,0.3)",
						"-moz-box-shadow": "0px 2px 1px 0px rgba(0,0,0,0.3)",
						"box-shadow": "0px 2px 1px 0px rgba(0,0,0,0.3)"
                        },
                    text:{
                        "position":"absolute",
                        //'width':'778px',
                        'width':'1180px',
                        'height':'auto',
                        'top':'0px',
                        'left':'0px',
                        "z-index": "7",
                        'padding-left':'10px',
                        'font-family':'Arial',
                        'font-size': '21px',
                        'text-align':'left',
                        'line-height': '34px',
                        'padding-top': '10px'
                    }
                }
            }
    }      
	
	var zIndexChange=20;
	
	// generate random end points for items x and y ;
	randomise_items_end_XY(itemsCount,p);
	
	// randomise items order
	var randPlaces = randomArray(itemsCount);
	
	items = change_items_to_random(items, randPlaces);
	
	//  get true - correct ; or falls - incorrect
	this.checkAnswer = checkTestAnswer_11a;
	// check buttton and function to check
	checkTestButton(this.checkAnswer,tO,null,randPlaces);

	appendQuestion(ssId, ss, tO, 1);
	
	append_items(items,p,3,null,ss,ssId);
	
	question_top = $(ssId + 'question').position().top + $(ssId + 'question').outerHeight() + 30;
	hh_i = $(ssId + 'question').outerHeight() + 30;
	
	$(".fixed_pos").each(function( index, element ) {
		h = $(element).outerHeight()+10;
		$(element).parent().css('height', h+'px');	
	});
	
	var topp = question_top;
	hh = hh_i;
	$(".fixed_pos").each(function( index, element ) {
		$(element).parent().css({ 'top': topp + 'px', 'left': '20px'});
		topp = topp + $(element).parent().outerHeight() + 10;
		hh = hh + $(element).parent().outerHeight() + 10;
	});
        
        var clname = "."+sectionName+slideName + "items_11a";	
	image_mDraggable(clname,ssId,zIndexChange,1);	
	
	normalize_height(hh+40);
}
