var logindlg;
var registerdlg;

var loginClicked;
var registerClicked;
var currOpenDialog;

Ext.onReady(function() {
	loginClicked = function(e) {
		showDialog(logindlg);
	};

	registerClicked = function(e) {
		showDialog(registerdlg);
	};

	logindlg = newExtWindow('logindialog');
	registerdlg = newExtWindow('registerdialog');

	/*Ext.get('registertoggle').on('click', registerClicked);*/
	Ext.get('logintoggle').on('click', loginClicked);
});

function newSizedExtWindow(content, width, height){
	return new Ext.Window({
		layout: 'fit',
		width: width,
		height: height,
		modal: true,
		closeAction: 'hide',
		plain: true,
		frame: false,
		border: false,
		draggable: false,
		resizable: false,
		header: false,
		closable: false,
		shadowOffset: 15,
		shadow: 'frame',
		/*autoScroll: true,*/
		items: new Ext.Panel({
			contentEl: content ,
			/*autoScroll: true,*/
			border: false
		})
	});
};

function newExtWindow(content){
	return newSizedExtWindow(content,700,550);	
}

function closeDialog(){
	if (currOpenDialog) {
		currOpenDialog.hide();
	}
};
function showDialog(dialog){
	if (dialog) {
		currOpenDialog = dialog;
		dialog.show();
	}
}
