var my_index_js_posted = false;
var frameId = "#contentDIV";

/**
 * init
 * 
 * @param {string}
 *            navigation
 */
function init(navigation) {
	changeNavigation(navigation);
}


/**
 * 导航条控制
 * 
 * @param {string}
 *            navinfo
 */
function changeNavigation(navinfo) {
	if (navinfo == null || navinfo == "") {
		return;
	}
	var topNav = navinfo.substring(0,navinfo.indexOf("x"));// like:1x0x0
	
	var navObj = document.getElementById('navTD' + topNav);
	
	if (navObj == null) {
		return;
	}
	onNavBarClick(navObj);
}

/**
 * 个人管理中心：站内消息
 */
function mi_onMyMessageClick() {
	var siteId = pp_getObj('id').value;
	document.location.href=myMessageAction +"/"+siteId + ".html";
}
/**
 * 个人管理中心：我的形象
 */
function mi_onMyAppearanceClick() {
	var siteId = pp_getObj('id').value;
	document.location.href=myAppearance+"/"+siteId + ".html";
}

/**
 * 个人管理中心：我的帮会
 */
function mi_onMyBangClick() {
	var siteId = pp_getObj('id').value;
	document.location.href=myBang
}

/**
 * 个人管理中心：我的社区
 */
function mi_onMyBBSClick() {
	var siteId = pp_getObj('id').value;
	document.location.href=myBBS+"/"+siteId + ".html";
}

/**
 * 个人管理中心：我的点评
 */
function mi_onMyCommentsClick() {
	var siteId = pp_getObj('id').value;
	document.location.href=myComments +"/"+siteId + ".html";
}

/**
 * 个人管理中心：个人信息
 */
function onPersonalInfoClick() {
	var siteId = pp_getObj('id').value;
	document.location.href=personalInfoAction;
}

function onEditEntryClick(formId) {
	if (my_index_js_posted) {
		alert(multiSubmit);
		return;
	}
	var form = pp_getObj(formId);
	form.action = editEntryAction;
	my_index_js_posted = true;
	form.submit();
}

function onNavBarClick(obj) {
	var strs;
	for (var i = 1; i < 11; i++) {
		strs = pp_getObj("navTD" + i);
		// alert(strs.innerHTML);
		if (strs) {
			strs.style.background = " url(" + background2 + ")";
		}
	}
	if (obj.id == "navTD1") {
		obj.style.background = " url(" + background4personalInfo
				+ ") no-repeat";
	} else {
		obj.style.background = " url(" + background1 + ") no-repeat";
	}
}

/**
 * 个人管理中心首页
 * 
 * @param {int}
 *            siteId
 */
function onPersonalManageClick(navId, siteId) {
	document.location.href=personalManageAction + "/" + siteId + ".html";
}

/**
 * 个人空间首页：我要留言
 */
function onAboutMeCommentClick(navId, siteId) {
	var parentNode = pp_getObj(navId);
	onNavBarClick(parentNode);
	//document.location.href=aboutMeCommentAction + "?siteId=" + siteId + "&navigation=10x0x7";
	document.location.href=aboutMeCommentAction + "/" + siteId + ".html";
}


/**
 * onAlbumListClick
 * 
 * @param {int}
 *            siteId
 */
function onAlbumListClick(navId, siteId) {
	document.location.href=albumListAction + "/" + siteId + ".html";
}

/**
 * onFavoriteListClick
 * 
 * @param {int}
 *            siteId
 */
function onFavoriteListClick(navId, siteId) {
	document.location.href=favoriteListAction + "/" + siteId + ".html";
}

function onPageListClick(navId, siteId) {
	document.location.href = pageListAction + "/"+ siteId + ".html";
}

function onTreasureListClick(navId, siteId) {
	document.location.href = treasureListAction+"/"+siteId + ".html";
}

function onTShowListClick(navId, siteId) {
	document.location.href = tshowListAction+"/"+siteId + ".html";
}

function onMyGoodsListClick(navId, siteId) {
	document.location.href = myGoodsListAction+"/"+siteId + ".html";
}

/**
 * onAboutMeClick
 * 
 * @param {int}
 *            siteId
 */
function onAboutMeClick(navId, siteId) {
  document.location.href = aboutMeAction + "/" + siteId + ".html";
}

/**
 * onPersonalFriendsClick
 * 
 * @param {int}
 *            siteId
 */
function onPersonalFriendsClick(navId) {
  document.location.href = friendsManageAction;
}

