﻿var xmlHttp;

function createXMLHttpRequest(){
	if(window.ActiveXObject){
		xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
	}else if(window.XMLHttpRequest){
		xmlHttp  = new XMLHttpRequest();
	}
}

function loadIndexList(name) {
	createXMLHttpRequest();
	document.getElementById('ajax_index_list').innerHTML="<div style='padding:20px 0 20px 0;'>กรุณารอซักครู่...</div>";
	xmlHttp.open("get", "ajax_index_list_"+name+".php",true);
	xmlHttp.onreadystatechange = loadIndexListChangeHandle;
	xmlHttp.send(null);
}

function loadIndexListChangeHandle() {
     if (xmlHttp.readyState == 4) {
          if (xmlHttp.status == 200) {
			  document.getElementById('ajax_index_list').innerHTML=""+xmlHttp.responseText;  
          }
     }
}




var xmlHttp2;

function createXMLHttpRequest2(){
	if(window.ActiveXObject){
		xmlHttp2  = new ActiveXObject("Microsoft.XMLHTTP");
	}else if(window.XMLHttpRequest){
		xmlHttp2  = new XMLHttpRequest();
	}
}

function loadFormLogin(name,path) {
	createXMLHttpRequest2();
	document.getElementById('ajax_login_form').innerHTML="<div style='padding:20px 0 20px 0;'>กรุณารอซักครู่...</div>";
	if(path=='index') {
		xmlHttp2.open("get", "ajax_login_form_"+name+".php?path=index",true);
	}
	else {
		xmlHttp2.open("get", "../ajax_login_form_"+name+".php",true);
	}
	xmlHttp2.onreadystatechange = loadFormLoginChangeHandle;
	xmlHttp2.send(null);
}

function loadFormLoginChangeHandle() {
     if (xmlHttp2.readyState == 4) {
          if (xmlHttp2.status == 200) {
			  document.getElementById('ajax_login_form').innerHTML=""+xmlHttp2.responseText;  
          }
     }
}