// JavaScript Document

function createXMLHttpRequest(){ 
	var xmlHttp = false;
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}

//onclick บนแทก อินพุต ส่ง ค่าดีฟ้อลต์ที่แสดง ค่าที่กรอกขณะปัจจุบัน ชื่อตัวแปร
function onclickbhv(value1,value2,varname)
{
	if(value2==value1)
	{
		document.getElementById(varname).value = "";
	}else
	{
		document.getElementById(varname).select();
	}
}

//onblur เมื่อนำเมาส์ออกจากแทก อินพุต ส่ง ค่าดีฟ้อลต์ที่แสดง ค่าที่กรอกขณะปัจจุบัน ชื่อตัวแปร
function onblurbhv(value1,value2,varname)
{
	if(value2=='')
	{
		document.getElementById(varname).value = value1;
	}
}

//ตัวแปร และ ค่าพื้นฐานของตัวแปรนั้น
function is_empty(var1,defaulword,alertword)
{
	if(var1.value.length==0 || var1.value === defaulword)
	{
		alert(alertword);
		var1.value="";
		var1.focus();
		return false;
	}else
	{
		return true;
	}
}

function validate_email(email,alertword)
{
	var patt = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;
	if(patt.test(email.value))
	{
		return true;
	}else
	{
		alert(alertword);
		email.focus();
		return false;
	}
}

function check_contactfrm()
{
	var contactus_name = document.getElementById('contactus_name');
	var contactus_email = document.getElementById('contactus_email');
	var contactus_phone = document.getElementById('contactus_phone');
	var contactus_message = document.getElementById('contactus_message');
	var contactus_security = document.getElementById('contactus_security');
	
	if(is_empty(contactus_name,"your name","Please enter your name"))
	{
		if(is_empty(contactus_email,"e-mail","Please enter your email"))
		{
			if(validate_email(contactus_email,"Please enter a valid email"))
			{
				if(is_empty(contactus_phone,"phone number","Please enter your phone number"))
				{
					if(is_empty(contactus_message,"message","Please enter your message"))
					{
						if(is_empty(contactus_security,"summation","Please enter summation"))
						{
							send_contactus();
						}
					}
				}
			}
		}
	}
}


function send_contactus()
{
	var contactus_name = document.getElementById('contactus_name').value;
	var contactus_email = document.getElementById('contactus_email').value;
	var contactus_phone = document.getElementById('contactus_phone').value;
	var contactus_message = document.getElementById('contactus_message').value;
	var contactus_security = document.getElementById('contactus_security').value;
	
	var strURL= "send_contactus.php?contactus_name="+encodeURIComponent(contactus_name)+"&contactus_email="+contactus_email+"&contactus_phone="+contactus_phone+"&contactus_message="+encodeURIComponent(contactus_message)+"&contactus_security="+contactus_security+"&"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("contactform").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}


