function setFocus(aField) 
{
   document.forms[0][aField].focus();
}

function validate_form ( )

{
    valid = true;

    if ( document.contactinfo.HomeStore.value == "" )
    {
        alert ( "Please select the HomeStore you visit most often." );
        setFocus("HomeStore");
        valid = false;
        return valid;
    }

    if ( document.contactinfo.FirstName.value == "" )
    {
        alert ( "Please provide your 'First Name'." );
        setFocus("FirstName");
        valid = false;
        return valid;
    }

    if ( document.contactinfo.LastName.value == "" )
    {
        alert ( "Please provide your 'Last Name'." );
        setFocus("LastName");
        valid = false;
        return valid;
    }

    if ( document.contactinfo.Email.value == "" )
    {
        alert ( "Please provide your 'Email' address." );
        setFocus("Email");
        valid = false;
        return valid;        
    }

    if (document.getElementById("BirthdayMonth").selectedIndex < 1 || document.getElementById("BirthdayDay").selectedIndex < 1 || document.getElementById("BirthdayYear").selectedIndex < 1)
  	{
	    alert ( "Please provide your 'Birth Date'." );
        setFocus("BirthdayMonth");
        valid = false;
        return valid;    
  	}

    if ( !document.contactinfo.IAgree.checked )
    {
        alert ( "Please read our Privacy Agreement and check the \"I Agree to Receive All Mailings\" box to continue." );
        setFocus("IAgree");
        valid = false;
        return valid;        
    }

    return valid;
}

function updateHidden()
{
	document.getElementById("PhoneNumber").value = document.getElementById("PhoneAreaCode").value + "-" + document.getElementById("PhonePrefix").value + "-" + document.getElementById("PhoneSuffix").value ;
	document.getElementById("BirthDay").value = document.getElementById("BirthdayYear").options[document.getElementById("BirthdayYear").selectedIndex].text + "-" + document.getElementById("BirthdayMonth").options[document.getElementById("BirthdayMonth").selectedIndex].value + "-" + document.getElementById("BirthdayDay").options[document.getElementById("BirthdayDay").selectedIndex].value ;
}
