
	function go_projects()
	{
		$('div#output p').remove();

		for (var pc in project_categories)
		{
			$('div#output').append('<div class="project-list"><h2>'
				+ pc + '</h2><table></table></div>');
		
			for (var k in project_categories[pc])
			{	
				var pid = project_categories[pc][k];	
				
				var style = '';
				if (k >= 3) style = ' style="display: none;" class="more"';
				
				var plink = {
				    115: 'bestbuy.html',
				    114: 'bedbathandbeyond.html',
				    328: 'blockbuster.html',
				    117: 'capitalcity.html',
				    136: 'hamiltonmusser.html',
				    142: 'kohl.html',
				    145: 'malpezzi.html',
				    153: 'petco.html',
				    154: 'petsmart.html',
				    160: 'skylinecarwash.html',
				    161: 'staples.html',
				    343: 'ymca.html',
				    74:  'amp.html',
				    148: 'michaels.html',
				    279: 'climenhaga.html',
				    277: 'messiah.html',
				    278: 'messiah.html',
				    280: 'messiah.html',
				    167: 'enginuityemissions.html',
				    132: 'fedexground.html',
				    134: 'gandermountain.html',
				    274: 'kidsoncampus.html',
				    150: 'neelandglower.html',
				    284: 'pennstate.html',
				    264: 'sterncenter.html',
				    296: 'tcaftb.html'
				    
				};
				
				
				var link = plink[pid];	
				
				$('div#output table:last').append(
					'<tr'+style+'>'
					+ (link ? '<th class="name"><a href="projects/'+link+'">'+projects[pid]['n']+'</a></th>'
				      : '<th class="name"><span><!-- '+pid+' -->'+projects[pid]['n']+'</span></th>')
					+ '<td class="location">'+projects[pid]['l'][0]+'</td>'
					+ '<td class="flag db">'+flag(projects[pid]['f'], 'd')+'</td>'
					+ '<td class="flag assoc">'+flag(projects[pid]['f'], 'a')+'</td>'
					+ '<td class="flag eng">'+flag(projects[pid]['f'], 'e')+'</td>'
					+ '<td class="flag tech">'+flag(projects[pid]['f'], 't')+'</td>'
					+ '<td class="flag cm">'+flag(projects[pid]['f'], 'c')+'</td>'
					+ '<td class="flag site">'+flag(projects[pid]['f'], 's')+'</td>'
					+ '<td class="flag prop">'+flag(projects[pid]['f'], 'p')+'</td>'
					+ '</tr>');			
			}
			
		}
		
		show_more_link();
	
		$('div#output p.more a').live('click', function() {
			$(this).parent().parent()
				.find('tr:hidden').fadeIn();
			$(this).parent().hide();
		});
		
				
		$('div#output td.flag').hover(
		  function() { $(this).append('<div class="floater">'+$(this).children('a, span').attr('title')+'</div>'); },
		  function() { $(this).children('div.floater').fadeOut('fast', function() { $(this).remove(); }); }
		);
	
        $('div#output th.name a').fancybox( { width: '700' } );
        	
		$('fieldset select[name=affiliate], input[name=db]').change(function(){
			$('div#output div.project-list').show();
			
			$('div#output td.sel').removeClass('sel');
    		$('div#output th.name a').fancybox( { width: '700' }  );
			
			if ($('fieldset select[name=affiliate]').val() != 'all')
			{
				$('div#output tr').hide()
					.has('td.'+ $('select[name=affiliate]').val()+' a')
					.show();
	
				$('div#output td.' + $('select[name=affiliate]').val()).addClass('sel');
				$('div#output div:not(:has(tr:visible))').hide();
				$('div#output div p.more').hide();
			}
			else
			{
				$('div#output tr').hide().filter(':not(.more)').show();
				show_more_link();
			}
		});

	}
	
	$(document).ready(function() {
		$('head').append('<'+'script src="js/project-db.js" type="text/javascript"></script'+'>');
	});
	
	function show_more_link()
	{
		$('div#output table').has('tr:hidden')
			.after('<p class="more"><a href="javascript:;">Show More in This Category&hellip;</a></p>');
		
	}
	
	function flag(f, k)
	{
		if (f[k] == true)
		{
			var rval = {
				d: '<a rel="external" title="Design-Build" href="master-builder.asp">DB</a>',
				a: '<a rel="external" title="Associates" href="http://www.lobarassoc.com">A</a>',
				e: '<a rel="external" title="Engineering" href="http://www.lobareng.com/">EN</a>',
				c: '<a rel="external" title="Construction Management" href="http://www.lobarcm.com">CM</a>',
				s: '<a rel="external" title="Site Development" href="http://www.lobarsitedevelopment.com/">SD</a>',
				t: '<a rel="external" title="Technologies" href="http://www.lobartech.com/">T</a>',
				p: '<a rel="external" title="Properties" href="http://www.lobarproperties.com/">P</a>'	
			}
		
			return rval[k];		
		}
		else
		{
			var rval = {
				d: '<span title="Design-Build">DB</span>',
				a: '<span title="Associates">A</span>',
				e: '<span title="Engineering">EN</span>',
				c: '<span title="Construction Management">CM</span>',
				s: '<span title="Site Development">SD</span>',
				t: '<span title="Technologies">T</span>',
				p: '<span title="Properties">P</span>'				
			}		
	
			return rval[k];
		}
	}

