(function(){"use strict";window.processModalParent=function(fieldPrefix,id,title,catid,url,language,object){var fieldId=document.getElementById(fieldPrefix+"_id"),fieldTitle=document.getElementById(fieldPrefix+"_name");id=id||"";title=title||"";catid=catid||"";object=object||"";url=url||"";language=language||"";if(id){fieldId.value=id;fieldTitle.value=title;if(document.getElementById(fieldPrefix+"_select")){jQuery("#"+fieldPrefix+"_select").addClass("hidden")}if(document.getElementById(fieldPrefix+"_new")){jQuery("#"+fieldPrefix+"_new").addClass("hidden")}if(document.getElementById(fieldPrefix+"_edit")){jQuery("#"+fieldPrefix+"_edit").removeClass("hidden")}if(document.getElementById(fieldPrefix+"_clear")){jQuery("#"+fieldPrefix+"_clear").removeClass("hidden")}}else{fieldId.value="";fieldTitle.value=fieldId.getAttribute("data-text");if(document.getElementById(fieldPrefix+"_select")){jQuery("#"+fieldPrefix+"_select").removeClass("hidden")}if(document.getElementById(fieldPrefix+"_new")){jQuery("#"+fieldPrefix+"_new").removeClass("hidden")}if(document.getElementById(fieldPrefix+"_edit")){jQuery("#"+fieldPrefix+"_edit").addClass("hidden")}if(document.getElementById(fieldPrefix+"_clear")){jQuery("#"+fieldPrefix+"_clear").addClass("hidden")}}if(fieldId.getAttribute("data-required")=="1"){document.formvalidator.validate(fieldId);document.formvalidator.validate(fieldTitle)}return false};window.processModalEdit=function(element,fieldPrefix,action,itemType,task,formId,idFieldId,titleFieldId){formId=formId||itemType.toLowerCase()+"-form";idFieldId=idFieldId||"jform_id";titleFieldId=titleFieldId||"jform_title";var modalId=element.parentNode.parentNode.id,submittedTask=task;jQuery("#"+modalId+" iframe").get(0).id="Frame_"+modalId;var iframeDocument=jQuery("#Frame_"+modalId).contents().get(0);if(task==="cancel"){document.getElementById("Frame_"+modalId).contentWindow.Joomla.submitbutton(itemType.toLowerCase()+"."+task);jQuery("#"+modalId).modal("hide")}else{jQuery("#Frame_"+modalId).on("load",function(){iframeDocument=jQuery(this).contents().get(0);if(iframeDocument.getElementById(idFieldId)&&iframeDocument.getElementById(idFieldId).value!="0"){window.processModalParent(fieldPrefix,iframeDocument.getElementById(idFieldId).value,iframeDocument.getElementById(titleFieldId).value);if(task==="save"){window.processModalEdit(element,fieldPrefix,"edit",itemType,"cancel",formId,idFieldId,titleFieldId)}}jQuery("#"+modalId+" iframe").removeClass("hidden")});if(iframeDocument.formvalidator.isValid(iframeDocument.getElementById(formId))){if(task==="save"){submittedTask="apply"}document.getElementById("Frame_"+modalId).contentWindow.Joomla.submitbutton(itemType.toLowerCase()+"."+submittedTask)}}return false};window.processModalSelect=function(itemType,fieldPrefix,id,title,catid,object,url,language){window.processModalParent(fieldPrefix,id,title,catid,url,language,object);jQuery("#ModalSelect"+itemType+"_"+fieldPrefix).modal("hide");return false}})();