// LOGBOX ----------------------------------------------------- // 
//	Logbox Check
//	Check Email

// Check Logbox -----------------------------------------------
function logbox_check() {
	var passwd=document.lbx.passwd; var email=document.lbx.email;
	// Check email
	if(!chk_email(email.value)){
		alert("This email address is invalid.");
		email.focus(); email.style.background = "yellow"; return false;
	}
	else email.style.background = "white";

	// Check Password Length
	if (passwd.value.length < 6) {
		alert('Password: Minimum length is 6 characters');
		passwd.style.background = "yellow"; passwd.focus(); return false;
	}
	else passwd.style.background = "white";
}

// Check Email ------------------------------------------------
function chk_email(addr) {

	ok="1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < addr.length ;i++) { if(ok.indexOf(addr.charAt(i))<0) return (false); } 

	re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
	re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
	if (!addr.match(re) && addr.match(re_two)) { return (-1); } 
}

function chk_logeml() {
	var email=document.LogEML.email;
	// Check email
	if(!chk_email(email.value)){
		alert("This email address is invalid.");
		email.focus(); email.style.background = "yellow"; return false;
	}
	else email.style.background = "white";
}

