function $(id) {
	return document.getElementById(id);
}
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != "function") {
		window.onload = func;
	} else {
		window.onload = function () {
			oldonload();
			func();
		};
	}
}
function moveElement(elementID, final_x, final_y, interval) {
	if (!document.getElementById) {
		return false;
	}
	if (!document.getElementById(elementID)) {
		return false;
	}
	var elem = document.getElementById(elementID);
	if (elem.movement) {
		clearTimeout(elem.movement);
	}
	if (!elem.style.left) {
		elem.style.left = "0px";
	}
	if (!elem.style.top) {
		elem.style.top = "0px";
	}
	var xpos = parseInt(elem.style.left);
	var ypos = parseInt(elem.style.top);
	if (xpos == final_x && ypos == final_y) {
		return true;
	}
	if (xpos < final_x) {
		var dist = Math.ceil((final_x - xpos) / 10);
		xpos = xpos + dist;
	}
	if (xpos > final_x) {
		var dist = Math.ceil((xpos - final_x) / 10);
		xpos = xpos - dist;
	}
	if (ypos < final_y) {
		var dist = Math.ceil((final_y - ypos) / 10);
		ypos = ypos + dist;
	}
	if (ypos > final_y) {
		var dist = Math.ceil((ypos - final_y) / 10);
		ypos = ypos - dist;
	}
	elem.style.left = xpos + "px";
	elem.style.top = ypos + "px";
	var repeat = "moveElement('" + elementID + "'," + final_x + "," + final_y + "," + interval + ")";
	elem.movement = setTimeout(repeat, interval);
}
function classNormal(ifocus_newBtnID, ifocus_newTxID) {
	var ifocus_newBtns = $(ifocus_newBtnID).getElementsByTagName("li");
	var ifocus_newTxs = $(ifocus_newTxID).getElementsByTagName("li");
	for (var i = 0; i < ifocus_newBtns.length; i++) {
		ifocus_newBtns[i].className = "normal";
		ifocus_newTxs[i].className = "normal";
	}
}
function classCurrent(ifocus_newBtnID, ifocus_newTxID, n) {
	var ifocus_newBtns = $(ifocus_newBtnID).getElementsByTagName("li");
	var ifocus_newTxs = $(ifocus_newTxID).getElementsByTagName("li");
	ifocus_newBtns[n].className = "current";
	ifocus_newTxs[n].className = "current";
}
function ifocus_newChange() {
	if (!$("ifocus_new")) {
		return false;
	}
	$("ifocus_new").onmouseover = function () {
		autokey = true;
	};
	$("ifocus_new").onmouseout = function () {
		autokey = false;
	};
	var ifocus_newBtns = $("ifocus_new_btn").getElementsByTagName("li");
	var listLength = ifocus_newBtns.length;
	ifocus_newBtns[0].onmouseover = function () {
		moveElement("ifocus_new_piclist", 0, 0, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 0);
	};
	if (listLength >= 2) {
		ifocus_newBtns[1].onmouseover = function () {
			moveElement("ifocus_new_piclist", 0, -260, 5);
			classNormal("ifocus_new_btn", "ifocus_new_tx");
			classCurrent("ifocus_new_btn", "ifocus_new_tx", 1);
		};
	}
	if (listLength >= 3) {
		ifocus_newBtns[2].onmouseover = function () {
			moveElement("ifocus_new_piclist", 0, -520, 5);
			classNormal("ifocus_new_btn", "ifocus_new_tx");
			classCurrent("ifocus_new_btn", "ifocus_new_tx", 2);
		};
	}
	if (listLength >= 4) {
		ifocus_newBtns[3].onmouseover = function () {
			moveElement("ifocus_new_piclist", 0, -780, 5);
			classNormal("ifocus_new_btn", "ifocus_new_tx");
			classCurrent("ifocus_new_btn", "ifocus_new_tx", 3);
		};
	}
	if (listLength >= 5) {
		ifocus_newBtns[4].onmouseover = function () {
			moveElement("ifocus_new_piclist", 0, -1040, 5);
			classNormal("ifocus_new_btn", "ifocus_new_tx");
			classCurrent("ifocus_new_btn", "ifocus_new_tx", 4);
		};
	}
}
// 未必能在4秒钟加载完成，尤其是stat，static，google广告，统计， 目前很慢
//setInterval("autoifocus_new()", 4000);
var autokey = false;
function autoifocus_new() {
	if (!$("ifocus_new")) {
		return false;
	}
	if (autokey) {
		return false;
	}
	var focusBtnList = $("ifocus_new_btn").getElementsByTagName("li");
	var listLength = focusBtnList.length;
	for (var i = 0; i < listLength; i++) {
		if (focusBtnList[i].className == "current") {
			var currentNum = i;
		}
	}
	if (currentNum == 0 && listLength != 1) {
		moveElement("ifocus_new_piclist", 0, -260, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 1);
	}
	if (currentNum == 1 && listLength != 2) {
		moveElement("ifocus_new_piclist", 0, -520, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 2);
	}
	if (currentNum == 2 && listLength != 3) {
		moveElement("ifocus_new_piclist", 0, -780, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 3);
	}
	if (currentNum == 3 && listLength != 4) {
		moveElement("ifocus_new_piclist", 0, -840, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 4);
	}
	if (currentNum == 4 && listLength != 5) {
		moveElement("ifocus_new_piclist", 0, -1040, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 5);
	}
	if (currentNum == 4) {
		moveElement("ifocus_new_piclist", 0, 0, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 0);
	}
	if (currentNum == 1 && listLength == 2) {
		moveElement("ifocus_new_piclist", 0, 0, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 0);
	}
	if (currentNum == 2 && listLength == 3) {
		moveElement("ifocus_new_piclist", 0, 0, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 0);
	}
	if (currentNum == 3 && listLength == 4) {
		moveElement("ifocus_new_piclist", 0, 0, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 0);
	}
	if (currentNum == 4 && listLength == 5) {
		moveElement("ifocus_new_piclist", 0, 0, 5);
		classNormal("ifocus_new_btn", "ifocus_new_tx");
		classCurrent("ifocus_new_btn", "ifocus_new_tx", 0);
	}
}

