//==== Check and create flash object
function MM_CheckPlugin(plgIn, theFlash, theJPG, autoGo, pWidth, pHeight) { 
	var ok=false; document.MM_returnValue = false;
	with (navigator) if (appName.indexOf('Microsoft')==-1) ok=(plugins && plugins[plgIn]);
	else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
	if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
	else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
	else ok=false; }
	if (!ok)
	{
		document.write("<img src='" + theJPG + "' width=" + pWidth + " height=" + pHeight + ">");
	} else 
	{
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0' width=" + pWidth + " height=" + pHeight + "><param name=movie value='"+ theFlash + "'><param name=quality value=high>");
		document.write("<embed src='" + theFlash + "' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=" + pWidth + " height=" + pHeight + "></embed></object>");
	}
}

//==== change image on mouse over event
function mOver(imageName){
	 if (document.images) {
	document[imageName].src =eval(imageName + "Over.src");
	}
}

//==== change image on mouse out event
function mOut(imageName) {
	 if (document.images) {
	document[imageName].src =eval(imageName + "Out.src");
	}
}

//==== change other image on mouse over event
function bsOver(imageName){
	 if (document.images) {
	document.bs.src =eval(imageName + "Over.src");
	}
}

//==== change image on mouse out event
function bsOut(imageName) {
	 if (document.images) {
	document.bs.src =eval(imageName + "Out.src");
	}
}

//==== chane URL
function Redirect(destURL)
{
	top.location.href=destURL;
}

//==== change URL with delay
function RedirectWithDelay(destURL, theDelay)
{
	window.setTimeout("Redirect('"+destURL+"');", theDelay);
}

//==== animate title bar initilize
function AniTitleBar() {
	var bText=document.title
	var bLength=bText.length+10
	TypeTitleBar(0, bText, bLength)
}

//==== type new title bar
function TypeTitleBar(it, bText, bLength){
	if (it<=bLength){
		document.title=bText.substring(it,bLength)
		it++
		setTimeout("TypeTitleBar('"+it+"', '"+bText+"', "+bLength+")",500)
	}
	else{
		it=0
		TypeTitleBar(0, bText, bLength)
//		return
	}
}

function ShowLastModify(theDate)
{
	theMonth = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
//	theMonth = new Array ("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฏาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
	document.write (" Last modified :  ", Math.abs(theDate.substring(3,5)), " ", theMonth[Math.abs(theDate.substring(0,2))-1] , " ", Math.abs(theDate.substring(6,11)) );
//	document.write (" ปรับปรุงข้อมูลล่าสุด :  ", Math.abs(theDate.substring(3,5)), " ", theMonth[Math.abs(theDate.substring(0,2))-1] , " ", Math.abs(theDate.substring(6,11)) + 543);
}

function ValidateField_board(theForm)
{
	if ( (theForm.txtName.value == "") || (theForm.txtContent.value == "") 	)
	{
		alert("คุณยังกรอกข้อมูลที่จำเป็นไม่ครบค่ะ");
		return (false);
	}
}

function ValidateField_board_newtopic(theForm)
{
	if ( (theForm.txtName.value == "") || (theForm.txtContent.value == "") 	|| (theForm.txtSubject.value == "") 	)
	{
		alert("คุณยังกรอกข้อมูลที่จำเป็นไม่ครบค่ะ");
		return (false);
	}
}