
// dump to js array
var forumtree = [
[
	236, '星座综合', [
		[12, '星座星运', 'index'],
		[406, '生肖属相', '0'],
	]
],
[
	170, '星座分版', [
		[81, '白羊座', 'index'],
		[82, '金牛座', 'index'],
		[83, '双子座', 'index'],
		[84, '巨蟹座', 'index'],
		[85, '狮子座', 'index'],
		[86, '处女座', 'index'],
		[87, '天秤座', 'index'],
		[88, '天蝎座', 'index'],
		[89, '射手座', 'index'],
		[90, '摩羯座', 'index'],
		[91, '水瓶座', 'index'],
		[92, '双鱼座', 'index'],
	]
],
[
	171, '站务', [
		[402, '星座站务', '0'],
	]
],
];

// function put here, for freq use
// maybe overload with new version
function putForumTree_Select(cates, curcid, curfid)
{
	var html = '';

	html += '<select onchange="this.blur();goForum(this.options[this.selectedIndex].value)">';

	html += '<option disabled="disabled">Jump to</option>';
	html += ForumTree_GetOptions(cates, curcid, curfid);
	html += '</select>';

	document.write(html);
}

function ForumTree_GetOptions(cates, curcid, curfid)
{
	var forum;

	var html = '';
	if (is.ie && is.v >= 6 || is.ns) {
		for (var i in cates) {
			var lastj = cates[i][2].length - 1; // forums
			if (lastj < 0) continue;

			html += '<optgroup' +
				(curcid == cates[i][0]? ' selected="selected"' : '') +
				' label="'+cates[i][1]+'">';

			for (var j in cates[i][2]) {
				forum = cates[i][2][j]
				html += '<option value="'+forum[0]+'"' +
					(curfid == forum[0]? ' selected="selected"' : '') +
					'>' + forum[1]+'</option>';
			}
			html += "</optgroup>";
		}
	}
	else {
		for (var i in cates) {
			var lastj = cates[i][2].length - 1; // forums

			html += '<option disabled=""' +
				(curcid == cates[i][0]? ' selected=""' : '') +
				'>&lt;&gt;'+cates[i][1]+'</option>';

			for (var j in cates[i][2]) {
				forum = cates[i][2][j]
				html += '<option value="'+forum[0]+'"' +
					(curfid == forum[0]? ' selected=""' : '') +
					'>' + (j==lastj? '╙ ' : '╟ ') +
					forum[1]+'</option>';
			}
		}
	}

	return (html);
}

function goForum(forumid)
{
	if (!forumid) return;
	window.location.href = phpurl('/oubb/' + forumid + '/');
}
