//set form focus on paramters
function isInteger(iValue)
{
	var valid = true;
    var inputStr = iValue.toString();

    for (var i = 0; i < inputStr.length; i++)
    {
        var oneChar = inputStr.charAt(i);	

        if (oneChar == ".")
    	{
    		continue;
    	}	
        if ((oneChar < "0" || oneChar > "9") && oneChar != "/")
        {
            valid = false;
        }
    }
        return (valid);
}

function checkDate(myDate, suppressMsg)
{
    /*
    this function checks to see if the date passed is a 
    valid date in the form of month day year, ex 02/29/2001
    
            '/' must be included
            suppressMsg is either true or false, 
    			true will cause msg's in this function not to be shown.  
     		false will show msg's generated in this function.  
    */
    var msg = "Your date had the following problems:\n\n";
    var valid = true;
    
    var position = myDate.indexOf("/");
    if ((position == -1) || (myDate.indexOf("/",position + 1) == -1))
    {
    //no slash found or no second slash found
    valid = false;
    msg = msg + "   You did not enter a valid date, mm/dd/yyyy\n";
    }
    
    if (valid)
    {
    //parse the date entered, must contain two /'s
    myDate = myDate.split("/");		//array containing [0] month, [1] day, [2] year
    
    //now check each value, month and day 1 - 2 digits, year is 4 digits
    if 	(
    (! ((myDate[0] >= 1) && (myDate[0] <= 12))) ||
    (! ((myDate[1] >= 1) && (myDate[1] <= 31))) ||
    (! ((myDate[2] >= 0) && (myDate[2] <= 9999))) ||
    ((myDate[2].length != 4) && (myDate[2].length != 2))
    )
    {			
    valid = false;
    msg = msg + "   You did not enter a valid date, mm/dd/yyyy\n";
    }
    }
    		
    if (valid)
    {
    //if the date was in the right format, continue the checks
    
    //get today's date
    var today = new Date();
    var todayMonth = today.getMonth() + 1;	//month counts from 0 to 11
    var todayDay = today.getDate();
    var todayYear = today.getYear();
    if (todayYear == "00") 
    todayYear = 2000 + todayYear; 
    else
    todayYear = 1900 + todayYear;			
    
    //get rid of the time stamp for greater than or equal to
    today = todayMonth + "/" + todayDay + "/" + todayYear;
    today = new Date(today);
    
    //check for a leap year, a leap year is divisible by 4, 
    //unless divisible by 100 
    //unless deivible by 400, ex 1900 isn't but 2000 is
    if ((myDate[0] == 2) && (myDate[1] >= 29))
    {
    	if ((myDate[2] % 4) == 0)
    	{
    		if ((myDate[2] % 100 ) == 0)
    		{
    			if((myDate[2] % 400) != 0)
    			{
    				//this is not a leap year
    				msg = msg + "   " + myDate[2] + " is not a leap year\n";
    				valid = false;
    			}
    		}
    	}
    	else
    	{
    		//this is not a leap year
    		msg = msg + "   " + myDate[2] + " is not a leap year\n";
    		valid = false;
    	}
    } //end if month = 2 and day >= 29	
    //end checking for leap year
    }//end if valid
    
    if (! valid) if (! suppressMsg) alert(msg);
    return(valid);

}//end function