﻿Ext.ns('Ldc.utils');

Ldc.utils.createWindow = function(item, e, component, preserve) {
/*	if (!(component instanceof Ext.Component)) {
		component = Ext.ComponentMgr.create(component);
	}*/
	var win = Ext.getCmp('modalWin') || //use again!
	new Ext.Window({
		modal: true,
		id: 'modalWin',
		layout: 'fit',
		hidden: true,
		renderHidden: true
	});

	if (component) {
		win.on('beforeshow', function(W) {
			W.removeAll(preserve !== true);
			W.add(component);
			W.rendered && W.doLayout();
		}, win, { single: true });
	} // else use what's already there
	return win;
}

var testForm = {
xtype: 'form',
url: 'movie-form-submit.php',
frame: true,
title: 'Movie Information Form',
width: 250,
items: [{
xtype: 'textfield',
fieldLabel: 'Title',
name: 'title'
},{
xtype: 'textfield',
fieldLabel: 'Director',
name: 'director'
},{
xtype: 'datefield',
fieldLabel: 'Released',
name: 'released'
}]
}
/*
var newComponent = new appName.xtype.name({
...
});
*/
/*
var win = createWindow(this, false, newComponent, false)
win.show();

Ldc.Membership = function() {
var _isAuthenticated = false;
return {
init: function() {
},
getIsAuthenticated: function() {
return _isAuthenticated;
},
setIsAuthenticated: function(val) {
_isAuthenticated = val;
}
};
} ();

*/