/* 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  : 60,
					left : 50
				},
				item_1:{
					top  : 60,
					left : 655
				},
				item_2:{
					top  : 340,
					left : 60
				},
				item_3:{
					top  : 340,
					left : 655
				}
			},
			image:{
				item_0:{
					top  : 60,
					left : 100
				},
				item_1:{
					top  : 60,
					left : 705
				},
				item_2:{
					top  : 340,
					left : 100
				},
				item_3:{
					top  : 340,
					left : 705
				}
			}
		},
		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':'31px',
				'height':'31px',
				"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);
	
	$('.text_t img').css('height', '250px');
	
	var qh = $(ssId + 'question').position().top + $(ssId + 'question').outerHeight() + (250*2) + 130;
	
	normalize_height(qh);
}

