//  (c) 2002 Duley Hopkins & Associates, Inc. (http://www.dha-us.com)

//  ======================================================================

//  File: http://.../contactUs.js

//  Created: 05/15/2002 by L.F.Miller - DHA

//  Last updated: 01/13/2010 by Stacy Bradford - Blood Assurance

//  ======================================================================



  //===================================================================

  function initForm()

  {

    if (!NS4 && !NS6)				//this command does not work in NS4

    {

      document.contactForm.name.size = 35;

      document.contactForm.company.size = 35;

      document.contactForm.address.size = 35;

      document.contactForm.city.size = 35;

      document.contactForm.email.size = 35;



      document.contactForm.message.cols = 30;      

    }



    document.contactForm.name.value = '';

    document.contactForm.company.value = '';

    document.contactForm.address.value = '';

    document.contactForm.city.value = '';

    document.contactForm.zip.value = '';

    document.contactForm.home.value = '';

    document.contactForm.work.value = '';

    document.contactForm.email.value = '';

    document.contactForm.message.value = '';

    document.contactForm.state.selectedIndex = 0;

    document.contactForm.name.focus();



  }



  //===================================================================

  function checkForm()

  {

    OK = true;



    if (document.contactForm.name.value.length < 1)

    {

        alert('Your Name is required');

        document.contactForm.name.focus();

        OK = false;

    }

    else if (document.contactForm.email.value.length < 1)

    {

        alert('E-Mail Address is required');

        document.contactForm.email.focus();

        OK = false;

    }

    else if (document.contactForm.message.value.length < 1)

    {

        alert('Comment is required');

        document.contactForm.message.focus();

        OK = false;

    }

    else

    {

        var locateAt     = document.contactForm.email.value.indexOf("@");

        var locatePeriod = document.contactForm.email.value.indexOf(".");

        if ((locateAt < 0) ||                                                       //contains an "@"

            (locateAt == 0) ||                                                      //"@" not 1st character

            (locateAt == (document.contactForm.email.value.length - 1)) ||          //"@" not last character

            (document.contactForm.email.value.indexOf("@", locateAt + 1) > 0) ||    //contains only one "@"

            (locatePeriod < 0) ||                                                   //contains a "."
			
			(locatePeriod < locateAt) ||

            (locatePeriod == (document.contactForm.email.value.length - 1)) ||      //"." not last character

            
        {

            alert('E-Mail Address is invalid');

            document.contactForm.email.focus();

            OK = false;

        }

    }



    return OK;

  }

