function TemplateFieldAddDialog(){var $a=$(this);var fieldReady=false;var $iframe=pwModalWindow($a.attr("href"),{},"large");$iframe.on("load",function(){var $button;var buttons=[];var $icontents=$iframe.contents();var n=0;$icontents.find("#breadcrumbs ul.nav, #Inputfield_submit_save_field_copy").hide();$icontents.find("#content form button.ui-button[type=submit]").each(function(){var text=$(this).text();var skip=false;$button=$(this);for(var i=0;i").val(newFieldId).text($icontents.find("#Inputfield_name").val()));$('#fieldgroup_fields option[value="'+newFieldId+'"]').attr("id","asm0option"+numOptions).attr("data-desc",$icontents.find("#field_label").val()).attr("data-status",$icontents.find("#Inputfield_type option:selected").text());$("#asmSelect0 option").eq(1).before($("").val(newFieldId).text($icontents.find("#Inputfield_name").val()));$("#asmSelect0").find("option:selected").prop("selected",false);$('#asmSelect0 option[value="'+newFieldId+'"]').attr("rel","asm0option"+numOptions).attr("selected","selected").addClass("asmOptionDisabled").prop("disabled","disabled");var name=$icontents.find("#Inputfield_name").val();var type=$icontents.find("#Inputfield_type option:selected").val();if(type==="FieldtypeFieldsetOpen"||type==="FieldtypeFieldsetTabOpen"){name=name+"_END";var numOptions1=numOptions+1;var newFieldId1=parseInt(newFieldId)+1+"";$options.eq(1).before($("").val(newFieldId1).text(name));var dataStatus="";var dataDesc="";$('#fieldgroup_fields option[value="'+newFieldId1+'"]').attr("id","asm0option"+numOptions1).attr("data-desc",dataDesc).attr("data-status",dataStatus);$("#asmSelect0 option").eq(1).after($("").val(newFieldId1).text(name));$('#asmSelect0 option[value="'+newFieldId1+'"]').attr("rel","asm0option"+numOptions1).addClass("asmOptionDisabled").prop("disabled",true);$("#fieldgroup_fields").trigger("rebuild")}$('#asmSelect0 option[value="'+newFieldId+'"]').trigger("change").prop("selected",false)}});return false}$(document).ready(function(){$("#wrap_fieldgroup_fields p.description a").on("click",TemplateFieldAddDialog)});