﻿
//PAGE SPECIFIC for ~/contactus.aspx

$(document).ready(function()
    {
        //setup events
        $(aContinue).click(function(){aContinue_OnClick();return false;});
    }
);

function Validates()
{
    ErrorClear(txtEmailAddress);

    if (txtEmailAddress.value.length == 0)
    {
        ErrorSet(txtEmailAddress, "Please enter an email address so we can respond.");
        return false;
    }
    else
    {
        if (!IsValidTextEmailAddress(txtEmailAddress.value))
        {
            ErrorSet(txtEmailAddress, "This email address is not valid.");
            return false;
        }
    }

    return true;
}
function ErrorClear(el)
{
    var par = $(el).parent()

    par.attr("class", "Control");
    par.children("span.Message").html("");
}
function ErrorSet(el, Message)
{
    var par = $(el).parent()

    par.attr("class", "Control Errored");
    par.children("span.Message").html(Message);
    el.focus();
}
function aContinue_OnClick()
{
    if (Validates())
    {
        $(aContinue).children("span.Mid").html("Please wait...");
        $(aContinue).removeAttr("href");
        $(aContinue).unbind();

        lnkContinue_Click();
    }
}
