var theloaiOverBgImage = 'url(http://'+ location.host+'/images/BACK_MENU2.jpg)';
var theloaiOverTxt = '4B6D1F';
var theloaiOverBgImage1 = 'url(http://'+ location.host+'/images/51_out.gif)';
var theloaiOverTxt1 = '000000';
var theloaiOverBgImage2 = 'url(http://'+ location.host+'/images/55_out.gif)';
var theloaiOverTxt2 = '000000';

var xmlHttp = false;
if(window.XMLHttpRequest){
	xmlHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject){
	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
function postRes(div,src,param){	
	var obj = document.getElementById(div);
	if(xmlHttp){
		xmlHttp.open("POST",src,true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8;");
		xmlHttp.onreadystatechange = function(){
			if(xmlHttp.readyState == 1 || xmlHttp.readyState == 2){
				obj.innerHTML = "<img src='http://"+location.host+"/images/ajax-loader.gif' border='0'>";
			}
			else if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
				//obj.innerHTML = xmlHttp.responseText;
				$('#'+div).html(xmlHttp.responseText)
			}			
		}	
		xmlHttp.send(param);	
	}
}

function theloaiOver (sr) {
	sr.style.backgroundImage=theloaiOverBgImage;
	if (sr.childNodes && theloaiOverTxt && theloaiOverTxt!='') {
		var i, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color=theloaiOverTxt;
		}
	}
}
function theloaiOut (sr) {
	sr.style.backgroundImage='';
	if (sr.childNodes && theloaiOverTxt && theloaiOverTxt!='') {
		var i, sti, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color='000000';
		}
	}
}




function theloaiOver1 (sr) {
	sr.style.backgroundImage=theloaiOverBgImage1;
	if (sr.childNodes && theloaiOverTxt1 && theloaiOverTxt1!='') {
		var i, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color=theloaiOverTxt1;
		}
	}
}
function theloaiOut1 (sr) {
	sr.style.backgroundImage='';
	if (sr.childNodes && theloaiOverTxt1 && theloaiOverTxt1!='') {
		var i, sti, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color='ffffff';
		}
	}
}


function theloaiOver2 (sr) {
	sr.style.backgroundImage=theloaiOverBgImage2;
	if (sr.childNodes && theloaiOverTxt2 && theloaiOverTxt2!='') {
		var i, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color=theloaiOverTxt2;
		}
	}
}

function theloaiOut2 (sr) {
	sr.style.backgroundImage='';
	if (sr.childNodes && theloaiOverTxt2 && theloaiOverTxt2!='') {
		var i, sti, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color='ffffff';
		}
	}
}

function innerContent(targ, str){
	var content = document.getElementById(targ);
	content.innerHTML = str + "<br/>";
}


function selectSchool (oj) {
	var obj = $('#' + oj);
		
	var items = $('#listTruong').find('a');
	
	items.each(function(i) {
		
		if (obj.attr('id') == $(items[i]).attr('id')) {		
			$(items[i]).removeClass('normal');
			$(items[i]).addClass('active');
			$('#matruong').val(obj.attr('id'));		
		} else {
			$(items[i]).removeClass('active');
			$(items[i]).addClass('normal');
		}		
	});
	
	return false;
}

function school(obj) {
	//initTyper(obj);
	request(obj.value);
}

/*function selectTab(idx) {
	if (idx == 0) {
		$('#tab0').addClass('active');
		$('#tab1').removeClass('active');
		$('#by').val('byname');
	} else {
		$('#tab0').removeClass('active');
		$('#tab1').addClass('active');
		$('#by').val('bycode');
	}
	
}*/


function selectTab(idx) {
	if (idx == 0) {
		//$('#tab0').addClass('active');
		//$('#tab1').removeClass('active');
		$('#by').val('byname');
		$('.vidu_ten_sbd').html('Nhập Họ tên đầy đủ bằng tiếng việt có dấu (VD: Lê Phương Thảo)');
		$('#tdname').css('background-image', 'url(' + web_url + 'images/buoc_3.gif)');
		$('#tdcode').css('background-image', 'url(' +web_url + 'images/nhap_theo_SBD.gif)');
	} else {
		//$('#tab0').removeClass('active');
		//$('#tab1').addClass('active');
		$('#by').val('bycode');
		$('.vidu_ten_sbd').html('Nhập theo cấu trúc: tên trường + khối thi + SBD (VD: BKAA123)');
		$('#tdname').css('background-image', 'url(' + web_url + 'images/byname.gif)');
		$('#tdcode').css('background-image', 'url(' +web_url + 'images/bycode1.gif)');
	}
	
}


function openPopup(url, name) {
		window.open(url, name, 'width=620, height=420');
}

function setTextToElement(elementName, content) {
	var elementID = document.getElementById(elementName);
	if (elementID) {
		elementID.innerHTML = content;
	}
}