$(function () {
    $('[placeholder]').focus(function () {
        var input = $(this);
        if (input.val() == input.attr('placeholder')) {
            input.val('');
            input.removeClass('placeholder');
        }
    }).blur(function () {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('placeholder')) {
            input.addClass('placeholder');
            input.val(input.attr('placeholder'));
        }
    }).blur();


    // move fancybox to within <form> to enable popup forms
    $("form[id$='netForm']").append($("#fancybox-wrap").detach()).append($("#fancybox-overlay").detach());

    $("textarea[maxlength!='']").keyup(function () {
        var max = parseInt($(this).attr('maxlength'));
        if (parseInt($(this).val().length) > max) {
            alert("Limit for this input field reached (" + max + " characters).");
            $(this).val($(this).val().substr(0, parseInt($(this).attr('maxlength'))));
        }
    });
});

$(window).bind("load", function () {

    // Fade out content mask
    $('.js #mask').fadeOut(350);
});
