/* 1c test template
 * requires:
 * jquery.js
 * player_test_template.js
 * iliustraData.js
 */

console.log('> template1c.js is iniciated;');

function template1cscript() {
	console.log("function template1cscript(); sectionName=" +sectionName + "; slideName=" +slideName);
		
        tObj = getObject();
    
        var mainVars = initMainVars(tObj,sectionName,slideName);
	var tO = mainVars.tO;
       
        tO = randomizeAnswers(tO);        
        var items = tO['items'];       
        
        var check_type = 0;   
	// count items
	var itemsCount = Object.keys(items).length; 	console.log('items count: ' +itemsCount);
	
        if (tO['background']) {
		loadSlideBackground();
	}
        
	var p = {	// properties
		step : 160,		// it is a step for each text, radio, checkbox, check items
		position:{
			check	:{
				item_0:{
					top  : 145,
					left : 60
				},
				item_1:{
					top  : 145,
					left : 524
				},
				item_2:{
					top  : 433,
					left : 60
				},
				item_3:{
					top  : 433,
					left : 524
				}
			},
			image:{
				item_0:{
					top  : 145,
					left : 112
				},
				item_1:{
					top  : 145,
					left : 575
				},
				item_2:{
					top  : 434,
					left : 112
				},
				item_3:{
					top  : 434,
					left : 575
				}
			}
		},
		check :{
			unchecked	: 'img/check.png',
			checked		: 'img/check_true.png',
			checked_false	: 'img/check_false.png',
			unchecked_false	: 'img/check_false_2.png',
			css  : {
				"position":"absolute",
				'width':'28px',
				'height':'28px',
				"cursor": "pointer",
				"z-index": "10",
				"background":"url(img/check.png) no-repeat 0px 0px"
			}
		},
		radio :{
			unchecked	: 'img/radio.png',
			checked		: 'img/radio_true.png',
			checked_false	: 'img/radio_false.png',
			unchecked_false	: 'img/radio_false_2.png',
			css :{
				"position":"absolute",
				'width':'35px',
				'height':'35px',
				"cursor": "pointer",
				"z-index": "10",
				"background":"url(img/radio.png) no-repeat 0px 0px"
			}
		},
		photo:{
			css	:{
				"position":"absolute",
				'width'	:'360px',
				'height':'250px',
				"z-index": "7"
			}
		}
	}	
	
	var zIndexChange=20;
	
	var text_top = 185;
	
	//  get true - correct ; or falls - incorrect
	this.checkAnswer = checkTestAnswer;
	// check buttton and function to check
	
	checkTestButton(this.checkAnswer,tO,p);

	appendQuestion(ssId, ss, tO);
	
	check_type = check_check_or_radio(tO,p,check_type);
	
	append_photo(tO.photo,p);
	
	append_items(items,p,2,check_type,ss,ssId);
}

