function portfolioItem(clientName, features, imagePath, url) {
	this.clientName = clientName;
	this.features = features;
	this.imagePath = imagePath;
	this.url = url;
	var thumb = new Image();
	thumb.src = imagePath;
}

function portfolioCounter() {
	this.count = 0;
}

function getCount() {
	return this.count;
}

function setCount(count) {
	this.count = count;
}

portfolioCounter.prototype.getCount = getCount;
portfolioCounter.prototype.setCount = setCount;


function loadPortfolioItem(portfolioItem) {
	document.getElementById('client').innerHTML = portfolioItem.clientName;
	document.getElementById('portfolio-image').src = portfolioItem.imagePath;
	document.getElementById('portfolio-link').href = portfolioItem.url;
	document.getElementById('site-features').innerHTML = "";
	for (var i=0; i< portfolioItem.features.length; i++) {
		if (i == (portfolioItem.features.length - 1)) {
			document.getElementById('site-features').innerHTML += "<li class='last'>" + portfolioItem.features[i] +"</li>";
		} else {
			document.getElementById('site-features').innerHTML += "<li>" + portfolioItem.features[i] +"</li>";
		}
	} 
}

function prevItem(pc,portfolio) {
	loadNow = pc.getCount() - 1;
	if (loadNow < 0) {
		loadNow = portfolio.length - 1;
	}
	pc.setCount(loadNow);
	loadPortfolioItem(portfolio[loadNow]);
}

function nextItem(pc,portfolio) {
	loadNow = pc.getCount() + 1;
	if (loadNow >= portfolio.length) {
		loadNow = 0;
	}
	pc.setCount(loadNow);
	loadPortfolioItem(portfolio[loadNow]);
}