var NumProjectsToDisplay = 4;
var projects = new Array(new Project('Annapolis School Sewage','projects/feature_annapolisschoolsewage.jpg','s_project_annapolisschoolsewage.html'),
			 new Project('Architectural Renderings','projects/feature_ramarrenderings.jpg','s_project_ramarrenderings.html'),
			 new Project('Acadia First Nation','projects/feature_acadiafirstnation.jpg','s_project_acadiafirstnation.html'),
			 new Project('Antigonish Annexation','projects/feature_antigonishannexation.jpg','s_project_antigonishannexation.html'),
			 new Project('Atlantic Superstore','projects/feature_atlanticsuperstore.jpg','s_project_atlanticsuperstore.html'),
			 new Project('Basinview Ridge','projects/feature_basinviewridge.jpg','s_project_basinview.html'),
			 new Project('Bay Area Sewage Disposal','projects/feature_bayareasewage.jpg','s_project_bayareasewage.html'),
			 new Project('Bedford/Sackville Sewer Study','projects/feature_bedfordsackvilletrunk.jpg','s_project_bedfordsackvilletrunk.html'),
			 new Project('Prince\'s Lodge','projects/feature_bedfordsouth.jpg','s_project_bedfordsouth.html'),
			 new Project('Bedford South Sanitary','projects/feature_bedfordsouthsanitary.jpg','s_project_bedfordsouthsanitary.html'),
			 new Project('Bedford South Water','projects/feature_bedfordsouthwater.jpg','s_project_bedfordsouthwater.html'),
			 new Project('Bedford Superstore Tower','projects/feature_bedfordsuperstoretower.jpg','s_project_bedfordsuperstoretower.html'),
			 new Project('Bedford Highway Sewer','projects/feature_bedfordtrunksewer.jpg','s_project_bedfordsackvilletrunk.html'),
			 new Project('Bedford West Design Guidlines','projects/feature_bedfordwestdesignguidelines.jpg','s_project_bedfordwestdesignguidelines.html'),
			 new Project('Bridgewater Waste Water','projects/feature_bridgewaterwastewaterassessment.jpg','s_project_bridgewaterwastewaterassessment.html'),
		         new Project('Burnside Industrial Park 11-1','projects/feature_burnsidephase11.jpg','s_project_burnsidephase11.html'),
			 new Project('Camden Street Storm Sewer','projects/feature_camdensewer.jpg','s_project_camdensewer.html'),
			 new Project('Canadian Tire','projects/feature_canadiantire.jpg','s_project_canadiantire.html'),
			 new Project('Can-Euro Stormwater','projects/feature_caneurostormwater.jpg','s_project_caneurostormwater.html'),
			 new Project('Capilano Country Estates','projects/feature_capilanophase5and6.jpg','s_project_capilanophase5and6.html'),
			 new Project('Central Kings Rural High','projects/feature_centralkingsruralhighschool.jpg','s_project_centralkingsruralhighschool.html'),
			 new Project('Climate Change Adaptation','projects/feature_climatechange.jpg','s_project_climatechange.html'),
			 new Project('Cobequid Healthcare Centre','projects/feature_cobequidcommunityhealthcarefacility.jpg','s_project_cobequidcommunityhealthcarefacility.html'),
			 new Project('Cole Harbour Storm Drainage','projects/feature_coleharboursds.jpg','s_project_coleharboursds.html'),
			 new Project('Cow Bay Extension','projects/feature_cowbayextension.jpg','s_project_cowbayextension.html'),
			 new Project('Craigwood Subdivision','projects/feature_craigwood.jpg','s_project_craigwood.html'),
			 new Project('Design Drawing Portfolio','projects/feature_renderingportfolio.jpg','s_project_renderingportfolio.html'),
			 new Project('Bathurst Revitalization Study','projects/feature_downtownbathurst.jpg','s_project_downtownbathurstrevitalization.html'),
			 new Project('Grading and Drainage Report','projects/feature_drainagereport.jpg','s_project_drainagereport.html'),
			 new Project('East Hants Water Transmission','projects/feature_easthantswater.jpg','s_project_easthantswater.html'),
			 new Project('Emmerson Park','projects/feature_emmersonpark.jpg','s_project_emmersonpark.html'),
			 new Project('Evergreen Village','projects/feature_evergreenvillage.jpg','s_project_evergreenvillage.html'),
			 new Project('Fairmount Ridge','projects/feature_fairmountridgesubdivision.jpg','s_project_fairmountridgesubdivision.html'),
			 new Project('Farmington Village','projects/feature_farmington.jpg','s_project_farmington.html'),
			 new Project('Former CN Shops (Moncton)','projects/feature_formercn.jpg','s_project_formercn.html'),
			 new Project('Franklin Yard','projects/feature_franklinyard.jpg','s_project_franklinyard.html'),
			 new Project('Gas Pipeline Surveying','projects/feature_gaspipeline.jpg','s_project_gaspipeline.html'),
			 new Project('Gas Plant Site Screening','projects/feature_gasplantscreening.jpg','s_project_gasplantscreening.html'),
			 new Project('Goldridge Subdivision','projects/feature_goldridgesubdivision.jpg','s_project_goldridgesubdivision.html'),
			 new Project('Goldboro Industrial Rezoning','projects/feature_goldboroindustrialrezoning.jpg','s_project_goldboroindustrialrezoning.html'),
			 new Project('Halifax Airport Development Plan','projects/feature_halifaxairportdevplan.jpg','s_project_halifaxairportdevplan.html'),
			 new Project('Halifax Public Libraries','projects/feature_halifaxpubliclibraries.jpg','s_project_halifaxpubliclibraries.html'),
			 new Project('H.R.M. Parking Strategy','projects/feature_hrmparkingstrategy.jpg','s_project_hrmparkingstrategy.html'),
			 new Project('Hammonds Plains Booster Stn.','projects/feature_hammondswaterbooster.jpg','s_project_hammondswaterbooster.html'),
			 new Project('Home Depot','projects/feature_homedepot.jpg','s_project_homedepot.html'),
			 new Project('Infrastructure Mapping','projects/feature_infrastructuremapping.jpg','s_project_infrastructuremapping.html'),
			 new Project('Kingswood Subdivision','projects/feature_kingswood.jpg','s_project_kingswood.html'),

			 new Project('Liquor Commissions','projects/feature_liquorcommissions.jpg','s_project_liquorcommissions.html'),
			 new Project('Lockview Streets/Sidewalk','projects/feature_lockviewstreetsidewalk.jpg','s_project_lockviewstreetsidewalk.html'),
			 new Project('McIntosh Run Development','projects/feature_mcintoshrun.jpg','s_project_mcintoshrun.html'),
			 new Project('Moncton North Flooding','projects/feature_monctonnorthflooding.jpg','s_project_monctonnorthflooding.html'),
			 new Project('Moncton Sewer System','projects/feature_monctonsewersystem.jpg','s_project_monctonsewersystem.html'),
			 new Project('Multiple School Sites','projects/feature_multipleschools.jpg','s_project_multipleschoolsites.html'),
			 new Project('Musquodoboit Mixed-Use Design','projects/feature_musquodoboittransit.jpg','s_project_musquodoboittransit.html'),
			 new Project('North Dartmouth Trunk Sewer','projects/feature_northdartmouthtrunksewer.jpg','s_project_northdartmouthtrunksewer.html'),
			 new Project('Nottingham Park','projects/feature_nottinghampark.jpg','s_project_nottinghampark.html'),
			 new Project('Oakfield Waste Treatment','projects/feature_oakfieldsewagetreatment.jpg','s_project_oakfieldsewagetreatment.html'),
			 new Project('Paddlers Cove','projects/feature_paddlerscovecondominium.jpg','s_project_paddlerscovecondominium.html'),
			 new Project('Petitcodiac Rural Plan','projects/feature_petitcodiacruralplan.jpg','s_project_petitcodiacruralplan.html'),
			 new Project('Port Royal Center','projects/feature_portroyalcenter.jpg','s_project_portroyalcenter.html'),
			 new Project('RDM C&D Disposal Site','projects/feature_rdmrecyclinglandfill.jpg','s_project_rdmrecyclinglandfill.html'),
			 new Project('Red Cross Plasma Facility','projects/feature_redcrossplasma.jpg','s_project_redcrossplasma.html'),
			 new Project('Royale Hemlocks','projects/feature_royalehemlockscondominiumsite.jpg','s_project_royalehemlockscondominiumsite.html'),
			 new Project('Royal Oaks Estates','projects/feature_royaloaksestates.jpg','s_project_royaloaksestates.html'),
			 new Project('Royal Oaks Pumping Stn.','projects/feature_royaloakssewage.jpg','s_project_royaloakssewage.html'),
			 new Project('Sandy Point Road Water','projects/feature_sandypointwatersystem.jpg','s_project_sandypointwatersystem.html'),
			 new Project('Sanitary Sewer Study','projects/feature_sanitarycapacity.jpg','s_project_sanitarycapacity.html'),
			 new Project('Shannex Nursing Homes','projects/feature_shannex.jpg','s_project_shannex.html'),
			 new Project('Sherwood Golf Course','projects/feature_sherwoodgolfcourse.jpg','s_project_sherwoodgolfcourse.html'),
			 new Project('South Colchester High','projects/feature_southcolchesterhighschool.jpg','s_project_southcolchesterhighschool.html'),
			 new Project('Springfield Lake Estates','projects/feature_springfieldlakeestates.jpg','s_project_springfieldlakeestates.html'),
			 new Project('Stream Bank Stabilization','projects/feature_streambankstabilization.jpg','s_project_streambankstabilization.html'),
			 new Project('Superstore at the Pumps','projects/feature_superstoreatthepumps.jpg','s_project_superstoreatthepumps.html'),
			 new Project('Tallahassee School Rezoning','projects/feature_tallahasseeschoolrezoning.jpg','s_project_tallahasseeschoolrezoning.html'),
			 new Project('Tantallon Market Superstore','projects/feature_tantallonmarketsuperstore.jpg','s_project_tantallonmarketsuperstore.html'),
			 new Project('The Fairways','projects/feature_thefairways.jpg','s_project_thefairways.html'),
			 new Project('Timberlea West Collector','projects/feature_timberleacollector.jpg','s_project_timberleacollector.html'),
			 new Project('Town of Chester Study','projects/feature_townofchester.jpg','s_project_townofchester.html'),
			 new Project('UNB Sustainable Design','projects/feature_unbsustainable.jpg','s_project_unbsustainable.html'),
			 new Project('Westwood Hills Subdivision','projects/feature_westwoodhills.jpg','s_project_westwoodhills.html'),
			 new Project('Wind Energy Master Plan','projects/feature_windenergymasterplan.jpg','s_project_windenergymasterplan.html'),
			 new Project('Village of New Maryland','projects/feature_newmaryland.jpg','s_project_newmaryland.html'),
			 new Project('Zhen Hua Transit','projects/feature_zhenhua.jpg','s_project_zhenhuatransit.html'));

