var xmlHttp;
var position;
var result_type;

// AJAX
function GetXmlHttpObject(handler){ 
	var objXMLHttp=null
	if (window.XMLHttpRequest){
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp;
}

function datatab(input){
	type = input.getAttribute('title');
	position = input.getAttribute('rel');
	page = document.getElementById("page_id").getAttribute('title');
	var str = 'page=' + page + '&tab=' + type + '&' + (new Date()).getTime();
	var url = '../rss/sectionmmo.php'
	xmlHttp = GetXmlHttpObject();
	xmlHttp.onreadystatechange = stateChanged;
	
	xmlHttp.open("POST",url,true);
	//xmlHttp.send(null); // GET Method
	xmlHttp.setRequestHeader("Cache-Control","max-age=0, must-revalidate"); // Post urlencode
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // Post urlencode
	xmlHttp.send(str); // POST Method	
}
function datatabmmo3(input){
	type = input.getAttribute('title');
	position = input.getAttribute('rel');
	var str = 'tab=' + type + '&' + (new Date()).getTime();
	var url = '../rss/sectionmmo3.php'
	xmlHttp = GetXmlHttpObject();
	xmlHttp.onreadystatechange = stateChanged;
	
	xmlHttp.open("POST",url,true);
	//xmlHttp.send(null); // GET Method
	xmlHttp.setRequestHeader("Cache-Control","max-age=0, must-revalidate"); // Post urlencode
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // Post urlencode
	xmlHttp.send(str); // POST Method	
}
function datatabconsole(input){
	type = input.getAttribute('title');
	position = input.getAttribute('rel');
	page = document.getElementById("page_id").getAttribute('title');
	var str = 'page=' + page + '&tab=' + type + '&' + (new Date()).getTime();
	var url = '../rss/section_console.php'
	xmlHttp = GetXmlHttpObject();
	xmlHttp.onreadystatechange = stateChanged;
	
	xmlHttp.open("POST",url,true);
	//xmlHttp.send(null); // GET Method
	xmlHttp.setRequestHeader("Cache-Control","max-age=0, must-revalidate"); // Post urlencode
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // Post urlencode
	xmlHttp.send(str); // POST Method	
}
function rss(site){
	position = 'rss_show';
	page = document.getElementById("page_id").getAttribute('title');
	var str = 'page=' + page + '&site=' + site + '&' + (new Date()).getTime();
	var url = '../rss/news.php'
	xmlHttp = GetXmlHttpObject();
	xmlHttp.onreadystatechange = stateChanged;
	
	xmlHttp.open("POST",url,true);
	//xmlHttp.send(null); // GET Method
	xmlHttp.setRequestHeader("Cache-Control","max-age=0, must-revalidate"); // Post urlencode
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // Post urlencode
	xmlHttp.send(str); // POST Method	
}

function stateChanged(){ 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{
		document.getElementById(position).innerHTML = xmlHttp.responseText;
	} else if (xmlHttp.readyState == 3){
		loading();
	}
}

function loading(){
}
//////count download video
function Inint_AJAX() {
   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;
};

function countdownload(id) {
     var req = Inint_AJAX();
     req.onreadystatechange = function () { 
          if (req.readyState==4) {
              // if (req.status==200) {
              //      document.getElementById(src).innerHTML=req.responseText; 
              // } 
          }
     };
     req.open("GET", "counter.php?id="+id); 
     req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // set Header
     req.send(null); 
}
///////////
function nfocus(number){
	if (number <= 3){
		document.getElementById("focus1").style.display = "none";
		document.getElementById("focus2").style.display = "none";
		document.getElementById("focus3").style.display = "none";
		document.getElementById("focus" + number).style.display = "";
	} else if (number <= 6){
		document.getElementById("focus4").style.display = "none";
		document.getElementById("focus5").style.display = "none";
		document.getElementById("focus6").style.display = "none";
		document.getElementById("focus" + number).style.display = "";
	}
}

//-->