function validate_form(frm)
{
 if (frm.zip.value=="") 
 {
  frm.zip.focus();   
  alert('Please enter zip code');
  return(false);    
 }

 if (fValidateZip(frm.zip.value)==false)
 {
  frm.zip.focus();   
  alert('Invalid zip code entered');
  return(false);  
 }

 return(true);
}

function fValidateZip(xstr) 
{
 var x;
 var y;
 var validChars = "1234567890";
	
 if (xstr.length!=5)
 {
  return(false);
 }

 for (x=0; x < xstr.length; x++)
 {
  y = xstr.charAt(x);
  if (validChars.indexOf(y) == -1)
  {
   return(false);
  }
 }
  return(true);
}

function fSetFocus() 
{
 if (document.getElementById) 
 {
   document.getElementById("zip").focus();
 }
 else
 {
  if (document.all) 
  {
   document.forms(0).item(0).focus();
  }
 }
}