//addLoadEvent(ifocus_newChange);
document.writeln("<div id='tempbuluo' style='position:absolute;z-index:3; display: none; filter:\"progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#999999,strength=3)\"'></div>");
//当鼠标位于二级分类名称上面时激发
function ShowBuluo(obj, class2Id) {
	var o = obj;
	//取得激发事件位置
	x = o.offsetLeft;
	y = o.offsetTop;
	while (o = o.offsetParent) {
		x += o.offsetLeft;
		y += o.offsetTop;
	}
	//显示位置位为相对于激发事件下面12px处
	document.getElementById("tempbuluo").style.left = x + "px";
	document.getElementById("tempbuluo").style.top = y + 12 + "px";
	jQuery("#tempbuluo").hide();
	ShowBuluoList(class2Id);
}
var class2RecommendGroups = null;
var myGroups = null;

//显示热门来吧
function ShowBuluoList(class2Id) {
	var showData = function (data, class2Id) {
		if (data == null) {
			return false;
		}
		for (var i = 0, l = data.length; i < l; i++) {
			if (data[i].c2Id == class2Id) {
				var list = data[i].gs;
				if (list == null || list.length < 1) {
					return;
				}
				var DivContent = "<table border='0' cellspacing='0' style='border:#dddddd 1px solid; background-color:#ffffcc' style='position:relative;'><tr>";
				for (var y = 0, yl = list.length; y < yl; y++) {
					vo = list[y];
					DivContent += "<td  style='border:#dddddd 0px solid; background-color:#ffffcc;padding:5px;'>";
					DivContent += "<a class='f12' href='" + createGroupLink(vo.gId) + "' target='_blank'>" + vo.gN + "</a></td>";
				}
				DivContent += "</tr></table>";
				document.getElementById("tempbuluo").innerHTML = DivContent;
				jQuery("#tempbuluo").show();
				return;
			}
		}
	};
	if (class2RecommendGroups != null && class2RecommendGroups.hadError == 0) {
		showData(class2RecommendGroups.data.Class2RecommendGroups, class2Id);
	}
}
//隐藏所有的活跃来吧
jQuery(document).bind("click", function () {
	jQuery("#tempbuluo").hide();
});
function showCitySelect() {
	var loginURL = "/common/citySelect.jsp?TB_iframe=true&height=350&width=450&keepThis=true";
	tb_show("\u540c\u57ce\u90e8\u843d", loginURL);
}
function checkSearchValid() {
	var _t = jQuery.trim(jQuery("#search_text").val());
	jQuery("#search_text").val(_t);
	return !(_t == "\u8bf7\u8f93\u5165\u90e8\u843d\u540d\u79f0" || _t == "");
}
/*构造左导航分类模块显示*/
function createLeftNavClassfication(allclass) {
	if (allclass == null) {
		return;
	}
	var lnbegin = new Date().getTime();
	var _h = "";
	allclass = classficationFilter(allclass);
	for (var x = 0, xl = allclass.length; x < xl; x++) {
		var c1 = allclass[x];
		_h += "<ul class=\"nav_out_fl\"><li><span><a href=\"classification.jsp?class1=";
		_h += c1.c1Id + "\">";
		_h += c1.c1N;
		_h += "</a></span></li><li>";
		var c2Array = c1.c2;
		c2Array = classficationFilter(c2Array);
		for (var y = 0, yl = c2Array.length; y < yl; y++) {
			var c2 = c2Array[y];
			_h += "<a onmouseover=\"javascript:ShowBuluo(this,'";
			_h += c2.c2Id;
			_h += "')\" style=\"position: relative;\" href=\"classification.jsp?class1=";
			_h += c1.c1Id;
			_h += "&class2=" + c2.c2Id;
			_h += "\">" + c2.c2N + "</a> ";
		}
		_h += "</li></ul>";
	}
	jQuery("#left_nav_classfication").html(_h + jQuery("#left_nav_classfication").html());
}

