// START BLOCK
global $xoopsConfig;
$path = "../../themes";

$d = dir($path);
while ($entry = $d->read()) {
if ( is_dir($path ."/". $entry) && !preg_match("/[.]|[..]/", $entry) ) {
$theme_list[] = $entry;
}}

echo "
<div align='center'>
<form name='theme_select' method='post' action='./index.php'>
<select name='test_theme' onchange='submit()'>";

$curr_theme = getTheme();
natcasesort($theme_list);

foreach ($theme_list as $value) {
if ($value == $curr_theme) { $chk = " selected='selected'"; } else { unset($chk); }
echo "<option value='$value'$chk>$value</option>";
}

echo "
</select><br />

<script type='text/javascript'>
function switchTheme(value) {
document.theme_select.test_theme.options.selectedIndex = document.theme_select.test_theme.options.selectedIndex + value;
document.theme_select.submit();
}

document.write('(<b>' + document.theme_select.test_theme.options.length + '</b>)');
</script>

Themes<br /><br />

<input type='button' value='<--' onclick='switchTheme(-1);'>
<input type='button' value='-->' onclick='switchTheme(+1);'>
</form></div>";

// END BLOCK