function get_contactfrm()
{
	
	var strURL= "get_contactfrm.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("contactform").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function check_reservetourfrm()
{
	var contactus_name = document.getElementById('contactus_name');
	var seat_num = document.getElementById('seat_num');
	var contactus_email = document.getElementById('contactus_email');
	var contactus_phone = document.getElementById('contactus_phone');
	var contactus_message = document.getElementById('contactus_message');
	var contactus_security = document.getElementById('contactus_security');
	
	if(is_empty(contactus_name,"ชื่อ-สกุล ผู้จอง","Please enter your name"))
	{
		if(is_empty(contactus_email,"อีเมล์","Please enter your email"))
		{
			if(validate_email(contactus_email,"Please enter a valid email"))
			{
				if(is_empty(contactus_phone,"เบอร์โทรศัพท์","Please enter your phone number"))
				{
					if(is_empty(contactus_message,"ข้อความ","Please enter your message"))
					{
						if(is_empty(contactus_security,"summation","Please enter summation"))
						{
							send_reservetour();
						}
					}
				}
			}
		}
	}
}


function send_reservetour()
{
	var tourid = document.getElementById('tourid').value;
	var contactus_name = document.getElementById('contactus_name').value;
	var seat_num = document.getElementById('seat_num').value;
	var contactus_email = document.getElementById('contactus_email').value;
	var contactus_phone = document.getElementById('contactus_phone').value;
	var contactus_message = document.getElementById('contactus_message').value;
	var contactus_security = document.getElementById('contactus_security').value;
	
	var strURL= "send_tour_reserve.php?contactus_name="+encodeURIComponent(contactus_name)+"&seat_num="+encodeURIComponent(seat_num)+"&tourid="+tourid+"&contactus_email="+contactus_email+"&contactus_phone="+contactus_phone+"&contactus_message="+encodeURIComponent(contactus_message)+"&contactus_security="+contactus_security+"&"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_reserve").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function check_contacttourfrm()
{
	var contactus_name = document.getElementById('contactus_name');
	var contactus_email = document.getElementById('contactus_email');
	var contactus_phone = document.getElementById('contactus_phone');
	var contactus_message = document.getElementById('contactus_message');
	var contactus_security = document.getElementById('contactus_security');
	
	if(is_empty(contactus_name,"ชื่อ-สกุล","Please enter your name"))
	{
		if(is_empty(contactus_email,"อีเมล์","Please enter your email"))
		{
			if(validate_email(contactus_email,"Please enter a valid email"))
			{
				if(is_empty(contactus_phone,"เบอร์โทรศัพท์","Please enter your phone number"))
				{
					if(is_empty(contactus_message,"ข้อความ","Please enter your message"))
					{
						if(is_empty(contactus_security,"summation","Please enter summation"))
						{
							send_contactustour();
						}
					}
				}
			}
		}
	}
}


function send_contactustour()
{
	var tourid = document.getElementById('tourid').value;
	var contactus_name = document.getElementById('contactus_name').value;
	var contactus_email = document.getElementById('contactus_email').value;
	var contactus_phone = document.getElementById('contactus_phone').value;
	var contactus_message = document.getElementById('contactus_message').value;
	var contactus_security = document.getElementById('contactus_security').value;
	
	var strURL= "send_tour_contact.php?contactus_name="+encodeURIComponent(contactus_name)+"&tourid="+tourid+"&contactus_email="+contactus_email+"&contactus_phone="+contactus_phone+"&contactus_message="+encodeURIComponent(contactus_message)+"&contactus_security="+contactus_security+"&"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_reserve").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_nationwideinfo()
{
	var strURL= "get_nationwideinfo.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_intro").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_tour_place_info()
{
	var strURL= "get_tour_place_info.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_intro").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_food_tour()
{
	var strURL= "food_tour_review.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_shop_tour()
{
	var strURL= "shop_tour_review.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_hotel_tour()
{
	var strURL= "hotel_tour_review.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_cond_tour()
{
	var strURL= "get_cond_tour.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_tour_place_default()
{
	var strURL= "get_tour_place_default.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_nationwide_default()
{
	var strURL= "get_nationwide_default.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content_nationwide").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_show_time()
{
	var strURL= "show_time_info.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content_nationwide").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_outdoor_service()
{
	var strURL= "outdoor_service_info.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content_nationwide").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_scoop_service()
{
	var strURL= "get_scoop_service.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content_nationwide").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_vtr_service()
{
	var strURL= "get_vtr_service.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("tour_sec_content_nationwide").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_spot(spotid,spottxt,spottime)
{
	var strURL= "get_spot.php?spotid="+encodeURIComponent(spotid)+"&spottxt="+encodeURIComponent(spottxt)+"&spottime="+encodeURIComponent(spottime)+"&"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("spotplaylist").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function check_regis()
{
	var fname = document.getElementById("fname");
	var lname = document.getElementById("lname");
	var uname = document.getElementById("uname");
	var upass = document.getElementById("upass");
	var email = document.getElementById("email");
	var uphone = document.getElementById("uphone");
	var isOK = document.getElementById('isOK');
	var usum = document.getElementById('usum');
	
	if(is_empty(fname,"","กรุณาป้อนชื่อ"))
	{
		if(is_empty(lname,"","กรุณาป้อนนามสกุล"))
		{
			if(is_empty(uname,"","กรุณาป้อน username"))
			{
				if(is_empty(upass,"","กรุณาป้อน password"))
				{
					if(is_empty(email,"","กรุณาป้อน email"))
					{
						if(validate_email(email,"กรุณาป้อน email ให้ถูกต้อง"))
						{
							if(is_empty(uphone,"","กรุณาป้อน เบอร์โทรศัพท์"))
							{
								if(isOK.checked==false)
								{
									alert("กรุณายอมรับเงื่อนไข");
									return false;
								}else
								{
									if(is_empty(usum,"","กรุณาป้อน ผลบวก"))
									{
										regisFrm.action();
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

function check_login()
{
	var unamelog = document.getElementById("unamelog");
	var upasslog = document.getElementById("upasslog");
	if(is_empty(unamelog,"","กรุณาป้อน username"))
	{
		if(is_empty(upasslog,"","กรุณาป้อน password"))
		{
			loginFrm.action();
		}
	}
}

function get_forgotpassfrm()
{
	var strURL= "get_forgotpassfrm.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("sliderContent1").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function check_emailforgetpass()
{
	var email_forgotpass = document.getElementById("email_forgotpass");
	if(is_empty(email_forgotpass,"","กรุณาป้อน email"))
	{
		if(validate_email(email_forgotpass,"กรุณาป้อน email ให้ถูกต้อง"))
		{
			var strURL= "check_emailforgotpass.php?email="+encodeURIComponent(email_forgotpass.value)+"&"+new Date().getTime() + Math.random();
			var xmlHttp = createXMLHttpRequest();
			if (xmlHttp) {
			xmlHttp.onreadystatechange = function() 
			{
				if (xmlHttp.readyState == 4) 
				{
					if (xmlHttp.status == 200) 
					{
						if(xmlHttp.responseText=="ok")
						{
							alert("ส่งรหัสผ่านให้ท่านทางอีเมล์ที่ระบุไว้เรียบร้อยแล้ว");
							return true;
						}else
							{
								if(xmlHttp.responseText=="no")
								{
									alert("ขออภัยไม่พบอีเมล์ที่ท่านระบุในระบบ กรุณาตรวจสอบความถูกต้องอีกครั้ง");
									return false;
								}else
								{
									alert("ขออภัยไม่สามารถส่งอีเมล์ไปยังอีเมล์ที่ท่านระบุไว้ได้ กรุณาตรวจสอบความถูกต้องอีกครั้ง");
									return false;
								}
							}
							alert(xmlHttp.responseText);
					} else {
								alert("พบข้อผิดพลาด "+xmlHttp.statusText);
							}
					}
				}
				xmlHttp.open("GET",strURL, true);
				xmlHttp.send(null);
			}
		}
	}
}

function get_loginfrm()
{
	var strURL= "get_loginfrm.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("sliderContent1").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_sendemailconfirmfrm()
{
	var strURL= "get_sendemailconfirmfrm.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("sliderContent1").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function check_emailconfirmagain()
{
	var email_forgotpass = document.getElementById("email_forgotpass");
	if(is_empty(email_forgotpass,"","กรุณาป้อน email"))
	{
		if(validate_email(email_forgotpass,"กรุณาป้อน email ให้ถูกต้อง"))
		{
			var strURL= "check_emailconfirmagain.php?email="+encodeURIComponent(email_forgotpass.value)+"&"+new Date().getTime() + Math.random();
			var xmlHttp = createXMLHttpRequest();
			if (xmlHttp) {
			xmlHttp.onreadystatechange = function() 
			{
				if (xmlHttp.readyState == 4) 
				{
					if (xmlHttp.status == 200) 
					{
						if(xmlHttp.responseText=="ok")
						{
							alert("ส่งอีเมล์เพื่อยืนยันตัวตนให้ท่านทางอีเมล์ที่ระบุไว้เรียบร้อยแล้ว");
							return true;
						}else
							{
								if(xmlHttp.responseText=="no")
								{
									alert("ขออภัยไม่พบอีเมล์ที่ท่านระบุในระบบ กรุณาตรวจสอบความถูกต้องอีกครั้ง");
									return false;
								}else
								{
									alert("ขออภัยไม่สามารถส่งอีเมล์ยืนยันตัวตนไปยังอีเมล์ที่ท่านระบุไว้ได้ กรุณาตรวจสอบความถูกต้องอีกครั้ง");
									return false;
								}
							}
							alert(xmlHttp.responseText);
					} else {
								alert("พบข้อผิดพลาด "+xmlHttp.statusText);
							}
					}
				}
				xmlHttp.open("GET",strURL, true);
				xmlHttp.send(null);
			}
		}
	}
}

function get_newpassfrm()
{
	var strURL= "get_newpassfrm.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("sliderContent3").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_memberfrm()
{
	var strURL= "get_memberfrm.php?"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("sliderContent3").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function check_newpass()
{
	var old_pass = document.getElementById("old_pass");
	var newpass1 = document.getElementById("newpass1");
	var newpass2 = document.getElementById("newpass2");
	
	if(is_empty(old_pass,"","กรุณาป้อน รหัสผ่านเดิม"))
	{
		if(is_empty(newpass1,"","กรุณาป้อน รหัสผ่านใหม่"))
		{
			if(is_empty(newpass2,"","กรุณาป้อน ยืนยันรหัสผ่านใหม่"))
			{
				if(newpass1.value!==newpass2.value)
				{
					alert("รหัสผ่านใหม่ กับยืนยันรหัสผ่านใหม่ ไม่ตรงกัน!!!");
					newpass1.value="";
					newpass2.value="";
					newpass1.focus();
					return false;
				}else
				{
					var strURL= "check_newpass.php?oldpass="+encodeURIComponent(old_pass.value)+"&newpass="+encodeURIComponent(newpass1.value)+"&"+new Date().getTime() + Math.random();
					var xmlHttp = createXMLHttpRequest();
					if (xmlHttp) {
					xmlHttp.onreadystatechange = function() 
					{
						if (xmlHttp.readyState == 4) 
						{
							if (xmlHttp.status == 200) 
							{
								if(xmlHttp.responseText=="ok")
								{
									alert("แก้ไขรหัสผ่านใหม่เรียบร้อยแล้ว");
									return true;
								}else
								{
									alert("ไม่สามารถแก้ไขรหัสผ่านใหม่ได้ กรุณาตรวจสอบและทำรายการใหม่อีกครั้ง");
									return false;
								}
							} else {
										alert("พบข้อผิดพลาด "+xmlHttp.statusText);
									}
							}
						}
						xmlHttp.open("GET",strURL, true);
						xmlHttp.send(null);
					}
								}
			}
		}
	}
}

function get_show_app(appid)
{
	var strURL= "show_apps.php?appid="+appid+"&"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("content_about").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}

function get_useronlinenow(showhide)
{
	var strURL= "chat/user_now.php?showhide="+showhide+"&"+new Date().getTime() + Math.random();
	var xmlHttp = createXMLHttpRequest();
	if (xmlHttp) {
	xmlHttp.onreadystatechange = function() 
	{
		if (xmlHttp.readyState == 4) 
		{
			if (xmlHttp.status == 200) 
			{
				document.getElementById("userinlineid").innerHTML = xmlHttp.responseText;
			} else {
						alert("พบข้อผิดพลาด "+xmlHttp.statusText);
					}
			}
		}
		xmlHttp.open("GET",strURL, true);
		xmlHttp.send(null);
	}
}
