// JavaScript Document
<!--
function change_tab(id_tab, num_data, arrId, arrClass, id_show, id_data){
	for(i=0; i<num_data; i++){
		for(j=0; j<arrId.length; j++){
			document.getElementById(arrId[j] + i).className = "";
		}
	}
	for(i=0; i<arrId.length; i++){
		document.getElementById(arrId[i] + id_tab).className = arrClass[i];
	}
	if(id_show != "" && id_data != ""){
		document.getElementById(id_show).innerHTML = document.getElementById(id_data).innerHTML;
	}
}

function check_answer(currentid, checkname, num_answer){
	for(i=1;i<=num_answer;i++){
		try{
			document.getElementById("quest"+checkname + "_" + i).checked=false;
		}
		catch(e){}
	}
	document.getElementById(currentid).checked=true;
	//window.location.hash='q'+checkname;
}

function check_question(id){
	document.getElementById("cau_" + id).value = 1;
	document.getElementById("question_" + id).className = "tracnghiem_question_bg_check";
	document.getElementById("question_stt_"+id).className='tracnghiem_stt';
}

function form_submit(total){
	var sum_mit		= 0;
	var sub_start	= 0;
	for(i=1; i<=total; i++){
		if(document.getElementById("cau_"+i).value==0){
			document.getElementById("question_stt_"+i).className='tracnghiem_stt_error';
			if(sub_start==0) sub_start=i;
			sum_mit = 1;
		}
	}
	if(sum_mit==0){
	 document.tracnghiem.submit();
	}else{
		alert("Bạn phải trả lời hết các câu hỏi đưa ra !");
		window.location.hash='cau_'+sub_start;
		sub_start = 0;
	}
}

function show_answer(tr_id){
	if(document.getElementById("cau_"+tr_id).style.display=='none'){
		document.getElementById("cau_"+tr_id).style.display='inline';
		document.getElementById("window_"+tr_id).innerHTML='Ẩn trả lời';
	}else{
		document.getElementById("cau_"+tr_id).style.display='none';
		document.getElementById("window_"+tr_id).innerHTML='Xem trả lời';
	}
}

function dautri_check(id, total, type){
	check = (type > 0) ? true : false;
	for(i=1; i<=total; i++){
		document.getElementById("dautri_" + id + "_" + i).checked = check;
	}
}

function countDown(object){
	var count = parseInt(document.getElementById(object).innerHTML);
	if(count > 0){
		document.getElementById(object).innerHTML = count - 1; 
		window.setTimeout("countDown('" + object + "')", 1000);
	}
	else{
		window.location.href = "/";
	}
}

function saveCookie(cookie_name, cookie_value){
	document.cookie = cookie_name + "=" + cookie_value;
}

function getCookie(c_name){
	if(document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if(c_start!=-1){ 
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}
-->
