// JavaScript Document

function user_list(a, d, f){
	$('working2').appear();
	var first = $('firstname').value;
	var last = $('lastname').value;
	var email = $('email').value;
	var chapter = $('chapter').value;
	var chapteri = $('chapteri').value;
	var region = $('region').value;
	var active = $('active').value;
	var pro = $('profession').value;
	var t = $('type').value;
	var forum = $('forum').value;
	//var show = document.getElementBbyId('list');
	if(!isset(a)) var a =''; if(!isset(d)) var d=''; if(!isset(f)) var  f='';
	var file = '/aj/users';
	//var query = '?first='+first+'&last='+last+'&email='+email+'&chapter='+chapter+'&region='+region+'&active='+active+'&type='+t+'&forum='+forum+'&a='+a+'&d='+d+'&f='+f;
	//alert(query);
	//ajaxCall(file,query,'list');
	new Ajax.Updater('list',file,{method:'get',
			 parameters:{first:first,last:last,email:email,chapter:chapter,chapteri:chapteri,region:region,active:active,type:t,forum:forum,profession:pro,a:a,d:d,f:f}
			});
}

function user_list_results(){
	
	$('working2').appear();
	var first = $('firstname').value;
	var last = $('lastname').value;
	var groove = $('groove').value;
	var line = $('line').value;
	var chapi = $('chapi').value;
	var chapc = $('chapc').value;
	var col = $('college').value;
	var state = $('state').value;
	var profession = $('pro').value;
	var file = '/aj/usersearch';
	
	//var query = '?first='+first+'&last='+last+'&groove='+groove+'&line='+line+'&chapi='+chapi+'&chapc='+chapc+'&col='+col+'&state='+state;
	//ajaxCall(file,query,'list');
	new Ajax.Updater('list',file,{method:'get',
			 parameters:{first:first,last:last,groove:groove,line:line,chapi:chapi,chapc:chapc,col:col,state:state,profession:profession}
			});
}

function loadProfile(id)
{
	
	var file = '/aj/usersearchgain';
	
	if($('pro_'+id).style.display =='none') Effect.SlideDown('pro_'+id);
	else Effect.SlideUp('pro_'+id);
	//$('link_'+id).onclick = 'hideProfile(\''+id+'\');';
	
	new Ajax.Updater('pro_'+id,file,{method:'get',parameters:{id:id}});


}


function user_type(show){

	$(show).appear();
	var id = show.split("_");
	//alert(id[1]);
	var file = '/aj/usertype';
//	var query = '?id='+id[1];
//	ajaxCall(file,query,show);
	new Ajax.Updater(show,file,{method:'get',
			 parameters:{id:id[1]}
			});
}

function user_type_change(id,val,name){

	var file = '/aj/usertypechange';
	var file2 = '/aj/usershowstatus';
	//var query = '?id='+id+'&value='+val;
	//var query2 = '?id='+id;
	var show = "change_"+id;
	var show2 = 'status_'+id;
	if(confirm('Change the status for '+name+'?')){
	//ajaxCall(file,query,show);
	new Ajax.Updater(show,file,{method:'get',
			 parameters:{id:id,value:val}
			});
	$(show).puff();
	//ajaxCall(file2,query2,show2);
	//ajaxCall(file2,query2,show2);
	new Ajax.Updater(show2,file2,{method:'get',
			 parameters:{id:id}
			});
/*	new Ajax.Updater(show2,file2,{method:'get',
			 parameters:{id:id}
			});
*/	}
	else {
		$(show).puff();
	}
	
	
}


