Index: branches/5.1.x/admin_templates/links/links_edit.tpl
===================================================================
diff -u -r13095 -r13459
--- branches/5.1.x/admin_templates/links/links_edit.tpl	(.../links_edit.tpl)	(revision 13095)
+++ branches/5.1.x/admin_templates/links/links_edit.tpl	(.../links_edit.tpl)	(revision 13459)
@@ -116,13 +116,13 @@
 <input type="hidden" name="Hits_original" id="Hits_original" value="<inp2:l_Field name='Hits' db='db' />" />
 
 <script type="text/javascript">
-	function reflect_filename()
-    {
+	$(document).ready(reflect_filename);
+	disable_categories('<inp2:l_InputName name="CategoryId"/>', <inp2:l_AllowedCategoriesJSON/>);
+
+	function reflect_filename() {
     	var $checked = document.getElementById('_cb_<inp2:l_InputName field="AutomaticFilename"/>').checked;
     	document.getElementById('<inp2:l_InputName field="Filename"/>').readOnly = $checked;
     }
-
-    Application.setHook('m:OnAfterWindowLoad', reflect_filename);
 </script>
 
 <inp2:m_include t="incs/footer"/>
\ No newline at end of file