<!--
function popWindow(theURL,winName,features){ window.open(theURL,winName,features); }
function preloadImages() {
     var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
     var i,j=d.MM_p.length,a=preloadImages.arguments;
   for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function eCheckDate(sn) {
      s= sn.value;
      var i=0;
      tm= new Array();
      tm[0]= '';tm[1]= '';tm[2]='';tm[3]='';
      sep='';
      md = 0 ;

      while (i< s.length) {
          ch= s.substring(i, i + 1);
          if( ch<='9' && ch>='0')
              tm[md] += ch;
          else if (sep=='') {
              if(ch=='.' || ch=='/' || ch=='-') {
                   md++;
                   sep=ch;
              }
          }
          else if (ch==sep) {
             md++;
             if(md>2) return false;
          }
          else return false;

          i++;
      }

      if(tm[3]!='') return false;
      if(tm[0].valueOf()<1 || tm[0].valueOf()>12) return false; //Month
      if(tm[1].valueOf()<1 || tm[1].valueOf()>31) return false;
      if(tm[2].valueOf()<100) return false;

      if ((tm[0]==4 || tm[0]==6 || tm[0]==9 || tm[0]==11) && tm[1]==31)
          return false;
      if (tm[0]==2) {
           isleap = (tm[2] % 4 == 0 && (tm[2] % 100 != 0 || tm[2] % 400 == 0));
           if (tm[1]>29 || (tm[1]==29 && !isleap))
                return false;
      }

      return (tm[3]=='');
}

function CheckDate(theForm){
   for(var i=1; i<CheckDate.arguments.length; i++)
         if (!eCheckDate(theForm.elements[CheckDate.arguments[i]])){
            alert("Invalid Date");
            theForm.elements[CheckDate.arguments[i]].focus();
            return false;
        }
   return true;
}

function eCheckEMail(sn){
    s= sn.value;
    if (s.indexOf("@") == -1) return false;
    if (s.indexOf(".") == -1) return false;
    at=false;
    dot=false;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                if (ch == "@"){
                  if (at) return false;
                  else at=true;
                }
                if ((ch==".") && at)
                   dot=true;
        }
        else return false;
    }
   return dot;
}

function CheckEMail(theForm){
   for(var i=1; i<CheckEMail.arguments.length; i++)
         if (!eCheckEMail(theForm.elements[CheckEMail.arguments[i]])){
            alert("Field entry is not valid");
            theForm.elements[CheckEMail.arguments[i]].focus();
            return false;
        }
   return true;
}


function eCheckAlpha(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")))
             return false;
        }
   return true;
}

function CheckAlpha(theForm){
   for(var i=1; i<CheckAlpha.arguments.length; i++)
         if (!eCheckAlpha(theForm.elements[CheckAlpha.arguments[i]])){
            alert("Field entry is not valid");
            theForm.elements[CheckAlpha.arguments[i]].focus();
            return false;
        }
   return true;
}

function eCheckAlphaNum(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
           || (ch >= "0" && ch <= "9")))
             return false;
        }
   return true;
}
function CheckAlphaNum(theForm){
   for(var i=1; i<CheckAlphaNum.arguments.length; i++)
         if (!eCheckAlphaNum(theForm.elements[CheckAlphaNum.arguments[i]])){
            alert("Field entry is not valid");
            theForm.elements[CheckAlphaNum.arguments[i]].focus();
            return false;
        }
   return true;
}

function eCheckNum(sn){
    s= sn.value;
    for (var i = 0; i < s.length; i++) {
        ch = s.substring(i, i + 1)
        if (!(ch >= "0" && ch <= "9"))
             return false;
        }
   return true;
}
function CheckNum(theForm){
   for(var i=1; i<CheckNum.arguments.length; i++)
         if (!eCheckNum(theForm.elements[CheckNum.arguments[i]])){
            alert("Invalid number");
            theForm.elements[CheckNum.arguments[i]].focus();
            return false;
        }
   return true;
}

function CheckRequiredFields(theForm)
{
   for(i=1; i<CheckRequiredFields.arguments.length; i++)
        if(theForm.elements[CheckRequiredFields.arguments[i]].value==""){
            alert("This field is required");
            theForm.elements[CheckRequiredFields.arguments[i]].focus();
            return false;
        }
   return true;
}

function CheckForm(theForm){
     if(CheckRequiredFields(theForm,  0, 1, 2, 4, 5, 10, 11, 16, 17))
     if(CheckNum(theForm,  0, 1, 10, 12, 13))
     if(CheckAlphaNum(theForm,  2, 3, 4, 5, 6, 7, 8, 9))
     if(CheckAlpha(theForm,  11, 17))
     if(CheckEMail(theForm,  14))
     if(CheckDate(theForm,  16))
          return true;
  return false;
}
//-->