function NSSearch()
{
var prefixList = document.createElement("select");
prefixList.id = "searchNSSelect";
prefixList.innerHTML = "<option >Article:</option>\n <option>Article talk:</option>\n <option>Wikipedia:</option>\n <option>Wikipedia talk:</option>\n <option>User:</option>\n <option>User talk:</option>\n<option>WikiProject:</option>\n <option>WikiProject talk:</option>\n<option>Category:</option>\n <option>Category talk:</option>\n<option>Template:</option>\n <option>Template talk:</option>\n <option>Book:</option>\n <option>Book talk:</option>\n <option>Help:</option>\n <option>Special:</option>";
var hiddenInput = document.createElement("input");
hiddenInput.type = "hidden";
hiddenInput.name = "search";
hiddenInput.id = "hiddenNSInput";
var searchInput = $("#searchInput");
searchInput.before(hiddenInput);
searchInput.before(prefixList);
searchInput.removeAttr("name");
prefixList.tabIndex = searchInput.tabIndex;
$("#searchform").submit(function()
{
var prefixValue = $("#searchNSSelect").prop("value");
switch(prefixValue)
{
case "Article:":
$("#hiddenNSInput").prop("value", $("#searchInput").prop("value"));
break;
case "Article talk:":
$("#hiddenNSInput").prop("value", "Talk:" + $("#searchInput").prop("value"));
break;
case "WikiProject:":
$("#hiddenNSInput").prop("value", "Wikipedia:WikiProject " + $("#searchInput").prop("value"));
break;
case "WikiProject talk:":
$("#hiddenNSInput").prop("value", "Wikipedia talk:WikiProject " + $("#searchInput").prop("value"));
break;
default:
$("#hiddenNSInput").prop("value", prefixValue + $("#searchInput").prop("value"));
break;
}
});
}
$(document).ready(NSSearch);