jQuery(document).ready(function(a){a("#upload_image_button").click(function(){formfield=a("#upload_image").attr("name");tb_show("","media-upload.php?type=image&infinite_scroll=true&TB_iframe=true");return!1});window.send_to_editor=function(b){a("#upload_image").val(b);tb_remove()};a("#the-list td").hover(function(){a(this).children(".edit-link").css("visibility","visible")},function(){a(this).children(".edit-link").css("visibility","hidden")});a('#the-list tr:not(".editing")').live("click",function(b){b.preventDefault();
a(this).addClass("editing");a(this).find(".edit-link").hide();a(this).find(".save-link").show();a(this).css("height","50px");a(this).children("td:not(:first)").each(function(){a(this).html('<input type="text" name="'+a(this).attr("class")+'" value="'+a(this).html()+'" />')});b=a(this).children(".theme");a(b).html(a(b).html()+'<input type="hidden" name="theme_column-theme" value="'+a(b).find(".theme-name").text()+'" />');return!1});a("#the-list .save-link a").live("click",function(b){b.preventDefault();
var c=a(this).siblings(".loader");a(c).show();a.ajax({url:ajaxurl+"?action=infinite-scroll-edit-preset",type:"POST",data:a("#ajax-form").serialize(),success:function(){a(c).hide();tr=a(c).parent().parent().parent();a(tr).removeClass("editing");a(tr).find(".edit-link").show();a(tr).find(".save-link").hide();a(tr).css("height","auto");a(tr).children("td:not(:first)").each(function(){a(this).html(a(this).children("input").val())})}});return!1});a("#the-list .save-link a.cancel").live("click",function(b){b.preventDefault();
tr=a(this).parent().parent().parent();a(tr).removeClass("editing");a(tr).find(".edit-link").show();a(tr).find(".save-link").hide();a(tr).css("height","auto");a(tr).children("td:not(:first)").each(function(){a(this).html(a(this).children("input").val())});return!1});a(".delete").live("click",function(b){b.preventDefault();b=a(this).parent().siblings("strong").children("a").text();if(!confirm(infinite_scroll.confirm.replace("%s",b)))return!1;var c=a(this).parent().parent().parent();a.ajax({url:ajaxurl+
"?action=infinite-scroll-delete-preset&theme="+b,type:"POST",data:a("#ajax-form").serialize(),success:function(){a(c).children("td:not(:first)").each(function(){a(this).html("")})}});return!1});a("#use_default").click(function(b){b.preventDefault();a("#infinite_scroll_form").append('<input type="hidden" name="reset_default_image" value="1" />').submit();return!1})});