<?php
if(!defined('AUTHACCESS')){echo "Not Allowed";exit();}
$toptions = "";
global $default_template;
?>

		<select id=themeselector onchange="themechange()">
		<option value="<?php echo $default_template;?>">Theme</option>
		
		<?php foreach($allowed_themes as $thmx){
			
				if($thmx == $clean_req['themestyle']){
					$toptions .= "		<option value=\"$thmx\" selected>$thmx</option>\n";
				}else{
					$toptions .= "		<option value=\"$thmx\">$thmx</option>\n";
				}
		}
		
			echo $toptions;
		?>
		
		</select>
		<script>
			function themechange() {
				theme = document.getElementById('themeselector').value;
				str = window.location.href;
				tx=str.indexOf('theme');
				if(tx < 0){
					urlx=str;
				}else{
					urlx=str.substr(0,tx);
				}
				if (urlx.substr(urlx.length-1, urlx.length) != "/") {
					urlx=urlx+"/";
				}
				if(theme == 0){
				    window.location = urlx;
				}else {
    				window.location = urlx + "theme/"  + theme;
    			}
    		}
    	</script>
