
function ValidatePasswordUpdate()
{
	//1.Check if temporary password is not empty and 8 character
	//2.Compare new and confirmed passwords and their length
	
	var tempp=window.document.getElementById("temppwd").value;
	var newp=window.document.getElementById("newpwd").value;
	var confp=window.document.getElementById("confirmpwd").value;
	
	var err = false;


if((tempp=="")||(tempp.length!=8)) {

	window.document.getElementById("tpwd").style.color="red";
	err = true;
}
else{
	window.document.getElementById("tpwd").style.color="#008080";
}

if((newp.length<6)||(newp.length>10)){
window.document.getElementById("plength").style.color="red";
err = true;
}
else{

	window.document.getElementById("plength").style.color="#008080";
	
}
if((newp=="")||(confp=="")||(newp!=confp)){
	window.document.getElementById("cpwd").style.color="red";
	window.document.getElementById("npwd").style.color="red";
	err=true;
}
else{
	window.document.getElementById("cpwd").style.color="#008080";
	window.document.getElementById("npwd").style.color="#008080";
}

return !err;

	
}

function ValidateLogIn()
{
var eMail = window.document.getElementById("eMailLog").value;
var password = window.document.getElementById("PasswordLog").value;

var err=false;


var emailMask = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z])?[a-zA-Z]*)*\s+<(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})>$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$/;
// the regular expression that checks the validity of the email field


if(!emailMask.test(eMail)) {//errMessage = "Invalid eMail!<br>"; 
	window.document.getElementById("email_log").style.color="red";
	err=true;
}
else{
	window.document.getElementById("email_log").style.color="#008080";

}

if((password.length<6)||(password.length>10)||(password=="")){//errMessage +="Password must include 6 - 10 characters"; 
	window.document.getElementById("password_log").style.color='red';
	err = true;
}
else{
	window.document.getElementById("password_log").style.color='#008080';
	
}

if(err){//window.document.getElementById("login").submit();
return false;

}
else
{return true;}
}

function ValidateRegister()
{
var err; err=false;
var fname = window.document.forms["register"].elements["FirstName"].value;
var lname = window.document.forms["register"].elements["LastName"].value;

if((fname=="")||(lname=="")){
window.document.getElementById("firstlast").style.color='red';
err = true;
}
else
{
 window.document.getElementById("firstlast").style.color = "#008080";
}


var hph = window.document.forms["register"].elements["HomePhone"].value;
var phonemask = /^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}$/;

	if(!phonemask.test(hph)){
		window.document.getElementById("homephone").style.color='red';
		err = true;
	}
	else {
		window.document.getElementById("homephone").style.color='#008080';

	}
	
var email = window.document.forms["register"].elements["eMailReg"].value;


var emailmask = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z])?[a-zA-Z]*)*\s+<(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})>$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$/;
		
		if(emailmask.test(email)){
		window.document.getElementById("email").style.color='#008080';
	
	}
	else {
		window.document.getElementById("email").style.color='red';
		err = true;
	
	}


	/*
		var pwd = window.document.forms["register"].elements["PasswordReg"].value;
		var cpwd = window.document.forms["register"].elements["ConfirmPassword"].value;

		if((pwd!=cpwd)||(pwd.length<6)||(pwd.length>10)){
			window.document.getElementById("password").style.color='red';
			window.document.getElementById("confirmpassword").style.color='red';
			err = true;
		}
		else{

			window.document.getElementById("password").style.color='#008080';
			window.document.getElementById("confirmpassword").style.color='#008080';
		}
	*/


if(err){
return false;
}
else
{return true;}

}


function resetLogIn()
{
window.document.getElementById("errLog").innerHTML="&nbsp;";
window.document.getElementById("login").reset();
}

function resetRegister(){
window.document.getElementById("errRegister").innerHTML = "&nbsp;";
window.document.getElementById("register").reset();
}

function f(){return ;}