/**
 * 过滤不需要显示的分类，displayFlag == 1 显示，displayFlag == 0 不显示
 * 依赖jQuery
 *
 * @param array 需要过滤的分类数据，
 * 				元素为	Classification1{c1Id,c1N,displayFlag,c2}
 *						Classification2{c2Id, c2N,displayFlag}
 */
function classficationFilter(array) {
	if (array == null || array.length == undefined || array.length < 1 )
		return array;
	var newarr = jQuery.grep(array, function(n,i){
		if (n && n.displayFlag) {
			return n.displayFlag == 1;
		} else {
			return false;
		}
	});
	
	return newarr;
}


/*构造左导航城市模块显示*/
function createLeftNavCity() {
	var recommend_citys = [{"n":"\u6d77\u53e3", "id":64}, {"n":"\u5e7f\u5dde", "id":56}, {"n":"\u5317\u4eac", "id":1}, {"n":"\u4e0a\u6d77", "id":2}, {"n":"\u6df1\u5733", "id":57}, {"n":"\u91cd\u5e86", "id":4}, {"n":"\u5927\u8fde", "id":14}, {"n":"\u798f\u5dde", "id":33}, {"n":"\u9999\u6e2f", "id":98}, {"n":"\u5580\u4ec0", "id":353}, {"n":"\u676d\u5dde", "id":25}, {"n":"\u5357\u4eac", "id":20}, {"n":"\u6606\u660e", "id":89}, {"n":"\u62c9\u8428", "id":90}, {"n":"\u6210\u90fd", "id":82}];
	var _t = "";
	for (var i = 0, l = recommend_citys.length; i < l; i++) {
		var vo = recommend_citys[i];
		_t += "<a href=\"/city_group.jsp?cityId=" + vo.id + "\">" + vo.n + "</a>\n";
	}
	_t += jQuery("#left_nav_city_span").html();
	jQuery("#left_nav_city_span").html(_t);
}
/*构造左导航我的来吧*/
function createLeftNavMyGroups(idWriter) {
	var url = "/myty/mygroups_data.jsp?TYPE=MY_GROUPS_FOR_LEFT_NAV";
	url += "&ownerId=" + idWriter;
	url += "&ct=180";	//客户端缓存
	jQuery.getJSON(url, null, function (res) {
		if (res.hadError > 0) {
			jQuery(document).ready(height_bg);
			return;
		}
		myGroups = res.data.MY_GROUPS_FOR_LEFT_NAV;
		// 对获取到的来吧进行排序
		// 1、按照我的天涯里的来吧排序的顺序排序。
		// 2、在来吧数据导入后，第一次初始化，
		//    显示顺序为：担任首席的来吧 、担任普通组长、助理的来吧、身份是普通成员的来吧。
		//    初始化之后用户可以更改排序，更改后按照用户定义的顺序显示。
		// 调用方法，返回的数据已经是按照用户设定的来吧顺序，只需要再对用户来吧的角色排序
		// myGroups = [ {groupId, groupName, groupRank, memberflag}, ... ]
		// 依赖 shellsort.js
		if (myGroups && myGroups.length && myGroups.length > 1) {
			myGroups = ShellSort(myGroups, groupSortComparator);
		}
		showMyGroups(myGroups, false);
	});
}
/**
 * 来吧排序比较器
 * groupRank 优先(越小越前)， memberFlag 次之 （越大越前）
 */
