// JavaScript Document
function joinGroup(id){
	var url='/index.php/tribe/join/tid/'+id;
	$.get(url,function(date){
					   
				if(date=='ok'){alert('加入成功!');
				}else if(date=='ing'){	 alert('已发送加入请求,等待管理员审核!')
				}else if(date=='r'){alert('您已是此部落成员!');}   
				 	   
					   });
  }
  
  function destroyGroup(tid,fla){
	  if(fla=='remo'){
		  if(confirm('您好，您确定要解散此部落吗？解散后将不可恢复！')){
		  		$.get('/index.php/tribe/remo/tid/'+tid,null,function(){
																alert('该部落已解散成功');
																window.location='/index.php/tribe/mytribe';
																});
		  }
		 }else if(fla=='exit'){ 
			   if(confirm('您确定要退出部落吗？')){
		  			$.get('/index.php/tribe/exit/tid/'+tid,null,function(){ 
															alert('成功退出该部落');
																window.location='/index.php/tribe/mytribe';				 
																		 });
		  		}	
			 }
	  
	  }
	  //设置管理员;
function setadmin(tid,name,fal){
	if(fal=='adm'){ 
	 	if(confirm('您确定要将 '+name+' 提拔为管理员吗？')){
		 $.get('/index.php/tribe/setadmin/tid/'+tid);
	 	}
	}else{
		 if(confirm('您确定要取消 '+name+' 的管理职位吗？')){
		 $.get('/index.php/tribe/setadmin/tid/'+tid);
		  }
		
		}
		
	window.location.reload();	
	}
	//踢出小组
function remove(tid,name){
 
		 if(confirm('您确定要将 '+name+' 请出部落吗？')){
			 
		 	$.get('/index.php/tribe/remove/id/'+tid,null,function(){
																  $('#user'+tid).css('display','none');
																  
																  });
	 	 }
		}
	//加入审核
function setjoin(id,fla){
		if(fla=='ok'){
			 $.get('/index.php/tribe/setjoin/id/'+id);
	 	 }else{
				$.get('/index.php/tribe/remove/id/'+id);
		 }
		 window.location.reload();	
	}
