SobiPro.jQuery(document).ready(function(){try{SobiPro.jQuery('.filter-edit').click(function(e){var b=false;var c=SobiProAdmUrl.replace('%task%','filter.edit')+'&tmpl=component';var d='';if(SobiPro.jQuery(this).attr('rel')){c+='&fid='+SobiPro.jQuery(this).attr('rel');d=SobiPro.jQuery(this).attr('rel')}SobiPro.jQuery("#filter-edit-window").css('width','600px').find('.modal-body').html('<iframe src="'+c+'" id="filter-edit-window-frame" style="width: 570px; height: 300px; border: none; overflow-y: hidden;"> </iframe>');SobiPro.jQuery('#filter-edit-window-frame').load(function(){if(SobiPro.jQuery('#filter-edit-window-frame').contents().find('#filter-regex').attr('readonly')==undefined){SobiPro.jQuery('#filter-delete').removeAttr('disabled');SobiPro.jQuery('#filter-delete').click(function(){var a=SobiProAdmUrl.replace('%task%','filter.delete')+'&filter_id='+d;document.location=a})}else{SobiPro.jQuery('#filter-delete').attr('disabled','disabled')}});if(d.length){if(SobiPro.jQuery("#filter-delete").attr('id')==undefined){SobiPro.jQuery("#filter-edit-window").find('.modal-footer').append('<div class="pull-left"><button type="button" class="btn btn-danger" disabled="disabled" id="filter-delete" data-dismiss="modal">'+SobiPro.Txt('DELETE_FILTER')+'</a></div>')}}else{SobiPro.jQuery("#filter-delete").parent().remove()}SobiPro.jQuery('#filter-edit-window').modal();SobiPro.jQuery('#filter-edit-window').on('hidden',function(){if(b){window.location.replace(new String(window.location).replace('#',''))}});SobiPro.jQuery("#filter-edit-window").find('.save').click(function(e){b=true;SobiPro.jQuery.ajax({url:'index.php',data:SobiPro.jQuery('#filter-edit-window-frame').contents().find('body #SPAdminForm').serialize(),type:'post',dataType:'json',success:function(a){iframe=SobiPro.jQuery('#filter-edit-window-frame').contents().find('body #SPAdminForm');alert='<div class="alert alert-'+a.message.type+'"><a class="close" data-dismiss="alert" href="#">×</a>'+a.message.text+'</div>';iframe.find('#spMessage').html(alert);if(a.data.required){stop=true;iframe.find('[name^="'+a.data.required+'"]').addClass('error').focus().focusout(function(){if(SobiPro.jQuery(this).val()){SobiPro.jQuery(this).removeClass('error').addClass('success')}})}}});e.stopPropagation()})})}catch(e){}});
