	var email_OK = false;
	var name_OK = false;
	function loadXMLDoc(url) 
	{
		// branch for native XMLHttpRequest object
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send(null);
		// branch for IE/Windows ActiveX version
		} else if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
			if (req) {
				req.onreadystatechange = processReqChange;
				req.open("GET", url, true);
				req.send();
			}
		}
	}
	
	
	function processReqChange() 
	{
		if (req.readyState == 4) // only if req shows "complete"
		{
			if (req.status == 200) // only if "OK"
			{
				response  = req.responseXML.documentElement;
				A_Method  =	response.getElementsByTagName('method')[0].firstChild.data;
				A_Result    = response.getElementsByTagName('result')[0].firstChild.data;
				if (A_Method!='addNew')
				{
					eval(A_Method + '(\'\', A_Result)');
				}
				else
				{
					eval(A_Method + '(\'\',\'\', A_Result)');
				}
			} 
			else 
			{
				alert("There was a problem retrieving the XML data:\n" + req.statusText);
			}
		}
	}
	
	
	function loading(show, type) {
 xmlhttp.open("GET", show, true);
 if(type=='main'){
 xmlhttp.onreadystatechange = T2HnS;
  } else if(type=='ds'){
 xmlhttp.onreadystatechange = DS;
   } else if(type=='if'){
 xmlhttp.onreadystatechange = IF;
  }else if(type=='play'){
 xmlhttp.onreadystatechange = PLAY;
 }
  xmlhttp.send(null);
}
function T2MCreateObject()
{
 var http;
 var browser = navigator.appName; 
 if(browser == "Microsoft Internet Explorer"){
	http = new ActiveXObject("Microsoft.XMLHTTP");
 }else{
	http = new XMLHttpRequest();
	}
  return http;
}

var xmlhttp = T2MCreateObject();

if(!xmlhttp) alert('Sorry we can not creat an ActiveX on your browser');

function T2HnS() {
   if(xmlhttp.readyState == 1 || xmlhttp.readyState == 2)
   {
	   document.getElementById("T2M").innerHTML = '<center><br><img src="http://mauthoigian.org/img/load.gif"><br>Loading.....<br><br>';
	
   }
   else if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
      document.getElementById("T2M").innerHTML = xmlhttp.responseText;
    window.status="Da tai xong du lieu !";
   }   
}
function DS() {
   if(xmlhttp.readyState == 1 || xmlhttp.readyState == 2)
   {
	   document.getElementById("DS").innerHTML = '<center><br><img src="http://mauthoigian.org/img/load.gif"><br>Loading.....<br><br>';
	
   }
   else if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
      document.getElementById("DS").innerHTML = xmlhttp.responseText;
     window.status="Da tai xong du lieu !";
   }   
}

function show(sid,ms,page)
{
	loading('ajax.php?mtgmedia='+sid+'&id='+ms+'&page='+page+'&#','ds');
      window.status="Loading..............";
}
function showlist(sid,ms,page)
{
	loading('ajax.php?IDF='+sid+'&id='+ms+'&page='+page+'&#','main');
      window.status="Loading..............";
}


function showdie(sid,ms,page)
{
	loading('ajax.php?mtgidt='+sid+'&mess='+ms+'&page='+page+'&#','ds');
      window.status="Loading..............";
}


