Здравствуйте.
Есть шмоток кода, отвечающий за выборку стран, помогите реализовать выборку не по ротации, а рандомно.
Спасибо!
switchCountry: function () {
var countries, menu, context_menu;
switch (countryTool.prefManager.getCharPref("extensions.countrytool.country_type")) {
countryTool.clearAllCountriesStyles();
var menuitem_country = menu.childNodes[countryTool.currentRotateCountryIndex];
var context_menuitem_country = context_menu.childNodes[countryTool.currentRotateCountryIndex];
menuitem_country.setAttribute("checked", true);
context_menuitem_country.setAttribute("checked", true);
menuitem_country.setAttribute("style", "font-weight: bold");
context_menuitem_country.setAttribute("style", "font-weight: bold");
if (menuitem_country.hasChildNodes()) countryTool.selectedCountryFlag = menuitem_country.childNodes[0].getAttribute("src");
else countryTool.selectedCountryFlag = "";
var country_info = menuitem_country.getAttribute('value').split(",");
countryTool.countryChanged(country_info[0].split(":"));
countryTool.selectedCountryCity = (country_info[1] == "undefined") ? "" : country_info[1];
if (country_info[2] != "undefined") countryTool.selectedCountryCity += "," + country_info[2];
var labelText = menuitem_country.getAttribute('label');
var index = labelText.substring(0, labelText.indexOf("."));
var stringbundle = document.getElementById("countrytool-strings");
countryTool.showPopup("country", stringbundle.getString("currentcountryindex") + ": " + index);
countryTool.currentRotateCountryIndex++;
if (countryTool.currentRotateCountryIndex == countries.length || countries.length == 0) countryTool.currentRotateCountryIndex = 0
},