var error = new Array();
error['1'] = '参数错误!';
error['2'] = '此团队不存在!';
error['3'] = '您不是该团队的成员!';
error['4'] = '您是团队创始人，不能退出团队,您要注销团队?';
error['5'] = '退出成功!';
error['6'] = '还没有登陆!';

//退出团队
function out(cid){

if (!confirm('您真的要退出吗？'))
{
	return false;
}
 
 req = new Request(
function()
{ 
     //load();
	 //alert(1);
	if (req.xmlhttp.readyState == 4 && req.xmlhttp.status == 200)
	{			
		 //alert(req.xmlhttp.responseText);
		 //alert(error[req.xmlhttp.responseText]);
		 if( req.xmlhttp.responseText == 5 ){
			alert(error[req.xmlhttp.responseText]);
			location.reload();
		}else if(req.xmlhttp.responseText == 4){
			
			   delteam(cid);
			
		}else{
		    alert(error[req.xmlhttp.responseText]);
		}
		
	}
}
);
req.get("/team/index.php?mod=ajax&act=out&cid="+cid);

}

//删除
function delteam(cid){

if (!confirm('您真的要删除吗？'))
{
   return false;
}
 req = new Request(
function()
{ 
     //load();
	 //alert(1);
	if (req.xmlhttp.readyState == 4 && req.xmlhttp.status == 200)
	{			
		 //alert(req.xmlhttp.responseText);
		 if( req.xmlhttp.responseText == 5 ){
			alert('删除成功!');
			//location.reload();
			location.href = '/myspace/team/index.php?mod=team';
		}else{
		    alert(error[req.xmlhttp.responseText]);
		}
		
	}
}
);
req.get("/team/index.php?mod=ajax&act=delteam&cid="+cid);

}

//加入
function join( cid ){

req = new Request(
			function()
			{ 
			     //load();
				 //alert(1);
				if (req.xmlhttp.readyState == 4 && req.xmlhttp.status == 200)
				{			
					 if (typeof(error[req.xmlhttp.responseText]) == "undefined")
					 {
						 alert(req.xmlhttp.responseText);
					 }else{
						 alert(error[req.xmlhttp.responseText]);
					 }
					 
					
					
				}
			}
		);
req.get("/team/index.php?mod=ajax&act=join&cid="+cid);

}


