// View content
<!--

var xmlhttp=false;

try
{
	xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");	
	
} catch(e)
	{
		try{				
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}catch(E)
	{
		xmlhttp=false;
	}	
}

if(!xmlhttp && typeof XMLHttpRequest !='undefined'){
	xmlhttp=new XMLHttpRequest();		
}


var xmlhttp2=false;

try
{
	xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP");	
} catch(e)
	{
		try{				
			xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");		
	}catch(E)
	{
		xmlhttp2=false;
	}	
}

if(!xmlhttp2 && typeof XMLHttpRequest !='undefined'){
	xmlhttp2=new XMLHttpRequest();		
}

function trimAll(sString) 
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

//modified on 19-2-2007
function hidecontent(obj2hide)
{
	document.getElementById(obj2hide).innerHTML="";	
}

function loadcontent(url,loadto,loadtemp)
{
	var loadtemp="<table width=\"100%\" height=\"421\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"center\" height=\"421\">Loading........</td></tr></table>";
	var trv=document.getElementById(loadto)
	if(loadtemp=='1'){
		trv.innerHTML=loadtemp;
	}else{
		trv.innerHTML="<center>Loading........</center>";
	}
	serverPage=url;	
	xmlhttp.open("POST",serverPage,true);	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			//trv.innerHTML="";
			trv.innerHTML=xmlhttp.responseText;
		}	
	}
	xmlhttp.send(null);	
}

function load2content(contenturl1,contentdiv1,contenturl2,contentdiv2)
{	
	loadcontent(contenturl1,contentdiv1);
	loadcontent2(contenturl2,contentdiv2);
}


function loadcontentnostatus(url,loadto)
{
	
	var trv=document.getElementById(loadto)
	serverPage=url;	
	xmlhttp.open("POST",serverPage,true);	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			trv.innerHTML=xmlhttp.responseText;
		}	
	}
	xmlhttp.send(null);	
}

function loadcontent2(url,loadto)
{
	
	var trv=document.getElementById(loadto)
	trv.innerHTML="<center>Loading........</center>";
	serverPage=url;	
	xmlhttp2.open("POST",serverPage,true);	
	xmlhttp2.onreadystatechange=function(){
		if(xmlhttp2.readyState==4 && xmlhttp2.status==200){
			trv.innerHTML="";
			trv.innerHTML=xmlhttp2.responseText;
		}	
	}
	xmlhttp2.send(null);	
}

function loadcontentWithPrompt(url,loadto,Msg)
{
	if (Msg!='No'){ 
		var confirmMsg  = 'Do you want to ';
		var is_confirmed = confirm(confirmMsg + ' :\n' + Msg);
		if(is_confirmed==false){
			return false;
		}
	}
	
	var trv=document.getElementById(loadto)
	//trv.innerHTML='Loading...';
	serverPage=url;	
	xmlhttp.open("POST",serverPage,true);	
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			//trv.innerHTML="";
			trv.innerHTML=xmlhttp.responseText;
		}	
	}
	xmlhttp.send(null);	
}

function displayMsg(msg,displayin) {
	document.getElementById(displayin).innerHTML=msg;
}
function CheckContact(theform) {
	if(document.getElementById("ysubject").value==""){
		alert("กรุณากรอกชื่อเรื่อง");
		document.getElementById("ysubject").focus();
		return false;
	}	
	if(document.getElementById("yname").value==""){
		alert("กรุณากรอกชื่อของท่าน");
		document.getElementById("yname").focus();
		return false;
	}	
	if(document.getElementById("yemail").value==""){
		alert("กรุณากรอกชื่ออีเมล");
		document.getElementById("yemail").focus();
		return false;
	}	
	if(document.getElementById("yphone").value==""){
		alert("กรุณากรอกหมายเลขโทรศัพท์");
		document.getElementById("yphone").focus();
		return false;
	}
	if(document.getElementById("ymsg").value==""){
		alert("กรุณากรอกข้อความ");
		document.getElementById("ymsg").focus();
		return false;
	}
}
function loginnow(theform) {
	if(theform.loginname.value==""){
		alert("Please enter your loginname.");
		document.getElementById("loginname").focus();
		return false;
	}
	if(theform.loginpassword.value==""){
		alert("Please enter your login password.");
		document.getElementById("loginpassword").focus();
		return false;
	}
	document.getElementById("loginstatus").innerHTML="Logging in...";
	//theform.submit();	
}
function CheckProduct(theform) {
	if(theform.catid.value=="0"){
		alert("Please select category name.");
		theform.catid.focus;
		return false;
	}	
	if(theform.productname.value.length=="0"){
		alert("Please type product name.");
		theform.productname.focus();
		return false;
	}	
	return true;
}
function CheckTopic(theform) {
	if(theform.postedby.value==""){
		alert("กรุณากรอก ชื่อผู้ประกาศ.");
		theform.postedby.focus();
		return false;
	}	
	if(theform.select_cat.value=="*"){
		alert("กรุณาเลือกหมวดหมู่");
		theform.select_cat.focus();
		return false;
	}	
	if(theform.titletxt.value==""){
		alert("กรุณากรอก หัวข้อกระทู้.");
		theform.titletxt.focus();
		return false;
	}	
}

function CheckComment(theform) {
	if(theform.postedby.value==""){
		alert("กรุณากรอก ชื่อผู้แสดงความคิดเห็น.");
		theform.postedby.focus();
		return false;
	}	
}
function Albumchk(thisform) { 
	//alert("dd");
	if(document.getElementById("owner").value==""){
		alert("Login session ของคุณหมดอายุ กรุณา Login ใหม่");
		return false;
	}
	
	if(document.getElementById("albumname").value==""){
		alert("กรุณาใส่ชื่ออัลบัม");
		document.getElementById("albumname").focus();
		return false;
	}	
	
}
function SubmitUpload(frm) { 
		var statusbar="<span style=\"font-size:14px; color:#FF0000\">กำลังอับโหลด. . .  โปรดคอยสักครู่ใหญ่ ๆ </span> <img src=\"images/splash_line.gif\" border=\"0\" />";
		document.getElementById("uploadstatus").innerHTML=statusbar;	
		document.getElementById("frmupload").submit();
}
function searchcmd() { 
	var kw=document.getElementById('keyword').value;
	var opt=document.getElementById('findword').value;
	
	var opt="";
	for (i=0;i<document.getElementById("frmSearch").findword.length;i++){
		if (document.getElementById("frmSearch").findword[i].checked==true){
			opt=document.getElementById("frmSearch").findword[i].value;
		}		
	}
	//alert(kw);
	loadcontent('dict.php?kw='+URLEncode(kw),'mainarea');
	
}
//-->