// FormChek.js
//
// 18 Feb 97 created Eric Krock
//
// (c) 1997 Netscape Communications Corporation




var digits = "0123456789";

var lowercaseLetters = "abcdefghijklmnopqrstuvwxyz"

var uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"


var whitespace = " \t\n\r";




var mPrefix = "You did not enter a value into the "
var mSuffix = " field. This is a required field. Please enter it now."

var sStyle = "Style"


var defaultEmptyOK = false



function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}


function isWhitespace (s)

{   var i;

    if (isEmpty(s)) return true;

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    return true;
}





function stripWhitespace (s)

{   return stripCharsInBag (s, whitespace)
}


function stripInitialWhitespace (s)

{   var i = 0;

    while ((i < s.length) && charInString (s.charAt(i), whitespace))
       i++;
    
    return s.substring (i, s.length);
}




function prompt (s)
{   window.status = s
}




function promptEntry (s)
{   window.status = pEntryPrompt + s
}




function warnEmpty (theField, s)
{   if (theField.type == "text") theField.focus()
    alert(mPrefix + s + mSuffix)
    return false
}




function warnInvalid (theField, s)
{   theField.focus()
    theField.select()
    alert(s)
    return false
}



// function to check if radio button is checked by Les White 10/00
function checkRadio (theField, s)
{    if (!getRadioButtonValue (theField)) 
       return warnEmpty (theField, s);
    else return true;
}






//this function modified by Les White 10/00 to just check to see if a choice was made.
//Original function returned the value of the choice but didn't work if no choice was made
function getRadioButtonValue (radio)
{   for (var i = 0; i < radio.length; i++)
    {   if (radio[i].checked) return true;
    }
	 return false;
}


