

function chksubmit()
{
	if(document.getElementById('WBR_MSG').value=='')
	{
		alert('กรุณากรอกข้อความก่อนค่ะ');
		document.getElementById('WBR_MSG').focus();
		return false;	
	} 
	else if(document.getElementById('captcha2').value=='')
	{
		alert('กรุณากรอกตัวอักษร ตามที่ท่านเห็นก่อนค่ะ');
		document.getElementById('captcha2').focus();
		return false;

	}
	else if(document.getElementById('captcha2').value!=document.getElementById('captchk').value)
	{
		alert('กรุณากรอก  Confirm Code ให้ตรงกับที่ท่านเห็นก่อนค่ะ');
		document.getElementById('captcha2').focus();
		return false;

	}
	else if(document.getElementById('WBR_NAME').value=='')
	{
		alert('กรุณากรอก ชื่อ ผู้โพสต์ก่อนค่ะ! ');
		document.getElementById('WBR_NAME').focus();
		return false;

	}
	else if(document.getElementById('fileUpload').value!='')
	{
		var txt  = document.getElementById('fileUpload').value;
			 chlname = txt.split(".");
		var pointer = chlname.length -1;
		var chkvalid = chlname[pointer].toUpperCase();
		if((chkvalid!='JPG'))
		{
			alert('ไฟล์ภาพเฉพาะ .jpg .gif เท่านั้นค่ะ !');

		}else {
					document.cmform.submit();

		}
	}
	else {
		document.cmform.submit();
		return true;
	}
}

function imposeMaxLength(Object, MaxLen)	
{ 
	return (Object.value.length < MaxLen);
}
function splitMaxLength(Object, MaxLen)
{
	if (Object.value.length>=MaxLen) 
	{
		Object.value=Object.value.substring(0,(MaxLen-1));
		return 
	}
}

function printpr()
{
	browserVersion = parseInt(navigator.appVersion)
	if (browserVersion >= 4) window.print()
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function setsmile(what)
{
document.cmform.WBR_MSG.value = document.cmform.elements.WBR_MSG.value+" "+what;
document.cmform.WBR_MSG.focus();
}



function sortImg(wbpId)
  {
		obj.create();
		obj.url = "/showcomment.php";
		obj.method = "POST"
		obj.addParam("wbpId",wbpId);
		obj.function_name = "showview()"; 
		var xxx=obj.send();
  }


function showview()
{
	document.getElementById('showcomment2').innerHTML = obj.responseText;
}

