    $(document).ready(function()
    {
        $("#vai").click(function()
        {
            $('#loading').show();
            $('#loading').html("Please wait.." + "<img src='http://llg.sequentia.net/images/ajax.gif'/>");
            if (document.form1.email.value == "")
            {
                $('#loading').html("");
                alert('Please provide your email address.');
                return false;
            }
            if (document.form1.email.value.indexOf("'") > -1)
            {
                $('#loading').html("");
                alert('Invalid email!');
                return false;
            }
            if (document.form1.email.value.indexOf('"') > -1)
            {
                $('#loading').html("");
                alert('Invalid email!');
                return false;
            }

            var uri = "http://" + _llat.scriptHost + "/lla.aspx?i=" + Base64.encode("Tab") + "&m=" + Base64.encode("get") + "&c=" + Base64.encode("EmailCallBack") + "&f=" + Base64.encode("") + "&l=" + Base64.encode("") + "&e=" + Base64.encode(document.form1.email.value);
            //alert("before ajax " + uri);
            $.ajax({
                type: "GET",
                cache: false,
                async: false,
                url: uri,
                dataType: "script",
                error: function(xhr, error, exception)
                {
                    //alert("ajax fail: " + xhr.status);
                    $('#loading').html("");
                    alert("Contact information not found.");
                    document.getElementById("radio2").click();
                },
                success: function(data, textStatus)
                {
                    //alert("ajax success: " + textStatus);
                    $('#loading').html("");

                },
                complete: function(xhr, textStatus)
                {
                    //alert("ajax complete: " + textStatus);
                }
            });
            //alert("after ajax");
            return (false);
        });
    });

    function EmailCallBack(result)
    {
        $('#loading').html("");
        try
        {
            var lead = Base64.decode(result);
            lead = JSON2.parse(lead);
            lead = lead.d;
            if ((lead != null) &&
                (lead.email != null) && (lead.email.length > 0) &&
                (lead.source != null) && (lead.source.length > 0) &&
                (lead.first_name != null) && (lead.first_name.length > 0) &&
                (lead.last_name != null) && (lead.last_name.length > 0) &&
                (lead.phone_main != null) && (lead.phone_main.length > 0) &&
                (lead.bus_name != null) && (lead.bus_name.length > 0) &&
                (lead.zip != null) && (lead.zip.length > 0))
            {
                if (document.getElementById('ppccode') != null)
                {
                     urchinTracker(document.getElementById('ppccode').value);
                }
                $leadlife('#form1').submit();
                document.location = ((document.testOnlineFormName.ReturnPage != null) && (document.testOnlineFormName.ReturnPage.value != "")) ? document.testOnlineFormName.ReturnPage.value : ((document.testOnlineFormName.action != null) && (document.testOnlineFormName.action != "")) ? document.testOnlineFormName.action : "http://llg.sequentia.net/thankspages/thanks.html";
                return (true);
            }
        }
        catch (e)
        {
        }
        alert("Contact information not found.");
        document.getElementById("radio2").click();
        return (false);
    }

    function showDiv(flag)
    {
        if (flag == 1)
        {
            document.getElementById('bigForm').style.display = "none";
            document.getElementById('smallForm').style.display = "";
        }
        else
        {
            document.getElementById('smallForm').style.display = "none";
            document.getElementById('bigForm').style.display = "";
        }
    }

    function change_W_I()
    {
        try
        {
            var objcountry = document.testOnlineFormName.PIID_23775_0;
            var country = objcountry.options[objcountry.selectedIndex].text;
            if (country == "Canada")
            {
                document.testOnlineFormName.W.value = "43" ;
                document.testOnlineFormName.I.value = "1" ;
            }
            else
            {
                document.testOnlineFormName.W.value = "42" ;
                document.testOnlineFormName.I.value = "1" ;
            }
        }
        catch (e)
        {
        }
    }