function groupSortComparator(g1, g2) {
	if (g1 == undefined && g2 != undefined) {
		return -1;
	} else {
		if (g1 != undefined && g2 == undefined) {
			return 1;
		} else {
			if (g1 == undefined && g2 == undefined) {
				return 0;
			} else { // 都为对象
				var d = g1.groupRank - g2.groupRank;
				if (d != 0) {
					return d;
				}
				d = g1.memberFlag - g2.memberFlag;
				return 0 - d;
			}
		}
	}
}
function showMyGroups(myGroups, showAll) {
	if (myGroups == null || myGroups.length < 1) {
		return;
	}
	var orginSize = 10;
	var _h = "<ul onmouseover=\"this.className='nav_over'\" onmouseout=\"this.className='nav_out'\" class=\"nav_out\">";
	var l = myGroups.length;
	if (!showAll && l > orginSize) {
		l = orginSize;
	}
	var groupVO = null;
	for (var i = 0; i < l; i++) {
		groupVO = myGroups[i];
		var isManager = (groupVO.memberFlag) > 2;
		_h += "<li>";
		_h += "<a target=\"_blank\" title=\"" + groupVO.groupName + "\" href=\"";
		_h += createGroupLink(groupVO.groupId);
		_h += "\">";
		_h += isManager ? groupVO.groupName.substring(0, 5) : groupVO.groupName.substring(0, 8);
		_h += "&gt;&gt;</a>";
		if (isManager) {
			_h += " <span><a target=\"_blank\" href=\"";
			_h += createMyTianyaLink(createGroupManageLink(groupVO.groupId));
			_h += "\">[\u7ba1\u7406]</a></span>";
		}
		_h += "</li>";
	}
	if (showAll && myGroups.length > orginSize) {
		_h += "<li>\u3000\u3000\u3000\u3000<a href=\"javascript:void(0)\" onclick=\"showMyGroups(myGroups,false);\">\u8fd4\u3000\u3000\u56de&nbsp;\u2191</a></li>";
	}
	if (!showAll && myGroups.length > orginSize) {
		_h += "<li>\u3000\u3000\u3000\u3000<a href=\"javascript:void(0)\" onclick=\"showMyGroups(myGroups,true);\">\u663e\u793a\u6240\u6709&nbsp;\u2193</a></li>";
	}
	_h += "</ul>";
	jQuery("#left_nav_mygroup").html(_h);
	jQuery(document).ready(height_bg);
}

