var win = Ti.UI.currentWindow;

win.hideNavBar();

// Background image view
var bgImage = Ti.UI.createImageView({
	height	: 500,
	top		: -30,
	image	: 'images/bg.png',
	zIndex	: 0
});
win.add(bgImage);




var images = [];
for (var i = 0; i < 10; i++) {
	images[i] = 'images/portfolio/0.jpg';
}

// create coverflow view with images
var view = Titanium.UI.createCoverFlowView({
	images: images,
	bottom: 0
});
win.add(view);

// click listener - when image is clicked
view.addEventListener('click',function(e) {
	// the window to place the image in
    var imgWindow = Ti.UI.createWindow({ 
		modal: true,
		barColor: '#050505',
		backgroundColor: '#050505' 
	}); 

	// The new image view to place the selected image
    var fullImage = Ti.UI.createWebView({
		html: '<img src="images/portfolio/large/0.jpg" />'
    });

	// Create a button to close the modal window
	var close_modal = Titanium.UI.createButton({title:'Close'});
	imgWindow.rightNavButton = close_modal;
	
	// Handle close_modal event
	close_modal.addEventListener('click', function() {
		imgWindow.close();
	});

	// Add the views to the window and open it
    imgWindow.add(fullImage);
	imgWindow.open();
});

