<div id="bgmailfom">
	<script language="javascript">
		function validasi(form){
			formatnumber=/^[0-9]+$/;
			formatemail=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
			
			// FULL NAME
			if (form.pesan_name.value == ""){
				swal("Silahkan Masukkan Nama Lengkap Anda");
				form.pesan_name.focus();
				return (false);
			}  
			// TELEPHONE
			if (form.pesan_phone.value == ""){
				swal("Silahkan Masukkan Nomor Telepon/Handphone Anda");
				form.pesan_phone.focus();
				return (false);
			}
			if (!formatnumber.test(form.pesan_phone.value)){
				swal("Nomor Telepon/Handphone Harus Angka!");
				form.pesan_phone.focus();
				return (false);
			}
			if (form.pesan_phone.value.length < 10){
				swal("Format Nomor Telepon/Handphone Anda Salah!");
				form.pesan_phone.focus();
				return (false);
			}
			// EMAIL ADDRESS
			if (form.pesan_email.value == ""){
				swal("Silahkan Masukkan Alamat Email Anda");
				form.pesan_email.focus();
				return (false);
			} 
			if (!formatemail.test(form.pesan_email.value)){
				swal("Format Alamat Email Anda Salah!");
				form.pesan_email.focus();
				return (false);
			}			
			// SUBJECT
			if (form.pesan_subject.value == ""){
				swal("Silahkan tulis judul email anda");
				form.pesan_subject.focus();
				return (false);
			}
			// MESSAGE
			if (form.pesan_message.value == ""){
				swal("Silahkan tulis pesan anda");
				form.pesan_message.focus();
				return (false);
			}  
			return (true);
		}
	</script>
	<form action="emailaction" method="post" onSubmit="return validasi(this)">
		<div id="gformrows" class="clearfix">
			<div id="gformedit">
				<input name="pesan_name" type="text" placeholder="Nama Lengkap" class="fomcontac" autocomplete="off" />
			</div>
		</div>
		<div id="gformrows" class="clearfix">
			<div id="gformedit">
				<input name="pesan_phone" type="text" placeholder="Nomor Telepon/Handphone" class="fomcontac" autocomplete="off" />
			</div>
		</div>
		<div id="gformrows" class="clearfix">
			<div id="gformedit">
				<input name="pesan_email" type="email" placeholder="Alamat Email" class="fomcontac" autocomplete="off" />
			</div>
		</div>
		<div id="gformrows" class="clearfix">
			<div id="gformedit">
				<input name="pesan_subject" type="text" placeholder="Judul Pesan" class="fomcontac" autocomplete="off" />
			</div>
		</div>
		<div id="gformrows" class="clearfix">
			<div id="gformedit">
				<textarea name="pesan_message" type="text" placeholder="Pesan Anda" class="fomcontac"></textarea>
			</div>
		</div>
		<div id="gformrows" class="clearfix">
			<div id="gformedit">
				<?php
					include "../libs/functiondb.php";
					$madb = mysqli_query($koneksi, "SELECT * FROM cmas_phpmail");
					$madt = mysqli_fetch_array($madb);
				?>
				<script src="https://www.google.com/recaptcha/api.js" async defer></script>
				<div class="g-recaptcha" data-sitekey="<?php echo $madt['captcha_sitekey']; ?>"></div>
			</div>
		</div>
		<div id="gformrows" class="clearfix">
			<div id="gformedit">
				<input name="submit" type="submit" value="KIRIM" class="fullbutton"/>
			</div>
		</div>
	</form>
</div>