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 data = [

	{ 
		title		: 'Website Creations', 
		page		: 'webdesign',
		leftImage	: 'images/icon_036.png',
		height		: 50,		
		color		: '#fff',		
		selectedBackgroundColor: '#fff',		
		hasChild	: true 
	},
	{ 
		title		: 'Wordpress Development', 
		page		: 'wordpress',
		leftImage	: 'images/icon_036.png',
		height		: 50,
		color		: '#fff',				
		selectedBackgroundColor: '#fff',		
		hasChild	: true 
	},

	{ 
		title		: 'iPhone & iPad Apps', 
		page		: 'iphone',
		leftImage	: 'images/icon_036.png',
		height		: 50,	
		color		: '#fff',	
		selectedBackgroundColor: '#fff',				
		hasChild	: true 
	}	

];

// ----- Create the actual tableView for the page ----- //
var tableview = Titanium.UI.createTableView({
	data			: data,			// The data to populate the tableView
	layout			: 'vertical',	// The type of layout to use
	height			: '70%',
	bottom			: 0,
	backgroundImage	: 'transparent',
	background		: 'transparent',
    backgroundColor	: 'transparent',
	separatorColor	: 'transparent',
	style			: Titanium.UI.iPhone.TableViewStyle.GROUPED
});
win.add(tableview);

// ----- Create an event listener for the tableView ----- //
tableview.addEventListener('click', function(e) {
	/**
	 * Here we're creating a new window to open when a row is clicked
	 * this will load another javascript page to be used for the window
	 */	
	var reviews_window = Titanium.UI.createWindow({  
		/**
		 * The title to set for the new window.  In this case it loads the text from the 2 item / label
		 * in the row
		 */
	    title			: e.rowData.title,
		url				: e.rowData.page + '.js',	// The file to use for the new window
		barColor		: '#050505',
		backgroundColor	: '#050505'
	});
	
	// Pass the row data to the new window for use
	reviews_window.data = e.rowData;
	
	// Open the window in the current tab
	Titanium.UI.currentTab.open(reviews_window, { animated:true });
});

