// View Layer - portfolio page

var PortfolioView = new Class({
	initialize: function() {
		window.Portfolio = this;
		
		this.info_panel = $$("#image_chooser p.info");
		this.landscape_info = "Please select an image to view. The image will be loaded in the viewer below. Images with a lighter border are portrait and will cause the layout to change."
		this.portrait_info =  "Please select an image to view. The image will be loaded in the viewer to the right. Images with a darker border are landscape and will cause the layout to change."
		
		this.registerInterest();
	},
	
	registerInterest: function() {
		Model.addEvent('loadFinish', this.update_info.bind(this));
		Model.addEvent('loadFinish', this.scroll_window.bind(this));
	},
	
	update_info: function() {
		Model.loadedItem.get('portrait') ? this.info_panel.setHTML(this.portrait_info) : this.info_panel.setHTML(this.landscape_info)
	},
	
	scroll_window: function() {
		if (!Model.virgin)
			util.callLater(function(){
				new Fx.Scroll(window, {duration:800, offset: {'x': 0, 'y': -10}}).toElement($("view_wrap"))
			}, 300);
	}
	
})

window.loadedAssetLength +=1;