function Project(name, image, link)
{
	this.name = name;
	this.image = image;
	this.link = link;
}

function GetRandomNumber()
{
	var rndNumber = (Math.round((Math.random()*(projects.length -1))));
	return rndNumber;
}

function WriteProjects()
{
	var UsedProjects = new Array();

	for(var i=0;i<NumProjectsToDisplay;i++)
	{
		var iRndNum;
		do
		{
			iRndNum = GetRandomNumber();
		}
		while(IsInArray(iRndNum,UsedProjects))
		UsedProjects[i] = iRndNum;
	}
	for(i=0;i<UsedProjects.length;i++)
	{
		// Write out the items
		document.writeln("<td width='188' bgcolor='#E5E0D2' background='" + projects[UsedProjects[i]].image + "' valign='middle'>");
	        document.writeln("  <a class='smalllink' href='" + projects[UsedProjects[i]].link + "'>");
        	document.writeln("   <div style='width: 188px; cursor: pointer; padding-top: 58px; text-align: center; valign: middle;'>");
	        document.writeln("    <span class='smalllink'><b>" + projects[UsedProjects[i]].name + "</b></span>");
        	document.writeln("   </div>");
	        document.writeln("  </a>");
        	document.writeln(" </td>");
		if(i!=(UsedProjects.length -1))
		{
	        	document.writeln("<td width='1' bgcolor='#32381C'><img src='images/1x1_spacer.gif' width='1' height='72'></td>");
		}
		else
		{
			document.writeln("<td width='5' bgcolor='#32381C'><img src='images/fade_band2.gif' width='5' height='72'></td>");
		}
		
	}
}

function IsInArray(iNum, arToCheck)
{
	var ReturnVal = false;
	for(i=0;i<arToCheck.length;i++)
	{
		if(arToCheck[i] == iNum)
		{
			ReturnVal = true;
			break;
		}
	}
	return ReturnVal;
}
