size=10;
function repForCmt(cmtId,mid){
	window.location.href=path+"/msg.do?method=torepforcmt&cmtId="+cmtId+"&url="+encodeLocalURL();
}
function copyhome(){
	if (navigator.appVersion.match(/\bMSIE\b/)){
		var linkv=HOME+"/"+webName;
		window.clipboardData.setData("Text",linkv);
		window.alert("地址已复制到剪贴板，您可按下 Ctrl+V 在其它程序中使用");
	}
	else{
		alert("您的浏览器不支持复制功能，请使用Ctrl+C或者鼠标右键");
	}
}
function sucmtfrm(){
	if(!isLogin){
		notLogin();
		return false;
	}
	var ofrm=document.cmt_frm;
	if(!isEmpty(ofrm.content.value,"留言内容")){
		return false;
	}
	if(!checkMaxLength(ofrm.content.value,"留言内容",200)){
		return false;
	}
	ofrm.url.value=grobal_url;
	ofrm.action=path+"/cmt.do?method=sendCmt&mid="+mid;
	return true;
}
function addf(){
	setHTML("fcon2","<span class='ruo'>操作中...</span>");
	doAjax(path+"/f.do?method=addF",handleaddf,"fid="+mid);
}
function handleaddf(v){
	if(v=="1"){
		setHTML("fcon","<span class='green'>"+nickName+"是你的好友</span>");
		setHTML("fcon2","<a href='javascript:delfromf()'>从好友中删除</a>");
	}
}
function delfromf(){
	if(window.confirm("确实要删除？")){
		setHTML("fcon2","<span class='ruo'>操作中...</span>");
		doAjax(path+"/f.do?method=delF",handledelfromf,"fid="+mid+"&url=-1");
	}
}
function handledelfromf(v){
	if(v=="0"){
		setHTML("fcon","<span class='fen'>不是你的好友</span>");
		setHTML("fcon2","<a href='javascript:addf()' style='color:"+rancolor+"'>加为好友</a>")
	}
}
function loadmsgwin(event){
	if(!isLogin){
		alert("请先登录");
		return;
	}
	showWin(event,"popmsg",10,-100);
}
function keydownmsg(event){
	if((event.ctrlKey)&&(event.keyCode==13)){
		sendmsg();
	}
}
function sendmsg(){
	if(!isEmpty(getObj("msg_content").value,"消息内容")){
		return;
	}
	if(!checkMaxLength(getObj("msg_content").value,"消息内容",200)){
		return;
	}
	setHTML("msg_info","发送中...");
	var xml="<resp><method>sendMsg</method><mid>"+mid+"</mid><content><![CDATA["+getObj("msg_content").value+"]]></content></resp>";
	doAjax(path+"/msgpr.do",handelsendmsg,xml);
}
function handelsendmsg(v){
	if(v=="0"){
		setHTML("msg_info","发送成功");
		delay(hidemsgwin,1000);
	}
	else if(v=="-2"){
		notLogin();
	}
	else if(v=="-9"){
		alert("您的积分不足，不能发送消息");
		hidemsgwin();
	}
}
function hidemsgwin(){
	getObj("msg_content").value="";
	setHTML("msg_info","");
	hideWin("popmsg");
}
function initAllInvite(){
	hideWin("invite_act");
}
function loadInvite(event){
	if(!isLogin){
		alert("请先登录");
		return;
	}
	initAllInvite();
	showWin(event,"invite",10,-100);
}
function showInviteAct(event){
	pageNo=1;
	hideWin("invite");
	showWin(event,"invite_act",10,-100);
	loadInviteAct(pageNo);
}
function initCon(){
	setHTML("invite_act_con","数据加载中 ...");
	setHTML("invite_act_page","");
	setHTML("invite_act_info","");
}
function loadInviteAct(v){
	initCon();
	setWinWidth("invite_act",350);
	doAjax(path+"/a.do",showInviteActcallback,"method=getactlist2&pageNo="+v);
}
function showInviteActcallback(v){
	if(v=="0"){
		hideWin("invite_act");
		alert("您还没有参加任何活动");
		return;
	}
	var act_invite_arr=new Array();
	eval(v);
	var s="";
	for(var i=0;i<act_invite_arr.length;i++){
		s+="<div class='li3' onmouseover='setColor(this)' onmouseout='resetColor(this)'><input type='radio' name='invite_act' onclick='selact("+act_invite_arr[i][0]+")'/>"+act_invite_arr[i][1]+"<br/><div class='clearall'></div></div>";
	}
	setHTML("invite_act_con","<span class='fontb'>请选择活动并点击 “确定” 按钮来发送邀请</span><br/>"+s);
	initPageTool(pageNo,size);
	setLen(alen);
	setHTML("invite_act_page",printPage());
}
function skiptoJS(v){
	initPageTool(v,size);
	setHTML("invite_act_page",printPage());
	loadInviteAct(v);
}
var tmpactId=0;
function selact(v){
	tmpactId=v;
}
function inviteact(){
	setHTML("invite_act_info","邀请发送中...");
	doAjax(path+"/msg.do",inviteactcallback,"method=sendJoinActMsg&actId="+tmpactId+"&mid="+mid);
}
function inviteactcallback(v){
	if(v=="0"){
		responseAndDelay("invite_act_info","邀请发送成功",hideinviteactwin,1000);
		return;
	}
}
function hideinviteactwin(){
	hideWin("invite_act");
}
function loadinviteclub(event){
	hideWin("invite");
	if(!isLogin){
		alert("请先登录");
		return ;
	}
	showWin(event,"club_invite",10,-100);
	doAjax(path+"/c.do",handleloadinviteclub,"method=getClubList");
}
function handleloadinviteclub(v){
	if(v=="0"){
		hideWin("club_invite");
		alert('您没有加入任何小组');
	}
	eval(v);
	setHTML("club_invite_con",getHTML("hide_club_invite"));
	var o=getObj("myclubId");
	o.options.length=0;
	o.options[0]=new Option("",0);
	for(var i=0;i<club.length;i++){
		o.options[o.options.length]=new Option(club[i][1],club[i][0]);
	}
}
function sendclubinvite(){
	if(getObj("myclubId").value=="0"){
		alert("请选择小组");
		return false;
	}
	setHTML("club_invite_info","发送中...");
	var obj=getObj("myclubId");
	doAjax(path+"/msg.do?method=sendJoinClubMsg",handesendclubinvite,"clubId="+getObj("myclubId").value+"&clubName="+obj.options[obj.options.selectedIndex].text+"&mid="+mid);
}
function handesendclubinvite(v){
	if(v=="1"){
		setHTML("club_invite_info","发送成功");
		delay(hidemsgwin2,1000);
	}
}
function hidemsgwin2(){
	hideWin("club_invite");
}
function delcmt(cmtId){
	if(window.confirm("确实要删除？")){
		window.location.href=path+"/cmt.do?method=delCmt&cmtId="+cmtId+"&url="+encodeLocalURL();
	}		
}
function tocmt(){
	document.cmt_frm.content.focus();
}
function loadpmwin(event){
	if(!isLogin){
		alert("请先登录");
		return;
	}
	setWinWidth("pmwin",350);
	setWidth("pmwin_content",320);
	showWin(event,"pmwin",10,-100);
}
function keydownpm(event){
	if((event.ctrlKey)&&(event.keyCode==13)){
		addpm();
	}
}
function addpm(){
	if(!isLogin){
		alert("请先登录");
		return;
	}
	if(!isEmpty(getObj("pmwin_content").value,"内容")){
		return;
	}
	if(!checkMaxLength(getObj("pmwin_content").value,"内容",200)){
		return;
	}
	setHTML("pmwin_info","保存中...");
	var xml="<resp><method>addPm</method><mid>"+mid+"</mid><content><![CDATA["+getObj("pmwin_content").value+"]]></content></resp>";
	doAjax(path+"/pmpr.do",addpmcall,xml);
}
function addpmcall(v){
	if(v=="0"){
		alert("你已经推荐过");
		hideWin("pmwin");
	}
	else{
		responseAndDelay("pmwin_info","保存成功",hidepopmwin,1000);
	}
}
function hidepopmwin(){
	hideWin("pmwin");
	setHTML("pmwin_info","");
	setHTML("pmwin_content","");
}
function keydown(event){
	if((event.ctrlKey)&&(event.keyCode==13)){
		var ofrm=document.cmt_frm;
		ofrm.url.value=grobal_url;
		ofrm.action=path+"/cmt.do?method=sendCmt&mid="+mid;
		ofrm.submit();
	}
}
