

EOL.namespace('groups');

EOL.groups.getGroups = function(page) {
	if(!page) {
		page = 1;
	}
	
	//$('directoryResults').style.display = 'none';
	$('directoryResultsLoading').style.display = '';
	
	$('directoryList').style.opacity = '.25';
	$('directoryList').style.filter = 'alpha(opacity=25)';

	var options = {
		method: 'get',
		update: $('directoryResults')
	};
	
	options.onComplete = function(request){
		//$('directoryResults').style.display = '';
		$('directoryResultsLoading').style.display = 'none';
		
		$('directoryList').style.opacity = '1';
		$('directoryList').style.filter = 'alpha(opacity=100)';
		$('directoryList').style.backgroundColor = '#fff';
	};
	
	var path = '/php/groups/main/directoryHTML.php?';

	curAsyncReq = new Ajax(path + '&page='+page + '&t=' + getDateTime(), options);
	curAsyncReq.request();
	
}

EOL.groups.doSearch = function() {
	window.location = $('groupSearchContext').value;
}

EOL.groups.toggleTab = function(type) {
	if(type == 'projects') {
		$('projectTab').style.display = '';
		$('profileTab').style.display = 'none';
		$('tab1').className = '';
		$('tab2').className = 'selected projsel';
	}
	else if(type == 'profiles') {
		$('profileTab').style.display = '';
		$('projectTab').style.display = 'none';
		$('tab2').className = '';
		$('tab1').className = 'selected profsel';
	}

}

EOL.groups.doProjectSearch = function() {
	var url = $('projectSearchUrl').value;
	url += '&matchKeywords=' + $('projectKeywords').value;
	window.location = url;
}

EOL.groups.doProfileSearch = function() {
	var url = $('profileSearchUrl').value;
	url += '&matchKeywords=' + $('profileKeywords').value;
	window.location = url;
}