$(document).ready(function(){$("a.morelink").click(function(){$(this).prev().slideToggle("slow");toggle_text(this,"More...","Less...");return false});stripe_rows()});function toggle_text(B,C,A){$(B).text($(B).text()==C?A:C)}function stripe_rows(){$("tr").removeClass("alt");$("tr:odd").addClass("alt")}function hide_elems(){jQuery(".template :input[name]").each(function(){jQuery(this).attr("name","_"+jQuery(this).attr("name").substring(1))})}jQuery.fn.repeatable=function(A){A=jQuery.extend({add_cb:function(B){},del_cb:function(C,B){},first_deletable:false},A);return this.each(function(){var C=this;jQuery(".repeater *",this).addClass("tmp");var D=$(".template:not(.tmp)",C);D.children().hide();jQuery(".add_gap:not(.tmp)",C).html('<a href="#"><img src="/icons/add.png" alt="Add New" /></a>');jQuery(".add_gap:not(.tmp) a",C).click(function(){D.children().clone(true).insertAfter(jQuery(this).parents(".repeatable:first")).show();A.add_cb(C);hide_elems();return false});var B=A.first_deletable?".del_gap:not(.tmp)":".del_gap:not(.tmp):gt(0)";jQuery(B,C).html('<a href="#"><img src="/icons/delete.png" alt="Delete" /></a>');jQuery(".del_gap:not(.tmp) a",C).click(function(){A.del_cb(C,jQuery(this).parents(".repeatable:first").remove());hide_elems();return false});jQuery(".repeater *",this).removeClass("tmp")})};function submit_form(C,B,A){$(C).ajaxSubmit({dataType:"json",url:B,beforeSubmit:function(F,E,D){$(".submit-row",E).children().hide();$(".submit-row",E).append('<img src="/icons/throbber.gif" class="throbber" alt="throbber" />');$(".err_gap").hide()},success:function(D){$(".submit-row .throbber",C).remove();$(".submit-row",C).children().show();if(D.errors){$.each(D.error_fields,function(F,E){$(".form-row :input[name="+F+"]",C).parents(":eq(0)").siblings(".err_gap").html('<span class="error"><img src="/icons/error.png" alt="error" />'+E+"</span>").slideDown("slow")});first_err()}else{A(D)}}})}jQuery.fn.simpleForm=function(A){A=jQuery.extend({success_cb:function(B){window.location=B.redir_url},pre_submit:function(B){}},A);return this.each(function(){var B=this;$(this).submit(function(){A.pre_submit(B);submit_form(B,$(B).attr("action")+($(B).attr("action").indexOf("?")==-1?"?page_type=ajax":"&page_type=ajax"),A.success_cb);return false})})};function first_err(){$(".err_gap:visible:first + :input").focus()}$(document).ready(function(){$(".cond_hide:radio").click(function(A){var B=this.name.replace(".","_");$("."+B+":visible").hide();$("."+this.value+"."+B).show()});$(".cond_hide:radio:checked").click();first_err()})