<!--
function isBlank(theString){
	if ((theString == null) || (theString == "") || (theString == " ")){
		return true;
	}else{
		for(var i = 0; i < theString.length; i++){
			var c = theString.charAt(i);
			if ((c != '\n') && (c != '\t')){
				return false;
			}
		}
		return true;
	}
}
function onForgotPassword(strUID){
	var msg = "";
	if (isBlank(strUID)){
  	msg = "You must enter your User ID (NAEA ID) for the system to email you your password.\n";
  	msg += "If you do not know your User ID (NAEA ID), please contact the Society at info@taxproco.org.";
	}
	if (isNaN(strUID)){
	  msg = "Your User ID is your NAEA ID and should be all numbers, no letters or special characters.\n";
  	msg += "If you do not know your User ID (NAEA ID), please contact the Society at info@taxproco.org.";
	}
	if (isBlank(msg)){
		document.location.href = "pwd_mail.asp?id=" + strUID;
	}else{
		alert(msg);
	}
}
function chkLogin(theForm){
  var msg = ""
  if (isBlank(theForm.UserID.value)){
    msg += "Please enter a User ID\n"
  }
  if (isBlank(theForm.Password.value)){
    msg += "Please enter a Password"
  }
  if (isBlank(msg)){
    return true
  }else{
    alert(msg)
    return false
  }
}

function onItemFormSubmit(theForm){
	var haveItems = false
	for (var i = 0; i < theForm.length; i++){
		if (theForm.elements[i].type.toLowerCase() == "text"){
			if (!isBlank(theForm.elements[i].value)) { haveItems = true }
		}
	}
	if (!haveItems){
		alert("Please enter an item quantity and try again.")
	}
	return haveItems
}

function onImageClick(strWindowTitle, strImgName, intImgWidth, intImgHeight){
	var url = "img_zoom.asp?img=" + strImgName + "&title=" + strWindowTitle
	var intWindowWidth = intImgWidth + 25
	var intWindowHeight = intImgHeight + 70
	
	//Make sure the window will fit on an 8x6 screen vertically
	if (intWindowHeight > 525){
	  intWindowHeight -= (intWindowHeight - 525)
	  var scrollBarValue = "yes"
	}else{
	  var scrollBarValue = "no"
	}
	
	var strParams = "resizable=no,menubar=no,scrollbars=" + scrollBarValue + ",status=no,toolbar=no,"
	var strWidth = intWindowWidth.toString()
	var strHeight = intWindowHeight.toString()
	
	strParams += "width=" + strWidth + ",height=" + strHeight
	window.open(url, "", strParams)
}

//Popup window with no features
function openpopWindow(theURL,winName,features) {
  window.open(theURL,"",features);
}

//Returns value of incoming object, or selectedIndex of a drop down    
function GetObjValue(objField){
  switch (objField.type){
    case "text":
    case "hidden":
    case "password":
      return objField.value
    case "select-one":
      return objField.selectedIndex.toString()
  }
}

//Function to make sure a string is all numeric digits
function allDigits(str){
	return inValidCharSet(str, "0123456789")
}

//function to make sure the username and password is alpha-numeric
function isAlphaNum(fieldValue, bAllowSpace){
  var strValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_"
  if (bAllowSpace){
    strValidChars += " "
  }
  return inValidCharSet(fieldValue, strValidChars)
}

//Function to determine whether str contains only characters in charset
function inValidCharSet(str, charset){
	var result = true
	// Note: doesn't use regular expressions to avoid early Mac browser bugs	
	for (var i = 0; i < str.length; i++){
		if (charset.indexOf(str.substr(i,1)) < 0){
			result = false
			break
		}
	}
	return result
}

//Function to make sure a number string is in a specific format
function numFilter(objField, strLabel, strFormat) {
  //Grab the controls name and value, or selectedIndex in the case of a drop down
  var strObjName = objField.name //.toLowerCase()
  var strObjValue = GetObjValue(objField) //selectedIndex for drop downs
	if (!isBlank(strObjValue)) { //Do not perform if empty strObjValue
  	var chr = "";
		var numbers = ""; //Store all the numbers here
		//Process to remove non-numbers and spaces
		for(var i = 0; i < strObjValue.length; i++) {
			chr = strObjValue.charAt(i);
			if(!(isNaN(chr) || chr == " ")) numbers += chr;
		}
		//Remove country code, if any
		//if(numbers.substring(0, 2) == "47") numbers = numbers.substring(2, numbers.length);
		var output = ""; //Assign numbers here
		//assign numbers to chosen strFormat
		var n = 0, i = 0;
		while(i < strFormat.length && n < numbers.length) {
			chr = strFormat.charAt(i);
			if(chr == "#") {
				output += numbers.charAt(n++)
			} else {
				output += chr;
			}
			i++;
		}
		//If it's a phone number field, it must be 10 digits long plus 2 dashes.
		if (numbers.length != 10 && strObjName.toLowerCase().indexOf("phone") > -1) {
			return "--- The "+strLabel+" field must be 10 digits long in the format '###-###-####'\n"
		}else{
		  objField.value = output; //output to objField
		  return ""
		}
	}
}

function chkLength(fieldValue, fieldLabel, minLength, maxLength){
  var msg = ""
  //See if it's too short
  if (fieldValue.length < minLength){
    msg += "--- Length of "+fieldLabel+" is too short.\n"
  }
  //See if it's too long
  if (fieldValue.length > maxLength){
    msg += "--- Length of "+fieldLabel+" is too long.\n"
  }
  return msg
}

//-->