﻿$(function() {
    init();
});

function init() {
    richText();
    stripeTables();
    setFormFocus();
}

function richText() {
    $('textarea').addClass("ckeditor");
}

function stripeTables() {
    $("table tr:even").addClass("alt");
}

function setFormFocus() {
    $("label .value input, label .value textarea").focus(function() {
        var label = $(this).parent().parent();
        label.addClass("focus");
        var title = label.attr("title");
        if (title != "" && (label.children(".error").length == 0 || !label.children(".error").is(":visible"))) {
            var helper = $("<span class=\"helper\">" + label.attr("title") + "</span>");
            label.children(".value").after(helper);
        }
    });
    $("label .value input, label .value textarea").blur(function() {
        var label = $(this).parent().parent();
        label.removeClass("focus");
        label.children(".helper").remove();
    });
}