  function validZip( val)  {
	if ((val.length != 5) && (val.length != 9) && (val.length != 10))
	
		return false;

	for (var i=0;i<val.length;i++)
	{
		if (i<5)
		{
			if (!((val.charAt(i) >= '0') && (val.charAt(i) <= '9')))
			
			  return false;
		}
		else 
		{
		  if (val.length == 9)
		  {
			  if (!((val.charAt(i) >= '0') && (val.charAt(i) <= '9')))
			 
			    return false;			

		  }
	      if (val.length == 10)
		  {
		  	if (i == 5)
		  	{
		  	  if (val.charAt(i) != '-')
		  	  
			    return false;

		  	}
		    else if (!((val.charAt(i) >= '0') && (val.charAt(i) <= '9')))
			
			    return false;			
		  }
		} 
	}  // end for
	return true;
  }
/////////////////////////////////////////////////////////////////////////
  function validHmPhone( val)  {
	if ((val.length < 7))
	
			return false;	
	    
  	for (var i = 0;i<val.length;i++)
  	{
  		var phoneStr = val.charAt(i);
		if (!((phoneStr >= '0') && (phoneStr <= '9'))&& phoneStr!='(' && phoneStr !=')'
			&& phoneStr!='.'&& phoneStr!='-') 
		
			return false;
  	}
  	return true;
  }
  function validEMail(  val)   {

    var mailStr;
    var i;
    var atFound;
    var dotFound;
    dotFound = false;
    atFound = false;
    // check first character
    mailStr = val.charAt(0);
    if ((mailStr == '.') || (mailStr == '@'))
      return false;


    // check last character
    mailStr = val.charAt(val.length - 1);
    if ((mailStr == '.') || (mailStr == '@'))
      return false;

    // check characters between first and last
    for (i = 1;i<val.length - 1;i++)
    {
      mailStr = val.charAt(i);
      if (mailStr == '@')
      {
        if (atFound) //|| (dotFound))
          return false;
        atFound = true;
        if (val.charAt(i+1) == '.')
      
          return false;
      }  // end if mailStr == '@'

      if (mailStr == '.')
      {
        if (val.charAt(i+1)== '@')

           return false;
        dotFound = true;
      }  // end if mailStr == '.'
    }  // end for loop
    if ((!(atFound)) || (!(dotFound)))
      return false;
    return true;
}

function getCurYear()  { 

/*  Different implementations of getYear() and getFullYear() in different versions of javascript 
 *  1.  Netscape previous to 4.0(JavaScript 1.2 and earlier versions):  Use getYear(). 
 *      The getYear() method returns either a 2-digit or a 
 *      4-digit year.  For years 1900-1999 returns 2 digit year. Example: 1999 returns 99. 
 *      For years 2000 or greater returns 4 digit year.  Example: 2000 returns 2000. 
 *  2.  Netscape 4.0 and after(javaScript 1.3 and after):  Use getFullYear() 
 *       returns 4 digit year.  Example: 2026 returns 2026. 
 *  3.  Microsoft Internet Explorer previous to 4.0: Use getYear(). 
 *      In JScript 1.0, which is installed with Microsoft Internet Explorer 3.0, the getYear() 
 *      method returns the current year minus 1900. So, the year 1999 returns 99 and the year 
 *      2000 returns 100. 
 *  4.  Microsoft Internet Explorer 4.0 and after(JScript 3.0 and after): Use getFullYear().  \ 
 *      See explanation 2 above. 
*/ 
 var year = 0; 
 var brwsr = navigator.appName; 
 var brwsrVer = navigator.appVersion; 
 var year = 0; 
 var year2 = 0; 
 // depending on browser and browser version get current year 
 if (((parseInt(brwsrVer) >= 4) && (brwsr == "Netscape")) || 
    ((parseInt(brwsrVer) >= 4 ) && (brwsr == "Microsoft Internet Explorer"))) 
 { 
  year = new Date().getFullYear(); 
 } 
 else if ((parseInt(brwsrVer) < 4) && (brwsr == "Netscape")) 
 { 
  year = new Date().getYear(); 
  if (year < 2000) 
   year = year + 1900; 
 } 
 else if ((parseInt(brwsrVer) < 4 ) && (brwsr == "Microsoft Internet Explorer")) 
 { 
  year = new Date().getYear() + 1900; 
 } 
 return year; 
}

function getMonth()
{
	var month = new Date().getMonth();
	return month;
}

function getDay()
{
	var day = new Date().getDate();
	return day;
	
}


var lastDay = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

//**** Set the days in the option boxes to correspond to the correct ones
//**** For the month
function setDayOptions(month,opt)
{
	var i;
	for(i=0;i<lastDay[month];i++)
		opt.options[i].text = i+1;
	for(i=lastDay[month];i<31;i++)
		opt.options[i].text = "";
}

function setFebruary(year)
{
	if(year%4==0 && year%100!=0)//works until 2400-Y2.4K is another problem.
		lastDay[1]=29;
	else
		lastDay[1]=28;
}

function checkLastDay(month,day,year)
{
	if(year%4==0 && year%100!=0)//works until 2400-Y2.4K is another problem.
		lastDay[1]=29;
	else
		lastDay[1]=28;
	return day<= lastDay[month];
}
//function to set year to reflect the fact that if
//month is earlier than current month or month is the 
// same but day is earlier you must have next year

function setYear(theMonth,theDate,theYear)
{
	var localDay = eval(theDate.selectedIndex+1);
	var localMonth = eval(theMonth.selectedIndex + 1);
	var month = getMonth()+1 ;
	var day = getDay();
//alert("local Month" +localMonth + " local Day " + localDay + " Month " + month + " Day " + day);
	if(localMonth<month ) 
		theYear.selectedIndex = 1;
	else if((localMonth==month && localDay<day))
		theDate.selectedIndex = day-1
	else
		theYear.selectedIndex=0;

// If it is a leep year don't change the end of Feb since if you
//are in February, you will want to keep day 29 no matter what day the 
//person selects. This is done on initialization 
//	checkLastDay(1,1,theYear.options[theYear.selectedIndex].text);
	setDayOptions(theMonth.selectedIndex,theDate);
	if(theDate.selectedIndex>lastDay[localMonth]-1)
		theDate.selectedIndex=lastDay[localMonth]-1
}


// This variation on the last function is used if the page has more than two years
// listed in the year options.

function setYearMany(theMonth,theDate,theYear)
{
	var localDay = eval(theDate.selectedIndex+1),
		localMonth =theMonth.selectedIndex;

	if(theYear.selectedIndex==0 &&(localMonth<month || (localMonth==month && localDay<day)))
		theYear.selectedIndex = 1;

// If it is a leep year don't change the end of Feb since if you
//are in February, you will want to keep day 29 no matter what day the 
//person selects
	checkLastDay(1,1,theYear.options[theYear.selectedIndex].text);
	setDayOptions(theMonth.selectedIndex,theDate);
	
}


function endOfMonth(month,day,year)
{
	if(year%4==0 && year%100!=0)//works until 2400-Y2.4K is another problem.
		lastDay[1]=29;
	return day== lastDay[month];
}

