/* 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);
	
        tObj = getObject();
        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':'1010px',
                        'height':'48px',
                        'top':'350px',
                        'left':'200px',
                        "cursor": "move",
                        "z-index": "10",
                        "border": "1px solid rgb(190,190,190)",
                        "background":"rgb(255,255,239)"
                        },
                    text:{
                        "position":"absolute",
                        //'width':'778px',
                        'width':'1010px',
                        'height':'48px',
                        'top':'0px',
                        'left':'0px',
                        "z-index": "7",
                        'text-indent':'30px',
                        'font-family':'Arial',
                        'font-size': '22px',
                        'text-align':'left',
                        'line-height': '48px'
                    }
                }
            }
    }      
	
	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);
	
	$(".fixed_pos").each(function( index, element ) {
		var topp = (index * 60) + 120;
		$(element).parent().animate({ 'top': topp + 'px', 'left': '30px'}, 800, function(){});
	});
        
        var clname = "."+sectionName+slideName + "items_11a";	
	image_mDraggable(clname,ssId,zIndexChange,1);	
}
