// JavaScript Document

function go_Page(pageName){
	window.location.href="/community/" + pageName + ".html"
}

var currIndex = -1; // global sub page tracker (-1 is index page, no numerals)
var myURL = location.href;
var mySection = 'fansite';
var regexp = /_\d+/;

function setDropDown(url) {
	
	// if there is an underscore and a number
	if (url.search(regexp) != -1) {
		var splitURL = url.split(mySection + "_");
		//alert(splitURL[0] + ' , ' + splitURL[1]);
		var splitURL2 = splitURL[1].split(".");
		//alert (splitURL2[0]);
		
		// look through list of options, if value of pulldown equals index from the URL, set that as selected
		for (var i = 0; i < myLen; i++) {
			if (document.subnav.pullDown.options[i].value == splitURL2[0]) {
				var setIndex = i;
			}
		}	
	
		document.subnav.pullDown.selectedIndex = setIndex;
		
		// update the global sub page tracker
		currIndex = eval(splitURL2[0]);
	} else {
		
		// this is the index page
		document.subnav.pullDown.selectedIndex = 0;
		
	}
}

tmpStr = '';
	
tmpStr += '<form name="subnav" style="display: inline">';
tmpStr += '<select name="pullDown" onChange="if (this.options[selectedIndex].value) window.location=\'\' + mySection + \'_\' + this.options[selectedIndex].value + \'.html\'" class="input02">';
tmpStr += '<option value="1">General</option>'; 
tmpStr += '<option value="2">Clans</option>'; 
tmpStr += '<option value="3">Forums</option>';
tmpStr += '</select>'; 
tmpStr += '</form>'; 	

document.write(tmpStr);

var myLen = document.subnav.pullDown.length;
var lastItem = document.subnav.pullDown.options[myLen-1].value;

setDropDown (myURL);