function readCookie(name) {
	var cookieValue = "";
	var search = name + "=";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = document.cookie.indexOf(";", offset);

			if (end == -1) {
				end = document.cookie.length;
			}

			cookieValue = unescape(document.cookie.substring(offset, end))
		}
	}
	return cookieValue;
}

// 写入cookie：
function writeCookie(name, value, hours) {
	var expire = "";
	if (hours != null) {
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString();
	}
	document.cookie = name + "=" + escape(value) + expire;
}

function setActivateMenu(menu_id) {
	writeCookie('menu_id', 'menu_' + menu_id);
}

function showActivateMenu() {

	var url = window.location;
	url = 'ur' + url;

	var str = 'index.php';
	var str1 = 'default.php';

	if (url.indexOf(str) != -1 || url.indexOf(str1) != -1) {
		writeCookie('menu_id', 'menu_m01');
	} else {
		if (url.indexOf('member.php') != -1) {
			writeCookie('menu_id', 'menu_m02');
		}
	}

	if ('' != readCookie('menu_id')) {
		try {
			var cur_id = readCookie('menu_id').substring(5, 8);
			var obj = document.getElementById(cur_id);
			obj.innerHTML = '<span style="color:#ffffff;">' + obj.innerHTML + '</span>';
			obj.className = 'activate';
		} catch (e) {
		}

	}

}

var memu = new Array();

var menu_items = {
	"my_union" : {
		"position" : [ '', '', '', '' ],
		"item" : [ [ "my_union", "推广概况", "my_union.php" ],
				[ "loweruser", "推广记录", "my_union.php?action=loweruser" ],
				[ "user_info", "个人资料", "user_info.php" ],
				[ "user_pay", "支付帐户", "user_pay.php" ],
				[ "change_money_log", "兑换记录", "change_money_log.php" ] ]
	},

	"my_code" : {
		"position" : [ '', '', '', '' ],
		"item" : [ [ "im", " QQ、MSN代码", "my_code.php?type=im" ],
				[ "bbs", " 论坛发帖代码", "my_code.php?type=bbs" ],
				[ "images", "图片广告", "my_code.php?type=images" ],
				[ "text", "文字广告", "my_code.php?type=text" ],
				[ "flash", "Flash广告", "my_code.php?type=flash" ] ]
	},

	"change_money" : {
		"position" : [ '', '', '', '' ],
		"item" : [ [ "change_money", "兑换人民币", "change_money.php" ],
				[ "change_gem", "兑换元宝", "change_gem.php" ],
				[ "check_idcard", "身份验证", "check_idcard.php" ],
				[ "gem_passwd", "二级密码", "gem_passwd.php" ] ]
	}
}

var item_name = 'my_union';
var item_html = '';
var hight_item = '';

function init_menu() {
}

function init() {
	showActivateMenu();
	try {
		do_init();
	} catch (e) {

	}
}
