﻿// Need to update and test
function fixedScroll()
{
    $(document).ready(function () {
        var top = $("#register").offset().top - parseFloat($("#register").css('marginTop').replace(/auto/, 0));
        $(window).scroll(function (event) {
            // what the y position of the scroll is
            var y = $(this).scrollTop();

            // whether that's below the form
            if (y >= top) {
                // if so, ad the fixed class
                $("#register").addClass('fixed');
            } else {
                // otherwise remove it
                $("#register").removeClass('fixed');
            }
        });
    });
}

function success() {
    $("p.success").animate({ opacity: 1.0 }, 2000).animate({ opacity: 0.0 }, 1500).slideUp();
}


function ValidateAndSubmit(evt) {
    var $group = $(this).parents('.validationGroup');
    var isValid = true;
    $group.find(':input').each(function (i, item) {
        if (!$(item).valid())
            isValid = false;
    });
    if (!isValid)
        evt.preventDefault();
}

function notWatermark(value, element) {
    return value != 'School Name';
}

function notNameWatermark(value, element) {
    return value != 'Your Name';
}
function notEmailWatermark(value, element) {
    return value != 'Email Address';
}
function notPhoneWatermark(value, element) {
    return value != 'Phone Number';
}
function notStartWatermark(value, element) {
    return value != 'Dates Traveled - Start Date';
}
function notEndWatermark(value, element) {
    return value != 'Dates Traveled - End Date';
}