// 初始化
jQuery(document).ready(function () {
	if (document.getElementById("ifocus")) {
		iFocusChange();
	}
	/* 官方来吧和居委会来吧需要点击才展现 */
	jQuery("#officialGroup").click(function () {
		jQuery("#officialGroup + div").toggle();
	});
	jQuery("#committeeGroup").click(function () {
		jQuery("#committeeGroup + div").toggle();
	});
	
});

// 头条推荐
function initHead() {
	if (headJson && headJson != null && headJson.length != undefined && headJson.length > 0) {
		var pics = [];
		var tips = [];
		var titles = [];
		pics.push("<div id='ifocus_new_piclist' style='left: 0; top: 0;'><ul>");
		tips.push("<div id='ifocus_new_tx'><ul>");
		titles.push("<div id='ifocus_new_btn' style='float: left'><ul>");
		for (var i = 0; i < headJson.length; i++) {
			var a = headJson[i];
			pics.push("<li>");
			pics.push("<a href='" + a.articleUrl + "' target='_blank'>");
			pics.push("<img src='" + a.picUrl + "' /></a>");
			pics.push("</li>");
			tips.push("<li class='current'>");
			tips.push("<a href='" + a.articleUrl + "' target='_blank'>" + a.articleTitle + "</a>");
			tips.push("</li>");
			titles.push("<li class='current'>");
			titles.push("<a href='" + a.articleUrl + "' target='_blank'>" + a.articleTitle + "</a>");
			titles.push("<p>\u6587/<a href='" + createTianyaUserUrl(a.writer) + "' target='_blank'>" + a.writer + "</a></p>");
			titles.push("</li>");
		}
		pics.push("</ul></div>");
		tips.push("</ul></div>");
		titles.push("</ul></div>");
		jQuery("#ifocus_new_piclist").replaceWith(pics.join(""));
		jQuery("#ifocus_new_tx").replaceWith(tips.join(""));
		jQuery("#ifocus_new_btn").replaceWith(titles.join(""));
	}
}

// 群内快讯
function initGnews() {
	if (gnewsJson && gnewsJson != null && gnewsJson.length != undefined && gnewsJson.length > 0) {
		var news = [];
		news.push("<div class='lst' id='gnews'><ul>");
		for (var i = 0; i < gnewsJson.length; i++) {
			var a = gnewsJson[i];
			news.push("<li><span></span><h1>");
			news.push("<a href='");
            news.push(a.articleUrl);
            news.push("' target='_blank' title='");
            news.push(a.articleTitle);
            news.push("'>");
			news.push(trimWords(a.articleTitle,9));
			news.push("</a></h1></li>");
		}
		news.push("</ul></div>");
		jQuery("#gnews").replaceWith(news.join(""));
	}
}

// 友情链接
function initFriend() {
	if (friendJson && friendJson != null && friendJson.length != undefined && friendJson.length > 0) {
		var friendlinks = [];
		friendlinks.push("<div class='alliance_right' id='friend'><ul>");
		for (var i = 0; i < friendJson.length; i++) {
			var a = friendJson[i];
			friendlinks.push("<li class='yq_li'><h1>");
			friendlinks.push("<a href='" + a.articleUrl + "' class='blue_yq' target='_blank'>");
			friendlinks.push(a.articleTitle);
			friendlinks.push("</a></h1></li>");
		}
		friendlinks.push("</ul></div>");
		jQuery("#friend").replaceWith(friendlinks.join(""));
	}
}

