(function()
{
	var moduleName = 'companyDetailApp';

	angular.module(moduleName)
		.controller("companyDetailCtrl", ['$scope', 'breadcrumb.service', companyDetailController]);

	function companyDetailController($scope, breadcrumbService)
	{
		var ctrl = this;

		ctrl.company = company;

		// Set up pagination vars
		$scope.totalCount = project_count;
		$scope.projectsPerPage = projects_per_page;
		$scope.currentPage = current_page;
		$scope.searchTerms = searchTerms;

		// Set up filter vars and highlight the right one
		$scope.filters = project_filters;
		$scope.currentFilter = current_filter;

		$scope.projects = projects;

		breadcrumbService.setCrumbs(
		[
			{
				'url': '/projects/companies',
				'name': lmsg('projects.companies.breadcrumb.companies')
			},
			{
				'url': '/projects/companies/' + ctrl.company.id,
				'name': ctrl.company.name
			}
		]);
		
		// Don't let the projects list overwrite our breadcrumb
		breadcrumbService.lock();
	}
}());