function isBlank(lstrText)
{
	for (var i = 0; i < lstrText.length; i++) 
	{
		var chr = lstrText.charAt(i);
		if (chr != ' ') return false;
	}
	return true;
}

function echeck(emailAddress)
{
	str = emailAddress;
	varoutputStr = "";
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
		varoutputStr = "0";
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
		varoutputStr = "0";
	}

	if (str.indexOf(at,(lat+1))!=-1)
	{
		varoutputStr = "0";
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	{
		varoutputStr = "0";
	}

	if (str.indexOf(dot,(lat+2))==-1)
	{
		varoutputStr = "0";
	}

	if (str.indexOf(" ")!=-1)
	{
		varoutputStr = "0";
	}

	return varoutputStr;
}

function formComplete()
{
	ErrorCheckStr = "";
	ErrorCheckVar = 0;

	if((document.reqform.firstname.value == "")||(isBlank(document.reqform.firstname.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "First name\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if((document.reqform.lastname.value == "")||(isBlank(document.reqform.lastname.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Last name\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}
	
	if((document.reqform.email_address.value == "")||(isBlank(document.reqform.email_address.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Your Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if(echeck(document.reqform.email_address.value) == "0")
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "You must use a real Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}
	
	if((document.reqform.password1.value == "")||(isBlank(document.reqform.password1.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "\nYou must enter a Password\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if(document.reqform.password1.value != document.reqform.password2.value)
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "\nYou have mistyped your Password\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if(ErrorCheckVar > 0)
	{
		ErrorCheckStr = "\n\nPlease complete the following fields:\n\n" + ErrorCheckStr + "\n\n";
		alert(ErrorCheckStr);
		return false;
	}
	else
	{
		return true;
	}
}


function formCompleteAdmin()
{
	ErrorCheckStr = "";
	ErrorCheckVar = 0;

	if((document.clientform.firstname.value == "")||(isBlank(document.clientform.firstname.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "First name\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if((document.clientform.lastname.value == "")||(isBlank(document.clientform.lastname.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Last name\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if((document.clientform.email.value == "")||(isBlank(document.clientform.email.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Your Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if(echeck(document.clientform.email.value) == "0")
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "You must use a real Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}
	
	if(ErrorCheckVar > 0)
	{
		ErrorCheckStr = "\n\nPlease complete the following fields:\n\n" + ErrorCheckStr + "\n\n";
		alert(ErrorCheckStr);
		return false;
	}
	else
	{
		return true;
	}
}

function formCompleteEMail()
{
	ErrorCheckStr = "";
	ErrorCheckVar = 0;

	if((document.reqform.firstname.value == "")||(isBlank(document.reqform.firstname.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "First name\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if((document.reqform.lastname.value == "")||(isBlank(document.reqform.lastname.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Last name\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}
	
	if((document.reqform.email_address.value == "")||(isBlank(document.reqform.email_address.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Your Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if(echeck(document.reqform.email_address.value) == "0")
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "You must use a real Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}
	
	if((document.reqform.notes.value == "")||(isBlank(document.reqform.notes.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "\nYou must enter an Image Description\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}


	if(ErrorCheckVar > 0)
	{
		ErrorCheckStr = "\n\nPlease complete the following fields:\n\n" + ErrorCheckStr + "\n\n";
		alert(ErrorCheckStr);
		return false;
	}
	else
	{
		return true;
	}
}

function formCompleteContact()
{
	ErrorCheckStr = "";
	ErrorCheckVar = 0;

	if((document.reqform.firstname.value == "")||(isBlank(document.reqform.firstname.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "First name\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if((document.reqform.lastname.value == "")||(isBlank(document.reqform.lastname.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Last name\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}
	
	if((document.reqform.email_address.value == "")||(isBlank(document.reqform.email_address.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Your Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if(echeck(document.reqform.email_address.value) == "0")
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "You must use a real Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}


	if(ErrorCheckVar > 0)
	{
		ErrorCheckStr = "\n\nPlease complete the following fields:\n\n" + ErrorCheckStr + "\n\n";
		alert(ErrorCheckStr);
		return false;
	}
	else
	{
		return true;
	}
}


function formCompletePass()
{
	ErrorCheckStr = "";
	ErrorCheckVar = 0;

	if((document.passform.email_address.value == "")||(isBlank(document.passform.email_address.value)))
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "Your Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}

	if(echeck(document.passform.email_address.value) == "0")
	{
		ErrorCheckVar = 1;
		ErrorCheckStr = ErrorCheckStr + "You must use a real Email Address\n";
	}
	else
	{
		ErrorCheckVar = ErrorCheckVar;
	}


	if(ErrorCheckVar > 0)
	{
		ErrorCheckStr = "\n\nPlease complete the following fields:\n\n" + ErrorCheckStr + "\n\n";
		alert(ErrorCheckStr);
		return false;
	}
	else
	{
		return true;
	}
}