// JavaScript Document
function valmail()
{
	var mail = document.form1.email.value;
	if ((mail.length == 0) || (mail.indexOf("?",0) == 0)) {
		window.alert("Email address is required!"); return false;
	}
	if (mail.indexOf('@')<1 || mail.indexOf('@')==(mail.length-1)) {
		window.alert("Email address must be valid!"); 	return false;
	}
	if (mail.indexOf('.')<1 || mail.indexOf('.')==(mail.length-1)) {
		window.alert("Email address must be valid!"); return false;
	}
	else return true; 
}

function valcon()
{
	var Name = document.contact.cName.value;
	var Comp = document.contact.cComp.value;
	var Addr = document.contact.cAddr.value;
	var Phone = document.contact.cPhone.value;
	var Email = document.contact.cEmail.value;
	var Msg = document.contact.cMsg.value;
	if (!Name && !Comp && !Addr && !Phone && !Email && !Msg) {
		window.alert("Form contact is empty!"); return false;
	}
	if (Name == 0) {
		window.alert("Name is required!"); return false;
	}
	if (Comp == 0) {
		window.alert("Company name is required!"); return false;
	}
	if (Addr == 0) {
		window.alert("Address is required!"); return false;
	}
	if (Phone == 0) {
		window.alert("Phone number is required!"); return false;
	}
	if (isNaN(Phone)) {
		window.alert("Phone number must be number!"); return false;
	}
	if ((Email.length == 0) || (Email.indexOf("?",0) == 0)) {
		window.alert("Email address is required!"); return false;
	}
	if (Email.indexOf('@')<1 || Email.indexOf('@')==(Email.length-1)) {
		window.alert("Email address must be valid!"); 	return false;
	}
	if (Email.indexOf('.')<1 || Email.indexOf('.')==(Email.length-1)) {
		window.alert("Email address must be valid!"); return false;
	}
	if (Msg.length == 0) {
		window.alert("Message is required!");	return false;
	}
	else return true;
}

function valcsq()
{
	var Bn1 = document.csqpost.Bno1.value;	
	var Bn2 = document.csqpost.Bno2.value;	
	var Bn3 = document.csqpost.Bno3.value;	
	var Com = document.csqpost.cComment.value;	
	if (!Bn1 && !Bn2 && !Bn3 && !Com) {
		window.alert("Form CSQ masih kosong!"); return false;
	}
	if (Bn1.length == 0) {
		window.alert("Jawaban pada pertanyaan bagian B No 1 masih kosong!"); return false;
	}
	if (Bn2.length == 0) {
		window.alert("Jawaban pada pertanyaan bagian B No 2 masih kosong!"); return false;
	}
	if (Bn3.length == 0) {
		window.alert("Jawaban pada pertanyaan bagian B No 3 masih kosong!"); return false;
	}
	if (Com.length == 0) {
		window.alert("Kritik atau Saran masih kosong!"); return false;
	}
	else return true;
}

function valacc()
{
	var pass = document.add.cPass.value;
	var pass1 = document.add.cPass1.value;
	var pass0 = document.add.cPass0.value;
	if (!pass && !pass0 && !pass1) {
	window.alert("Form change account is empty!"); return false; }
	if (pass.length == 0) {
	window.alert("Old password is empty!"); return false; }
	if (pass0.length == 0) {
	window.alert("New password is empty!"); return false; }
	if (pass1.length == 0) {
	window.alert("Confirm password is empty!"); return false; }
	if (pass1 != pass0) {
	window.alert("Confirm password must be the same with the New password!"); return false;	} 
	else return true;
}
