//
//  showProfit.js
//  SugLisSystem
//
//  Created by Mr.Right on 2013-04-19.
//  Copyright 2013 Mr.Right. All rights reserved.
//

function create(param) {
	var win = Ti.UI.createWindow();

	var profitWebView = Ti.UI.createWebView({
		left : 0,
		top : 0,
		width : '100%',
		height : '97%',

	});

	if (param.url == null || param.url == '') {
		profitWebView.html = param.data;
	} else {
		profitWebView.url = param.url;
		profitWebView.addEventListener('load', function() {
			Ti.App.fireEvent('pageReady', {
				id : param.data
			});
		})
	}
	win.add(profitWebView);

	var doneButton = Ti.UI.createButton({
		title : '完成',
		width : '97%',
		height : '3%',
		bottom : 0
	});
	doneButton.addEventListener('click', function() {
		win.close();
	});
	win.add(doneButton);
	return win;
}

exports.create = create;
