function TtestForm(test_id, FormID)
{
	this.test_id = test_id;	this.frm = document.getElementById(FormID);

	var ol = document.getElementById('list_quests');
	this.list_quests = ol.getElementsByTagName('LI');
    this.setCurrent(0);
    this.dateObj = new Date();
    this.result = [];}
TtestForm.prototype = {
	curQuest: 0,
	result: new Array(),

	setCurrent: function(num)
	{
		if(num < this.list_quests.length){
			for(i=0; i<this.list_quests.length; i++){
	   	    	if(num == i)
	   	    		this.list_quests[i].className = '';
	   	    	else
	   	    		this.list_quests[i].className = 'nocur';
	   	    }
	    	this.curQuest = num;
		}else{			this.finish();
		}
	},

	ansver: function(value)
	{
    	var cdateObj = new Date();
    	var t = (cdateObj.getTime() - this.dateObj.getTime());

    	var id_ereg = new RegExp("q_");
    	var id = this.list_quests[this.curQuest].getAttribute('id').replace(id_ereg, "");
        this.result.push({        	id: id,        	v: value,
        	t: t
        });
        HTML_Progress2.statusCheckCallback({percentage:(Math.round((this.curQuest+1)/this.list_quests.length*100))});
 		this.setCurrent(this.curQuest+1);

	},

	finish: function()
	{    	this.frm.style.display = 'none';
    	document.getElementById('prog_cont').style.display = 'none';
    	document.getElementById('result').style.display = 'block';
       	this.save();
	},

	save: function()
	{		test.saveResult(this.test_id, this.result);
	}
}