function newXmlHttp(){
	var xmlhttp = false;
	var xmlhttp2 = false;
	var xmlhttp3 = false;

	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
		xmlhttp3 = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
				xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
				
			}catch(e){
				xmlhttp = false;
				xmlhttp2 = false;
				xmlhttp3 = false;
			}
		}


	if(!xmlhttp && document.createElement){
		xmlhttp = new XMLHttpRequest();
	}
	if(!xmlhttp2 && document.createElement){
		xmlhttp2 = new XMLHttpRequest();
	}
	if(!xmlhttp3 && document.createElement){
		xmlhttp3 = new XMLHttpRequest();
	}

return xmlhttp;
return xmlhttp2;
return xmlhttp3;
}

var  xmlhttp;
var  xmlhttp2;
var  xmlhttp3;

function getPic(news_id) {
	
	 xmlhttp3 = newXmlHttp();
     xmlhttp3.onreadystatechange = function () { 
          if (xmlhttp3.readyState==4) {
               if (xmlhttp3.status==200) {
                    var data3=xmlhttp3.responseText; //รับค่ากลับมา
                    document.getElementById("showPic").innerHTML=data3; //แสดงผล แทนรูปรอโหลด
					 getcontent_height();
               } 
          } 
     };
     xmlhttp3.open("GET", "getpic.php?news_id="+news_id, true); 
     xmlhttp3.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); // set Header
     xmlhttp3.send(null); //ส่งค่า
}
function getData(news_id) {
	
	 xmlhttp2 = newXmlHttp();
     xmlhttp2.onreadystatechange = function () { 
          if (xmlhttp2.readyState==4) {
               if (xmlhttp2.status==200) {
                    var data2=xmlhttp2.responseText; //รับค่ากลับมา
					
                    document.getElementById("showData").innerHTML=data2; //แสดงผล แทนรูปรอโหลด
					
               } 
          } 
     };
     xmlhttp2.open("GET", "getnews.php?news_id="+news_id, true); 
     xmlhttp2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); // set Header
     xmlhttp2.send(null); //ส่งค่า
}

function getDataList(id,page) {

	getData(id);
	getPic(id);
		
	 xmlhttp = newXmlHttp();
     xmlhttp.onreadystatechange = function () { 
          if (xmlhttp.readyState==4) {
               if (xmlhttp.status==200) {
                    var data=xmlhttp.responseText; //รับค่ากลับมา
                    document.getElementById("showDataList").innerHTML=data; //แสดงผล แทนรูปรอโหลด
               } 
          } 
     };
     xmlhttp.open("GET", "getlistnews.php?news_id="+id+"&page="+page, true); 
     xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); // set Header
     xmlhttp.send(null); //ส่งค่า
}

