
function GetMSXmlHttp()
{
	var xmlHttp2 = null;
	if (!window.XMLHttpRequest) {
		var s="";
		var clsids = ["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0",
								"Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0", 
								"Msxml2.XMLHTTP.2.6","Microsoft.XMLHTTP.1.0", 
								"Microsoft.XMLHTTP.1","Microsoft.XMLHTTP"];
		for(var i=0; i<clsids.length && xmlHttp2 == null; i++) {
				xmlHttp2 = CreateXmlHttp(clsids[i]);
		}
	}
	else { //Firefox;nextscape/opera
		xmlHttp2 = new XMLHttpRequest();
	}
	return xmlHttp2;
}
//=================
function CreateXmlHttp(clsid) {
	var xmlHttp1 = null;
	try {
			xmlHttp1 = new ActiveXObject(clsid);
			lastclsid = clsid;
			return xmlHttp1;
	}
	catch(e) {}
}
//=====================
function loadtienganh()
{
	 xmlHttp = GetMSXmlHttp();
	xmlHttp.onreadystatechange = function()
	 {
		   if(xmlHttp.readyState == 4)
		   {
			 	
		   }		   
	 }    
	 xmlHttp.open("GET","includes/ajaxpro.php?do=loadtienganh&times="+Math.random(),true);
	 xmlHttp.send(null);
	 window.location.href = "home.php";
		
}
//=====================
function loadtiengviet()
{
	 xmlHttp = GetMSXmlHttp();
	xmlHttp.onreadystatechange = function()
	 {
		   if(xmlHttp.readyState == 4)
		   {
			 	
		   }		   
	 }    
	 xmlHttp.open("GET","includes/ajaxpro.php?do=loadtiengviet&times="+Math.random(),true);
	 xmlHttp.send(null);	
	 window.location.href = "home.php";
}
//=====================
function loadvideo(dieukhien)
{
	   	if(dieukhien!="")
       	{
       		var objectfile = document.getElementById(dieukhien); 
       	}
		if(objectfile.value != "")
		{
	 xmlHttp = GetMSXmlHttp();
	xmlHttp.onreadystatechange = function()
	 {
		   if(xmlHttp.readyState == 4)
		   {
			 	var value = xmlHttp.responseText;
			 	var objnoidung = document.getElementById('video-clip'); 
			 	objnoidung.style.display="";
				objnoidung.innerHTML = value;
				//alert(value);
		   }		   
	 }    
	 xmlHttp.open("GET","includes/ajaxpro.php?do=loadvideo&tenfile="+objectfile.value+"&times="+Math.random(),true);
	 xmlHttp.send(null);	
		}
}
//------------------------------------------
function loadvideo2(tenfile)
{
	 xmlHttp = GetMSXmlHttp();
	xmlHttp.onreadystatechange = function()
	 {
		   if(xmlHttp.readyState == 4)
		   {
			 	var value = xmlHttp.responseText;
			 	var objnoidung = document.getElementById('video-clip'); 
			 	objnoidung.style.display="";
				objnoidung.innerHTML = value;
				//alert(value);
		   }		   
	 }    
	 xmlHttp.open("GET","includes/ajaxpro.php?do=loadvideo&tenfile="+tenfile+"&times="+Math.random(),true);
	 xmlHttp.send(null);	
}
//=====================
function luuthamdo()
{
		var rdluachon = document.getElementsByName('rdluachon'); 
		
		var maluachon = "";
	 for(var i=0;i<rdluachon.length;i++)
	 {
	   if(rdluachon[i].checked)
	     {
			maluachon = rdluachon[i].value;		
		 }
		 
	  }
	if(maluachon != "")
	{

	 xmlHttp = GetMSXmlHttp();
	xmlHttp.onreadystatechange = function()
	 {
		   if(xmlHttp.readyState == 4)
		   {
			 	//var value = xmlHttp.responseText;
			 	//var objnoidung = document.getElementById('video-clip'); 
			 	//objnoidung.style.display="";
				//objnoidung.innerHTML = value;
				alert("Bạn đã trả lời xong thăm dò ý kiến. Xin cám ơn bạn !");
		   }		   
	 }    
	 xmlHttp.open("GET","includes/ajaxpro.php?do=luuthamdo&maluachon="+maluachon+"&times="+Math.random(),true);
	 xmlHttp.send(null);	
	}
	else
	  alert("Xin vui lòng chọn câu trả lời !");
}