// 最新热点
function initHot1() {
	if (hot1Json && hot1Json != null && hot1Json.length != undefined && hot1Json.length > 0) {
		var hots = [];
		hots.push("<div class='list_zz_re pd' id='hot1'><ul>");
		for (var i = 0; i < hot1Json.length; i++) {
			var a = hot1Json[i];
			hots.push("<li>");
			//hots.push("<h3><a href='"+a.blogUrl+"' target='_blank'>"+a.blogName+"</a></h3>");
			hots.push("<span><a href='");
			hots.push(a.articleUrl);
			hots.push("' target='_blank' title='");
			hots.push(a.articleTitle)
			hots.push("'>");
			hots.push(trimWords(a.articleTitle,17));
			hots.push("</a></span>");
			hots.push("<a id='CL_TEXT_F_2_1' class='author'	target='_blank' href='");
			hots.push(createTianyaUserUrl(a.writer));
			hots.push("' title='");
			hots.push(a.writer);
			hots.push("'>");
			//hots.push(trimWords(a.writer,5));
			hots.push(a.writer);
			hots.push("</a></li>");
		}
		hots.push("</ul></div>");
		jQuery("#hot1").replaceWith(hots.join(""));
	}
	
	
}

// 人气热帖 
function initHot2() {
	if (hot2Json && hot2Json != null && hot2Json.length != undefined && hot2Json.length > 0) {
		var hots = [];
		hots.push("<div class='list_zz_re pd' id='hot2'><ul>");
		for (var i = 0; i < hot2Json.length; i++) {
			var a = hot2Json[i];
			hots.push("<li>");
			//hots.push("<h3><a href='"+a.blogUrl+"' target='_blank'>"+a.blogName+"</a></h3>");
			hots.push("<span><a href='");
			hots.push(a.articleUrl);
			hots.push("' target='_blank' title='");
			hots.push(a.articleTitle)
			hots.push("'>");
			hots.push(trimWords(a.articleTitle,17));
			hots.push("</a></span>");
			hots.push("<a id='CL_TEXT_F_2_1' class='author'	target='_blank' href='");
			hots.push(createTianyaUserUrl(a.writer));
			hots.push("' title='");
			hots.push(a.writer);
			hots.push("'>");
			hots.push(a.writer);
			hots.push("</a></li>");
		}
		hots.push("</ul></div>");
		jQuery("#hot2").replaceWith(hots.join(""));
	}
}

// 热门图帖-文字
function initPic2() {
	if (pic2Json && pic2Json != null && pic2Json.length != undefined && pic2Json.length > 0) {
		var pics = [];
		pics.push("<h3 id='pic2'>");
		for (var i = 0; i < pic2Json.length; i++) {
			var a = pic2Json[i];
			pics.push("<a href='" + a.articleUrl + "' target='_blank'>");
			pics.push(a.articleTitle);
			pics.push("</a>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;");
		}
		pics.push("</h3>");
		jQuery("#pic2").replaceWith(pics.join(""));
	}
}

// 热门图帖-图片
function initPic1() {
	if (pic1Json && pic1Json != null && pic1Json.length != undefined && pic1Json.length > 0) {
		var pics = [];
		pics.push("<div  class='lst_pic ' id='pic1'><span class='w8'></span><ul>");
		for (var i = 0; i < pic1Json.length; i++) {
			var a = pic1Json[i];
			pics.push("<li><a href='" + a.articleUrl + "' target='_blank'>");
			pics.push("<img src='" + a.picUrl + "' width='130' height='100' alt='"+a.articleTitle+"' /></a>");
			pics.push("<h5><a href='" + a.articleUrl + "' title='"+a.articleTitle+"'>"+a.articleTitle.substring(0,8)+"</a></h5>"); 
			pics.push("<h2>作者：<a href='"+createTianyaUserUrl(a.writer)+"'>"+a.writer+"</a></h2></li>");
		}
		pics.push("</ul></div>");
		jQuery("#pic1").replaceWith(pics.join(""));
	}
}

// 热门图帖-文字
function initgox2() {
	if (gox2Json && gox2Json != null && gox2Json.length != undefined && gox2Json.length > 0) {
		var goxs = [];
		goxs.push("<h3 id='gox2'>");
		for (var i = 0; i < gox2Json.length; i++) {
			var a = gox2Json[i];
			goxs.push("<a href='" + a.articleUrl + "' target='_blank'>");
			goxs.push(a.articleTitle);
			goxs.push("</a>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;");
		}
		goxs.push("</h3>");
		jQuery("#gox2").replaceWith(goxs.join(""));
	}
}

