﻿///<reference path="jquery-1.2.3.min.js" />

function performServiceCall(firstName, lastName) {
    $.ajax({
        type: "POST",
        url: "MailService.asmx/GetSampleString",
        data: "{'firstName':'" + firstName + "', 'lastName':'" + lastName + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            window.alert(msg);
        }
    });
}

function sendEmail(firstName, lastName, company, title, email, phone, country, state, industry, comments) {
    $.ajax({
        type: "POST",
        url: "MailService.asmx/SendMail",
        data: "{'firstName':'" + firstName +
              "', 'lastName':'" + lastName +
              "', 'company':'" + company +
              "', 'title':'" + title +
              "', 'email':'" + email +
              "', 'phone':'" + phone +
              "', 'country':'" + country +
              "', 'state':'" + state +
              "', 'industry':'" + industry +
              "', 'comments':'" + comments +
              "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json"
    });
}

onload = function() {
    var elements = document.getElementsByName("submit");
    var submitButton = elements.item(0);
    submitButton.onclick = function() { if (validation(document.forms.item(0)) == false) return false; else sendEmail(document.forms.item(0).first_name.value, document.forms.item(0).last_name.value, document.forms.item(0).company.value, document.forms.item(0).title.value, document.forms.item(0).email.value, document.forms.item(0).phone.value, document.forms.item(0).country.value, document.forms.item(0).state.value, document.forms.item(0).industry.value, document.getElementById('00N60000001WMYJ').value); };
};
