// JavaScript Document
// Counting Alpha for the Text Fields
function checkChars(fieldObj, maxLength, errorId){
	
	//This function writes how many characters the user has left in the message div.
	
	var messageBox = fieldObj;
	var messageLength = messageBox.value.length;
	var lengthRemaining = maxLength - messageLength;
		if (document.getElementById) {
		if(lengthRemaining >1 || lengthRemaining == 0){
			msgText ="<strong>"+ lengthRemaining + "</strong> characters remaining"
		} else if(lengthRemaining == 1){
			msgText = "<strong>"+ lengthRemaining + "</strong> character remaining"
		} else {
			//This stops the user entering any more chars when they reach the maxLength
			messageBox.value = messageBox.value.substring(0, maxLength);
		}
		//Write error message to message div.
		document.getElementById(errorId).innerHTML = msgText;
	}
}
//-----------------------------------------------------------------------------------------------
//Chk the White space in the Text Fields.
function isWhitespace(s)
{
   var i;
   for (i = 0; i < s.length; i++)
   {
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if(c!=" ")
		return false;
   }
   // All characters are whitespace.
   return true;
}
//-----------------------------------------------------------------------------------------------
function LoginValidation(myform){

	if((myform.LoginID.value == "") || (myform.LoginID.value == "Login ID")){
		alert("Please enter 'Login ID'.");
		myform.LoginID.focus();		
		return false;}
	else{
		if(isWhitespace(myform.LoginID.value)){
			alert("'Login ID' cannot contain only spaces.");
			myform.LoginID.focus();
			return false;}
		}	

	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	for (var i = 0; i < myform.LoginID.value.length; i++) {
  		if (iChars.indexOf(myform.LoginID.value.charAt(i)) != -1) {
  		alert ("'Login ID' has special characters. \nThese are not allowed.\n Please remove them and try again.");
		myform.LoginID.focus();
  		return false;
  		}
 	 } 
	
	if((myform.Pass.value == "") || (myform.Pass.value == "Password") ){
		alert("Please enter 'Password'.");
		myform.Pass.focus();		
		return false;}
	else{
		if(isWhitespace(myform.Pass.value)){
			alert("'Password' cannot contain only spaces.");
			myform.Pass.focus();
			return false;}
		}	
	
	
	return true;
}
//-----------------------------------------------------------------------------------------------
function ForgotPassword(){
	window.open('ForgotPassword.asp','ForgotPassword','width=550,height=325,top=20px,left=20px');
}
//-----------------------------------------------------------------------------------------------
function ShowCompleteNotice(NBID){
	window.open('NoticBoardPopup.asp?NBID='+NBID+'','NoticeBoard','scrollbars=yes, width=570, height=550, top=20px, left=20px');		
}
//-----------------------------------------------------------------------------------------------
function ShowCompleteBMM(BMMID){
	window.open('BoardMeetingMinutes_Popup.asp?BMMID='+BMMID+'','BMM','scrollbars=yes, width=570, height=550, top=20px, left=20px');		
}
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------