﻿    // copyright 1999 Idocs, Inc. http://www.idocs.com
    // Distribute this script freely but keep this notice in place
    function numbersonly(myfield, e, dec)
    {
    var key;
    var keychar;

    if (window.event)
       key = window.event.keyCode;
    else if (e)
       key = e.which;
    else
       return true;
    keychar = String.fromCharCode(key);

    // control keys
    if ((key==null) || (key==0) || (key==8) || 
        (key==9) || (key==13) || (key==27) )
       return true;

    // numbers
    else if ((("0123456789").indexOf(keychar) > -1))
       return true;

    // decimal point jump
    else if (dec && (keychar == "."))
       {
       myfield.form.elements[dec].focus();
       return false;
       }
    else
       return false;
    }



    var downStrokeField;
    function autojump(fieldName,nextFieldName,fakeMaxLength)
    {
    var myForm=document.forms[document.forms.length - 1];
    var myField=myForm.elements[fieldName];
    myField.nextField=myForm.elements[nextFieldName];

    if (myField.maxLength == null)
       myField.maxLength=fakeMaxLength;

    myField.onkeydown=autojump_keyDown;
    myField.onkeyup=autojump_keyUp;
    }

    function autojump_keyDown()
    {
    this.beforeLength=this.value.length;
    downStrokeField=this;
    }

    function autojump_keyUp()
    {
    if (
       (this == downStrokeField) && 
       (this.value.length > this.beforeLength) && 
       (this.value.length >= this.maxLength)
       )
       this.nextField.focus();
    downStrokeField=null;
    }


function validateForm()
{
    var x=document.forms["taxOrganizerForm"]["EmailTB"].value
    var atpos=x.indexOf("@");
    var dotpos=x.lastIndexOf(".");
      
    var x=document.forms["taxOrganizerForm"]["FNameTB"].value
    if (x==null || x=="")
      {
      alert("Please enter your First Name");
      return false;
      }


    var x=document.forms["taxOrganizerForm"]["LNameTB"].value
    if (x==null || x=="")
      {
      alert("Please enter your Last Name.");
      return false;
      }

    var x=document.forms["taxOrganizerForm"]["TeleTB1"].value
    var x=document.forms["taxOrganizerForm"]["TeleTB2"].value
    var x=document.forms["taxOrganizerForm"]["TeleTB3"].value
    if (x==null || x=="")
      {
      alert("Please enter your Telephone Number.");
      return false;
      }
    
      
    else
        {
        window.close();
        }
  }


function validateContactForm()
{
    var x=document.forms["contactForm"]["FNameTB"].value
    if (x==null || x=="")
      {
      alert("Please enter your First Name");
      return false;
      }


    var x=document.forms["contactForm"]["LNameTB"].value
    if (x==null || x=="")
      {
      alert("Please enter your Last Name.");
      return false;
      }

    var x=document.forms["contactForm"]["SubjectTB"].value
    if (x==null || x=="")
      {
      alert("Please fill out the Subject area and let us know how we can help you.");
      return false;
      }
}

function validateTestimonialForm()
{
    var x=document.forms["testimonialForm"]["NameTB"].value
    if (x==null || x=="")
      {
      alert("Please enter your Name");
      return false;
      }

    var x=document.forms["testimonialForm"]["TestimonialTB"].value
    if (x==null || x=="")
      {
      alert("Please let us know how we are doing by filling out your Testimonial.");
      return false;
      }
}
