addLoadEvent(initGallery);

function initGallery() {
	var portfolioPs = getElementsByClass("portfolio");
	for (var i = 0; i < portfolioPs.length; i++) {
		var a = portfolioPs[i].getElementsByTagName("a")[0];
		a.onclick = swapImage;
	}
}

function swapImage() {
	var holderDiv = document.getElementById("generated");
	holderDiv.style.borderBottom = "1px solid #444444";
	var img = this.getElementsByTagName("img")[0];
	var alt = img.getAttribute("alt");
	var bigImage = "";
	var description = "";
	var technologies = "";
	var projectDate = "";
	var link = "";
	switch (alt) {
		case "Vineland Housing Authority":
			bigImage = "vha_big.png";
			projectDate = "April 2009";
			description = "The Vineland (NJ) Housing Authority wanted to refresh their static website, which had not been updated in several years, to present themselves in a more clean and modern way. We created a new template and updated their aging content, and now the site much better reflects and communicates their mission.";
			technologies = new Array("HTML 4.01", "CSS", "Javascript", "AJAX", "PHP", "Google Maps API");
			link = "http://vha.org";
			break;
		case "Legend Medical Products":
			bigImage = "legend_big.png";
			projectDate = "March 2009";
			description = "Legend Medical Products wanted to be able to sell their products online to a select group of customers. We constructed a product database and catalog, including a product-management interface to enable Legend's staff to update their own items and customers.";
			technologies = new Array("HTML 4.01", "CSS", "Javascript", "AJAX", "PHP", "MySQL");
			break;
		case "Running of the Micks":
			bigImage = "runningofthemicks_big.png";
			projectDate = "February 2009";
			description = "The Running of the Micks is a pub crawl in Philadelphia that occurs every St. Patrick's Day. As a growing event, it was experiencing scalability problems due to the completely manual bus reservation process, which was exclusively via e-mail. We constructed an online bus reservation system that integrated with their Paypal account, and also built a database backend for their staff to be able to see how many and which seats had been sold, and to whom.";
			technologies = new Array("Javascript", "AJAX", "PHP", "MySQL", "Paypal integration");
			break;
		case "Clementon School District":
			bigImage = "clementon_big.png";
			projectDate = "August 2008";
			description = "The Clementon (NJ) School District had a website which had been maintained with Microsoft Frontpage by a recently retired user with very little web knowledge. The newly hired Technology Coordinator would be maintaining the site, but was not at all happy with the current state of it. We built a new template for the site, overhauled much of the vast content, and created an update system with which the new website maintainer was comfortable. Due to the enormous amount of content on the old site, the new webmaster is still in the process of transferring the content to the new template.";
			technologies = new Array("HTML 4.01", "CSS", "Javascript", "AJAX", "PHP", "MySQL", "Google Maps API");
			link = "http://clementonschool.org";
			break;
		case "The Ingerman Group":
			bigImage = "ingerman_big.png";
			projectDate = "October 2008";
			description = "The Ingerman Group, a leading housing developer, wanted to overhaul its site to include a searchable property database (among other changes). We set up not only that database and the backend functionality for Ingerman's staff to be able to update it themselves, but also separate data repositories for press releases, awards, media files, and housing brochures. The housing database is searchable by property name, state, city, region, or any combination of these.";
			technologies = new Array("PHP", "MySQL", "Google Maps API");
			link = "http://ingerman.com";
			break;
		case "Your Custom Custodian":
			bigImage = "ycc_big.png";
			projectDate = "January 2010";
			description = "Your Custom Custodian, a small handyman business in Burlington County, NJ, wanted to cost-effectively increase visibility with a basic web presence. They also wanted the capability to update the site's content themselves. We built a small business site using Drupal, an open-source content management system.";
			technologies = new Array("XHTML 1.0", "CSS", "Drupal");
			link = "http://yourcustomcustodian.com";
			break;
		default:
			break;
	}
	while (holderDiv.firstChild) {
		holderDiv.removeChild(holderDiv.firstChild);
	}
	var header = document.createElement("h3");
	var headerText = document.createTextNode(alt);
	var imgP = document.createElement("p");
	var imgElement = document.createElement("img");
	var dateP = document.createElement("p");
	var dateText = document.createTextNode(projectDate);
	var descriptionP = document.createElement("p");
	var descriptionText = document.createTextNode(description);
	var technologiesHeader = document.createElement("h4");
	var technologiesHeaderText = document.createTextNode("Technologies Used:");
	var technologiesUl = document.createElement("ul");
	for (var j = 0; j < technologies.length; j++) {
		var li = document.createElement("li");
		var liText = document.createTextNode(technologies[j]);
		li.appendChild(liText);
		technologiesUl.appendChild(li);
	}
	header.appendChild(headerText);
	imgElement.setAttribute("src", "./images/" + bigImage);
	imgElement.setAttribute("alt", alt);
	imgP.appendChild(imgElement);
	dateP.appendChild(dateText);
	descriptionP.appendChild(descriptionText);
	technologiesHeader.appendChild(technologiesHeaderText);
	holderDiv.appendChild(imgP);
	holderDiv.appendChild(header);
	holderDiv.appendChild(dateP);
	holderDiv.appendChild(descriptionP);
	holderDiv.appendChild(technologiesHeader);
	holderDiv.appendChild(technologiesUl);
	if (link != "") {
		var linkP = document.createElement("p");
		var linkA = document.createElement("a");
		linkA.setAttribute("href", link);
		var linkText = document.createTextNode(link);
		linkA.appendChild(linkText);
		linkP.appendChild(linkA);
		holderDiv.appendChild(linkP);
	}
	return false;
}