function checkIndexType(){$select_index_type=$("#select_index_type");$size_header=$("#index_columns thead tr th:nth-child(2)");$column_inputs=$('select[name="index[columns][names][]"]');$size_inputs=$('input[name="index[columns][sub_parts][]"]');$add_more=$("#index_frm .tblFooters");if($select_index_type.val()=="SPATIAL"){$size_header.hide();$size_inputs.each(function(){$(this).prop("disabled",true).parent("td").hide()});var a=true;$column_inputs.each(function(){$column_input=$(this);if(!a){$column_input.prop("disabled",true).parent("td").hide()}else{a=false}});$add_more.hide()}else{$size_header.show();$size_inputs.each(function(){$(this).prop("disabled",false).parent("td").show()});$column_inputs.each(function(){$(this).prop("disabled",false).parent("td").show()});$add_more.show()}}AJAX.registerTeardown("indexes.js",function(){$("#select_index_type").die("change");$("a.drop_primary_key_index_anchor.ajax").die("click");$("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").die("click");$("#index_frm input[type=submit]").die("click")});AJAX.registerOnload("indexes.js",function(){checkIndexType();checkIndexName("index_frm");$("#select_index_type").live("change",function(a){a.preventDefault();checkIndexType();checkIndexName("index_frm")});$("a.drop_primary_key_index_anchor.ajax").live("click",function(f){f.preventDefault();var e=$(this);var c=e.parents("tr");var g=e.parents("td").attr("rowspan")||1;var h=c;for(var d=1,a=c.next();d<g;d++,a=a.next()){h=h.add(a)}var b=escapeHtml(c.children("td").children(".drop_primary_key_index_msg").val());e.PMA_confirm(b,e.attr("href"),function(j){var i=PMA_ajaxShowMessage(PMA_messages.strDroppingPrimaryKeyIndex,false);$.get(j,{is_js_confirmed:1,ajax_request:true},function(l){if(l.success==true){PMA_ajaxRemoveMessage(i);var k=h.closest("table");if(h.length==k.find("tbody > tr").length){k.hide("medium",function(){$("div.no_indexes_defined").show("medium");h.remove()});k.siblings("div.notice").hide("medium")}else{toggleRowColors(h.last().next());h.hide("medium",function(){$(this).remove()})}if($("#result_query").length){$("#result_query").remove()}if(l.sql_query){$('<div id="result_query"></div>').html(l.sql_query).prependTo("#page_content")}PMA_commonActions.refreshMain(false,function(){$("a.ajax[href^=#indexes]").click()});PMA_reloadNavigation()}else{PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest+" : "+l.error,false)}})})});$("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").live("click",function(c){c.preventDefault();if($(this).find("a").length==0){var b=checkFormElementInRange($(this).closest("form")[0],"added_fields","Column count has to be larger than zero.");if(!b){return}var a=$(this).closest("form").serialize();var d=PMA_messages.strAddIndex}else{var a=$(this).find("a").attr("href");if(a.substring(0,16)=="tbl_indexes.php?"){a=a.substring(16,a.length)}var d=PMA_messages.strEditIndex}a+="&ajax_request=true";indexEditorDialog(a,d,function(){PMA_commonActions.refreshMain(false,function(){$("a.ajax[href^=#indexes]").click()})})})});