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, type) {
	//initTyper(obj);
	request(obj.value, type);
}

/*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;
	}
}

function callBlock(block_name) {	
	if (block_name == '') {
		return;
	}
	var elm = $('#' + block_name);
	
	if (elm && elm != undefined) {
		alert(web_url + '/block_htmls/' + block_name + '.html');
		elm.load(web_url + '/block_htmls/' + block_name + '.html');
	}
}


<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function chooseTabSearch(tab,p_ten,p_sbd,p_searchType){
	var ten = document.getElementById(p_ten);
	var sbd = document.getElementById(p_sbd);
	var searchType = document.getElementById(p_searchType);
	
	if(navigator.appName == "Netscape")
	{
		 switch(tab){
			case 1:			
				/*For ten*/
				//$('#by').val('byname');
				$('.vidu_ten_sbd').html('Nhập Họ tên đầy đủ bằng tiếng việt có dấu (VD: <b>Lê Phương Thảo)</b>');
				ten.setAttribute("class", "searchTheoTen_active");
				sbd.setAttribute("class", "searchTheoSBD_inactive");
				searchType.value = 'ten';
				break;
			case 2:
				/*For SBD*/
				//$('#by').val('byname');
				$('.vidu_ten_sbd').html('Nhập theo cấu trúc: tên trường + khối thi + SBD (VD: <b>BKAA123)</b>');
				sbd.setAttribute("class", "searchTheoSBD_active");
				ten.setAttribute("class", "searchTheoTen_inactive");
				searchType.value = 'sbd';
				break;
		}
	}
	
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		switch(tab){
			case 1:			
				/*For ten*/
				//$('#by').val('byname');
				$('.vidu_ten_sbd').html('Nhập Họ tên đầy đủ bằng tiếng việt có dấu (VD: <b>Lê Phương Thảo)</b>');
				ten.className =  "searchTheoTen_active";
				sbd.className = "searchTheoSBD_inactive";
				searchType.value = 'ten';
				break;
			case 2:			
				/*For SBD*/
				//$('#by').val('bycode');
				$('.vidu_ten_sbd').html('Nhập theo cấu trúc: tên trường + khối thi + SBD (VD: <b>BKAA123)</b>');
				ten.className =  "searchTheoTen_inactive";
				sbd.className = "searchTheoSBD_active";
				searchType.value = 'sbd';
				break;
		}
	}
}

function f_filterResults(n_win,n_docel,n_body){var n_result=n_win?n_win:0;if(n_docel&&(!n_result||(n_result>n_docel)))
n_result=n_docel;return n_body&&(!n_result||(n_result>n_body))?n_body:n_result;}
function f_clientWidth(){return f_filterResults(window.innerWidth?window.innerWidth:0,document.documentElement?document.documentElement.clientWidth:0,document.body?document.body.clientWidth:0);}
function f_clientHeight(){return f_filterResults(window.innerHeight?window.innerHeight:0,document.documentElement?document.documentElement.clientHeight:0,document.body?document.body.clientHeight:0);}
