/** Feedback Form Code */
$(function() 
{ 
    //Show the forms
    $("form.comment-form, form.email-form").show().upgradeForm();
    
    $("form.comment-form, form.email-form").bind("send", function() {
        $(":input", this).attr("disabled", "disabled");
        $("button", this).addClass("working");
    });
    $("form.comment-form, form.email-form").bind("success", function() {
        $(":input", this).removeAttr("disabled");
        $("button", this).removeClass("working");
    });
    $("form.comment-form, form.email-form").bind("serverError", function() {
        $("button", this).removeClass("working");
        $("button", this).addClass("error");
        alert("error");
    });
    $("form.comment-form, form.email-form").bind("timeoutError", function() {
        $("button", this).removeClass("working");
        $("button", this).addClass("error");
    });
    
    //Enable Google Analytics Tracking of Form Actions and Subscriptions
    $("form.email-form").bind("success", function() {
        urchinTracker("/urchin/email");
    });
    $("form.comment-form").bind("success", function() {
        urchinTracker("/urchin/comment");
    });
    $("#subscribe-link").bind("click", function() {
	urchinTracker("/urchin/subscribe");
    });

    //Enable special form header click actions
    $("form.comment-form h3, form.email-form h3").toggle(
        function() { $(".form-fields", this.parentNode).slideDown("fast"); },
        function() { $(".form-fields", this.parentNode).slideUp("fast"); }
    ).css({cursor:"pointer"});
});