// Is_Empty( inputstring )
// Is_Valid_Email( emailaddy )
// Get_Radio_Value( radiogrp )

// IS_EMPTY( inputstring )
// Takes the string to check
// Returns TRUE if the string IS empty and FALSE if the string IS NOT empty
function Is_Empty( inputstring ){
	// If the string is null or the empty set then return true
	if( inputstring == null || inputstring == "" ){ return true; }
	// Else return false
	else { return false; }
}
// END OF FUNCTION

// IS VALID E-MAIL ADDRESS FUNCTION
// Returns TRUE if Email is valid and FALSE if NOT VALID
// Improvments made by Bob McKee on 03/20/2001
function Is_Valid_Email( address ){
	var tempchar;
	var at;
	var period;
	var invalchar = "/:,;";
	if( Is_Empty( address ) ){ return false; }
	for(i = 0; i < invalchar.length; i++){
		tempchar = invalchar.charAt(i);
		if( address.indexOf(tempchar, 0) > -1 ){ return false; }
	}
	at = address.indexOf("@", 1);
	if(at == -1){ return false; }
	if(address.indexOf("@", at + 1) > -1){ return false; }
	period = address.indexOf(".", at);
	if(period == -1){ return false; }
	if(period + 2 > address.length){ return false; }
	if(period - at < 2){ return false; }
	return true;
}
// END OF FUNCTION


// GET_RADIO_VALUE( radiogrp )
// Takes the radio group object
// Returns the value of the checked radio button in a group
function Get_Radio_Value( radiogrp ){
	var count;	// Loop counter
	// Loop through each radio button in group
	for( count = 0; count < radiogrp.length; count++ ){
		// If the button is checked
		// Return the value of the checked button
		if( radiogrp[count].checked == true ){
			return radiogrp[count].value;
		}
	}
	// If none of the radio buttons are checked return false
	return false;
}

//get value of checked radio button
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
// END OF FUNCTION
// END OF FUNCTION
// Is_Positive_Integer( num )
// Returns TRUE if num is a positive integer FALSE if not
// Created by Bob McKee on 03/20/2001
function Is_Positive_Integer( num ){
	num = num.toString();
	for(i = 0; i < num.length; i++){
		var thisChar = num.charAt(i);
		if(thisChar == "," && i != 0 && 
		(i+4 == num.length || num.charAt(i+4) == ",")){
			continue;
		}
		if(i == 0 && thisChar == "0"){
			return false;
		}
		if(thisChar < "0" || thisChar > "9"){ 
			return false;
		}
	}
	return true;
}
// END OF FUNCTION

// END OF SCRIPT