// 群组牛人-图片
//function initgox1() {
//	if (gox1Json && gox1Json != null && gox1Json.length != undefined && gox1Json.length > 0) {
//		var goxs = [];
///		goxs.push("<div class='list_pic_cattle pd3 margin_lr_b' id='gox1'><span class='w8'></span><ul>");
//		for (var i = 0; i < gox1Json.length; i++) {
//			var a = gox1Json[i];
//			goxs.push("<li>");
//			goxs.push(a.articleTitle2);
//			goxs.push("<h3>"+a.writer+"</h3>"); 
//			goxs.push("<p>来自：<a href='"+a.articleUrl+"'>"+a.articleTitle+"</a></p></li>");
//		}
//		goxs.push("</ul></div>");
//		jQuery("#gox1").replaceWith(goxs.join(""));
//	}
//}

// 人气群组-文字
function initghot2() {
	if (ghot2Json && ghot2Json != null && ghot2Json.length != undefined && ghot2Json.length > 0) {
		var ghots = [];
		ghots.push("<h3 id='ghot2'>");
		for (var i = 0; i < ghot2Json.length; i++) {
			var a = ghot2Json[i];
			ghots.push("<a href='" + a.articleUrl + "' target='_blank'>");
			ghots.push(a.articleTitle);
			ghots.push("</a>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;");
		}
		ghots.push("</h3>");
		jQuery("#ghot2").replaceWith(ghots.join(""));
	}
}


// 人气群组-图片
/* //暂时找不到在ie6下这块实现的bug,有时显示，有时不显示
function initghot1() {
	if (ghot1Json && ghot1Json != null && ghot1Json.length != undefined && ghot1Json.length > 0) {
		var ghots = [];
		ghots.push("<div id='ghotx1'>");
		for (var i = 0; i < ghot1Json.length; i++) {
			var a = ghot1Json[i];
			ghots.push("<div class='" + (i%2==0?"wid_top":"wid_top_ri") + "'>");
			
			ghots.push("<div class='fence_r_col_pic'><a target='_blank' href='");
			ghots.push(a.articleUrl);
			ghots.push("' title='");
			ghots.push(a.articleTitle);
			ghots.push("' >");
			ghots.push(a.picUrl);
			ghots.push("</a>");
			ghots.push("</div>");
			
			ghots.push("<div class='fence_r_col_con'><div class='list_cen'>");
			ghots.push("<img src='images/dot_add.jpg' border='0' align='top' class='add' id='"+a.articleTitle2+"'/>");
			ghots.push("<h2><a href='");
			ghots.push(a.articleUrl);
			ghots.push("' target='_blank' title='");
			ghots.push(a.articleTitle);
			ghots.push("'>");
			ghots.push(a.articleTitle.substring(0,11));
			ghots.push("</a></h2>");
			ghots.push("<h3>成员数量："+a.displayOrder+" 帖子数量："+a.supportNum+"</h3>");
			ghots.push(a.articleComment);
			ghots.push("</div></div>");
			
			
			ghots.push("</div>");
		}
		ghots.push("</div>");
		jQuery("#ghot1").replaceWith(ghots.join(""));
		jQuery("img").filter(".add").click(function() {
			var groupId = this.id;
			joinGroup(groupId);
		});
	}
}
*/

/*
	随机显示在专题后台推荐的前10个来吧中的一个（人气群组-群组 推荐模块）
	ghot1Json 保存推荐来吧的信息。groupUrl = articleUrl groupId = articleTitle2
*/
function showRandomGroup() {
	if (ghot1Json && ghot1Json != null && ghot1Json.length != undefined && ghot1Json.length > 0) {
		var max = (10 < ghot1Json.length ? 10 : ghot1Json.length);
		var randnum=Math.floor(Math.random()*max);
		if (randnum == max) {
			randnum = randnum -1;
		}
		var a = ghot1Json[randnum];
		var url = a.articleUrl;
		window.location.href = url;
	}

}
						

