function comment_webboard(){
	if(document.getElementById('content_1').value==''){
		alert('กรุณากรอกข้อความแสดงความคิดเห็น');
		document.getElementById('content_1').focus();
		return false;
	}else if(document.getElementById('cap1').value==''){
		alert('กรุณากรอกข้อมูลที่มองเห็น');
		document.getElementById('cap1').focus();
		return false;
	}else if(document.getElementById('cap1').value != document.getElementById('cap2').value){
		alert('กรุณากรอกข้อมูลที่มองเห็นให้ถูกต้อง');
		document.getElementById('cap1').focus();
		return false;			
	}else{
		document.myform.action='reply_update.php';
		document.myform.submit();
	}
}

function post_comment(){
	if(document.getElementById('content_1').value==''){
		alert('กรุณากรอกข้อความแสดงความคิดเห็น');
		document.getElementById('content_1').focus();
		return false;
	}else if(document.getElementById('cap1').value==''){
		alert('กรุณากรอกข้อมูลที่มองเห็น');
		document.getElementById('cap1').focus();
		return false;
	}else if(document.getElementById('cap1').value != document.getElementById('cap2').value){
		alert('กรุณากรอกข้อมูลที่มองเห็นให้ถูกต้อง');
		document.getElementById('cap1').focus();
		return false;		
	}else{
		document.myform.action='view_comment.php';
		document.myform.submit();
	}
}
function edit_comment(){
	if(document.getElementById('content_1').value==''){
		alert('กรุณากรอกข้อความแสดงความคิดเห็น');
		document.getElementById('content_1').focus();
		return false;	
	}else if(document.getElementById('cap1').value==''){
		alert('กรุณากรอกข้อมูลที่มองเห็น');
		document.getElementById('cap1').focus();
		return false;
	}else if(document.getElementById('cap1').value != document.getElementById('cap2').value){
		alert('กรุณากรอกข้อมูลที่มองเห็นให้ถูกต้อง');
		document.getElementById('cap1').focus();
		return false		
	}else{
		document.myform.action='view_comment.php';
		document.myform.submit();
	}
}

function checkform_mail(){
	if(document.myform.mail.value=='' || !document.myform.mail.value.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}$/i)){alert("กรุณาระบุ Email");document.myform.mail.focus();
	return false;
	}else{
	document.myform.action='member_lostpass_add.php';
	document.myform.submit();
	}
}

function checkcontact_mail(){
	if(document.getElementById('titie').value==''){
			alert('กรุณากรอกหัวข้อด้วยครับ');
			document.getElementById('titie').focus();
			return false;
	}else if(document.getElementById('mtel').value==''){
			alert('กรุณากรอกเบอร์โทรด้วยครับ');
			document.getElementById('mtel').focus();
			return false;
			}else  if(document.myform.mail.value=='' || !document.myform.mail.value.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}$/i)){alert("กรุณาระบุ Email");document.myform.mail.focus();
	return false;
	}else  if(document.getElementById('name').value==''){
			alert('กรุณากรอกชื่อด้วยครับ');
			document.getElementById('name').focus();
			return false;
			}else  if(document.getElementById('detail').value==''){
			alert('กรุณากรอกรายละเอียดด้วยครับ');
			document.getElementById('detail').focus();
			return false;
			}else{
	document.myform.action='sendmail.php';
	document.myform.submit();
	}
}

function frm_cancel(url){
	parent.location.href = url;
	}
	
function checkform_new(){
	
	  $(document).ready(function(){
            $(".register_form .regis-btn").focus(function(){
                $(this).parent().find(".error").css("display", "none");
                $(this).parent().find(".info").css("display", "inline");
            }).blur(function(){
                $(this).parent().find(".info").css("display", "none");
            });
        });
        
        
        $(".register_form .regis-btn").each(function(){
                var text = $(this).attr("value");
                if (text == "")
                {
                    $(this).parent().find(".error").css("display", "block");
                }
          });
        
        
	   
	
	if(document.myform.email.value=='' || !document.myform.email.value.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}$/i)){alert("กรุณาระบุ Email ที่ถูกต้อง\nเพราะคุณต้องยืนยันการสมัครสมาชิก ทาง Email\nและจะใช้ Email นี้ในการ Login");document.myform.email.focus();return false;}
	else if(document.myform.PassWord.value ==''){alert('กรุณาระบุ PassWord');document.myform.PassWord.focus();}
	else if(document.myform.PassWord.value != document.myform.PassWord1.value){alert('กรุณาระบุ PassWord ให้ตรงกันค่ะ');document.myform.PassWord1.focus();}
	else if(document.myform.UserName.value=='') {alert('กรุณาระบุชื่อที่แสดง');document.myform.UserName.focus();}
	else if(document.myform.member_fullname.value==''){alert('กรุณาระบุชื่อ-นามสกุล');document.myform.member_fullname.focus();}
	else{member_chk_new(document.myform.UserName.value,document.myform.email.value);}
}


function checkform_edit(){
	if(document.myform.PassWord.value != document.myform.PassWord1.value){alert('กรุณาระบุ PassWord ให้ตรงกันค่ะ');document.myform.PassWord1.focus();}
	else if(document.myform.member_fullname.value==''){alert('กรุณาระบุชื่อ-นามสกุล');document.myform.member_fullname.focus();}
	else if(document.myform.OldPass.value==''){alert('กรุณากรอกรหัสผ่านเดิม');document.myform.OldPass.focus();}
	else{
		document.myform.action='http://www.rongteen.com/member-edibboyt-exe.php';
		document.myform.submit();		
		//member_chk(document.myform.PassWord.value);
	}
}

