﻿jQuery(function () {
    LoadSchoolsEvents();
});

// DigiPoint\Components\WFFM\School Lookup.ascx
function LoadSchoolsEvents() {
    jQuery('#<%= txtName.ClientID %>').change(LoadSchoolsDropDown);
    jQuery('#<%= ddlCountries.ClientID %>').change(LoadSchoolsDropDown);
    jQuery('#<%= txtZip.ClientID %>').change(LoadSchoolsDropDown);
}

function LoadSchoolsDropDown() {
    var name = jQuery('#<%= txtName.ClientID %>').val();
    var country = jQuery('#<%= ddlCountries.ClientID %>').val();
    var zip = jQuery('#<%= txtZip.ClientID %>').val();

    if (name != '' && country != '' && zip != '') {
        alert('post');
    }
}

// DigiPoint\Components\General\Print Button.ascx
function RegisterEventAndPrint() {
    // Register event
    $.ajax({
        type: "POST",
        url: "/Webservice/vanin.asmx/RegisterEvent",
        data: "{eventName: 'Print', eventData: '" + window.location.pathname + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            // Do something interesting here.
        },
        error: function (msg) {
            // Do something interesting here.
        }
    });

    // Print
    window.print();
}

function RegisterCTAEvent(type) {
    // Register event
    $.ajax({
        type: "POST",
        url: "/Webservice/vanin.asmx/RegisterEvent",
        data: "{eventName: 'CTA', eventData: '" + type + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            // Do something interesting here.
        },
        error: function (msg) {
            // Do something interesting here.
        }
    });
}
