function showformChat() {
	document.getElementById('btnChat').style.display='none';
	document.getElementById('divChat').style.display='block';
}
function hideformChat() {
	document.getElementById('btnChat').style.display='block';
	document.getElementById('divChat').style.display='none';
}

function showformNong() {
	document.getElementById('divAddNong').style.display='none';
	document.getElementById('divNong').style.display='block';
}
function hideformNong() {
	document.getElementById('divAddNong').style.display='block';
	document.getElementById('divNong').style.display='none';
}

function checkForm(){
	var formChat =document.frmChat;

	if(formChat.chatname.value.length<1){
		alert("ระบุชือด้วย");
		formChat.chatname.focus();
		return false;
	}
	if(formChat.chatname.value.length>20){
		alert("ชือมันยาวไปจ้า");
		formChat.chatname.focus();
		return false;
	}
	if(formChat.txtchat.value.length<1){
		alert("ไม่มีข้อความที่จะคุย");
		formChat.txtchat.focus();
		return false;
	}
	return true;
}

function checkFormNong(){
	var formNong =document.frmNong;

	if(formNong.name.value.length<1){
		alert("ระบุชือด้วย");
		formNong.name.focus();
		return false;
	}
	if(formNong.name.value.length>20){
		alert("ชือมันยาวไปจ้า");
		formNong.name.focus();
		return false;
	}
	if(formNong.school.value.length<1){
		alert("ระบุโรงเรียนด้วย");
		formNong.school.focus();
		return false;
	}
	if(formNong.school.value.length>20){
		alert("ชือมันยาวไปจ้า");
		formNong.school.focus();
		return false;
	}
	if(formNong.txtNong.value.length<1){
		alert("แนะนำตัวด้วยน่ะ");
		formNong.txtNong.focus();
		return false;
	}
	return true;
}

function popup(linkhtml,w) {
window.open( linkhtml, "Camp", 
"status = 1, height = 460, width = "+w+", resizable = 0,scrollbars=1" )
}

function showPhoto(page,camp){
	var req;
	if(window.XMLHttpRequest)	{
		req=new XMLHttpRequest();
	}else if(window.ActiveXObject){
		req=new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		alert("Browser error");
		return false;
	}

	req.onreadystatechange=function(){
		if(req.readyState==3){
			var resultarea=document.getElementById("photo"+camp);
			resultarea.innerHTML="<img src='camp/images/35.gif'>";
		}
		if(req.readyState==4){
			var resultarea=document.getElementById("photo"+camp);
			resultarea.innerHTML=req.responseText;
		}	
	}
	var rstr,str;
	rstr=Math.random();

	str ="page="+page+"&camp="+camp+"&var="+rstr;
	req.open("GET","camp/photo1051.php?"+str,true);
	req.send(null);
}