﻿$(document).ready(function() {
    justproudFormInit("form");
    justproudFormSubmit("form");
});

function justproudFormInit(element) {
    $(element + " input[type=text],input[type=password], textarea").filter(function() { return $(this).val() == ""; }).toggleVal({
        populateFrom: "title"
    });
} 
function justproudFormSubmit(element) {
    $(element).submit(function() {
        $(this).find(".toggleval").each(function() {
            if ($(this).val() == $(this).data("defText")) {
                $(this).val("");
            }
        });
    });
}
function justproudAjaxLoadingImage(element) {
    $(element).submit(function() {
        $(this).find("button[type='submit'], input[type='image'], input[type='submit']").replaceWith("<div><img src=\"" + ajaxLoadingImage + "\" class=\"ajaxLoadingImage\"/></div>");
    });
}
function justproudFormAjaxSucess(element) {
    justproudErrorDiaglog(element);
    justproudFormInit(element);
    justproudFormNice(element);
}
function justproudFormAjaxSucessPreAjax(element) {
    justproudAjaxLoadingImage(element);
    justproudFormSubmit(element);
}
function justproudFormNice(element) {
   
}