function checkcomment(check){
		if(check==1){
				if(document.getElementById('name').value){
					return true;
				}else{
					alert('กรุณากรอกชื่อด้วยค่ะ');
					document.getElementById('name').style.border = '1px solid #FF0000' ;
					document.getElementById('name').focus() ;
					return false;
				}
			}else{
			return true;
				}
	}

function replaceText(text, textarea)
	{
		 // Attempt to create a text range (IE).
		 if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange)
		{
		 var caretPos = textarea.caretPos;
		 
		  caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		  caretPos.select();
		  }
		  // Mozilla text range replace.
		  else if (typeof(textarea.selectionStart) != "undefined")
		  {
		  var begin = textarea.value.substr(0, textarea.selectionStart);
		  var end = textarea.value.substr(textarea.selectionEnd);
		  var scrollPos = textarea.scrollTop;
		 
		  textarea.value = begin + text + end;
		 
		  if (textarea.setSelectionRange)
		  {
			  textarea.focus();
			  textarea.setSelectionRange(begin.length + text.length, begin.length + text.length);
		  }
		  textarea.scrollTop = scrollPos;
		  }
		  // Just put it on the end.
		  else
		  {
			  textarea.focus();
			  textarea.value += text;
			  textarea.focus(textarea.value.length - 1);
		  }
	 }
 
 function quoteDiscussion(text,textarea){
		var str='';
		str+= '[quote]';
		str+= text;
		str+= '[/quote]\n';
		replaceText(str,textarea);
		
	}

function showhide(id){
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
}
 
function sendtodelete(topic,msg) {
	window.open('http://fangpleng.com/report-topic.php?topic=' + topic +'&msg=' + msg, '', 'width=550,height=300,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no');
	}
