﻿$(document).ready(function() {
    $(".radio").click(function() {
        if ($(this).val() === "Other") {
            $('.' + $(this).attr('name') + 'Other').show()
        }
        else {
            $('.' + $(this).attr('name') + 'Other').hide()
        }
    });

    $(".erase_default").each(function() {
        $(this).attr('default', $(this).val());

    });
    $(".erase_default").focus(function() {
        if ($(this).attr('default') === $(this).val()) {
            $(this).val('');
        }
    });

    $(".erase_default").blur(function() {
        if ($(this).val() === '') {
            $(this).val($(this).attr('default'));
        }

    });


    $(".check").click(function() {
        if ($(this).attr('other')) {
            if ($(this).attr('checked')) {
                $($(this).attr('other')).show()
            }
            else {
                $($(this).attr('other')).hide()
            }
        }
    });

    $(".numberInput").keypress(function(e) {
        if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
            $('.' + $(this).attr('name') + 'ErrMsg').html("Digits Only").show().fadeOut("slow");
            return false;
        }
    });


    $('.moreInfoLink').click(function() {
        var sch_id = $(this).attr('sch_id');

        var html = $(this).html();
        $(this).html($(this).attr('toggle'));
        $(this).attr('toggle', html);

        $('.moreInfo' + sch_id).toggle();

        return false;
    });


    $('.searchLink').click(function() {

        $("expand").toggle();

        return false;
    });

});

