function hasValue(elm) {
	if (elm.value == "" || elm.value == null)
		return false;
	else 
		return true;
}

//used for combo boxes
function dropdownHasValue(elm){
	if (elm.options[elm.selectedIndex].value == "" || elm.options[elm.selectedIndex].value == null)
		return false;
	else 
		return true;
}

function isDate(elm) {
	if (elm.value.search(/[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9]/) != -1)
		return true;
	else
		return false;
}
	
function isLetter (c) {
	return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}

// Returns true if character c is a digit 
// (0 .. 9).

function isDigit (c) {
	return ((c >= "0") && (c <= "9"))
}

function isAlphaNumericHyphen (s) {
	var i, result;
	// Search through string's characters one by one
	// until we find a non-alphanumeric character.
	// When we do, return false; if we don't, return true.
	for (i = 0; i < s.length; i++) {   
		// Check that current character is number or letter.
		var c = s.charAt(i);
		if (! ( (isLetter(c) || isDigit(c) || c == "-") )) {
			// An invalid character was found
			return false;
		}
	}
	// All characters are numbers or letters.
	return true;
}

function isNumericHyphen (s) {
	var i, result;
	// Search through string's characters one by one
	// until we find a non-numeric character.
	// When we do, return false; if we don't, return true.
	for (i = 0; i < s.length; i++) {   
		// Check that current character is number or hyphen.
		var c = s.charAt(i);
		if (! ( (isDigit(c) || c == "-") )) {
			// An invalid character was found
			return false;
		}
	}
	// All characters are numbers or hyphens.
	return true;
}

function validateHyphens (s) {
	var i;
	for (i = 0; i < s.length; i++) {   
		// Check that current character is number or letter.
		var c = s.charAt(i);
		// Hyphens are only valid in the 3rd and 7th character positions
		// Is the current char a dash
		if (c=="-") {
			// If the dash is not in a valid position
			if (!(i==2 || i==6)) {
				return false;					 // return invalid dashes
			}
		}
	}  // end for
	// Any dashes are in valid positions
	return true;
}

function isEmail(elm) {
	if (elm.value.search(/\w.*\@[a-zA-Z0-9].*\.[a-zA-Z0-9].*/) != -1)
		return true;
	else
		return false;
}
function hasNoTagChars(elm) {
	if ((elm.value.search(/>/) == -1) && (elm.value.search(/</) == -1))
		return true;
	else
		return false;
}

function isFilled(elm) {
	if (elm.value == "" || elm.value == null)
		return false;
	else
		return true;
}

function validateZip(thisControl)
{
	if (thisControl.value.length > 0){
		if ((thisControl.value.length < 5) || !(isNumeric(thisControl.value)))
		{
			return false;
		}
		return true;
	}
}

function isNumeric(strInput)
{
    var strLength = strInput.length;
    var goodStr   = true;


 for(var i=0; i<strLength ; i++)
  {
   var Char = strInput.substring(i,i+1);
   if (Char < "0"  || Char > "9")
    {
     return false;
    }
  }


 return true;

}


function setActionScript(form)
{
	//form.action = document.all.actionVariable.value;
	form.action = document.forms[0].actionVariable.value;
	form.method = "get";
}

