function Book(data) { this.parent = portfolio; this.init(data); }
Book.prototype = {
	init: function(data) {
		//console.log(this, this.parent);
		if (data) { this.data = data; }
		var instance = this;
		this.target = document.createElement(this.data.type);
		var content = this.parent.template(this.data.template, this.data);
		this.target.innerHTML = content;
		this.target.className = 'item';
		this.target.setAttribute('data-id', this.data.num);
		this.target.setAttribute('data-url', this.data.url);
		this.target.setAttribute('data-image', this.data.images[0].url);
		if (!this.target.addEventListener) { if (this.target.attachEvent) { this.target.attachEvent('on'+'click', function(e) { instance.click(e); }); } }
		else { this.target.addEventListener('click', function(e) { instance.click(e); }, false); }
	},
	click: function(e) {
		//console.log('click', e, this, e.currentTarget, e.target);
		this.show();
	},
	show: function() {
		var content = document.getElementById('project');
		content.innerHTML = '<img src="'+this.data.images[0].url+'" alt="" />';

		var details = document.getElementById('details');
		details.innerHTML = '\
			<h1>'+this.data.title+'</h1> \
			<h2>Client: '+this.data.clients+'</h2> \
			<h2>Year: '+this.data.year+'</h2> \
			<p>'+this.data.description+'</p>';
	}
}
