/*
 * Ext.nd JS library 1.0
 * Copyright (c) 2006-2007, ExtND
 * licensing@extjs.com
 * 
 * http://www.extjs.com/license
 */
 
Ext.nd.ACCESS_LEVELS = {
	1: "Depositor",
	2: "Reader",
	3: "Author",
	4: "Editor",
	5: "Designer",
	6: "Manager"
};
 
Ext.nd.DATE_FORMAT = "m/d/Y";
 
Ext.nd.Session = {
	"AddressBooks": ["names.nsf",""],
	"CommonUserName": "Anonymous",
	"CurrentDatabase":{

ACL: {},
CurrentAccessLevel: 2,
FileName: "",
FilePath: "httpConf.nsf",
WebFilePath: "/httpConf.nsf/",
Managers: ["CN=CorporateHQ/O=Garland_IND","CN=HQ-2/O=Garland_IND","CN=GarlandHQ/O=Garland_IND","CN=HQ-3/O=Garland_IND","CN=admin/O=Garland_IND","Administrators","Garland Admins","LocalDomainServers"],
ReplicaID: "852573E1:0025ACEB",
Server: "CN=GarlandHQ/O=Garland_IND",
Title: "HTTP Config",
getDocumentByUNID: function(unid) {
}
	},
	"NotesBuildVersion": "266",
	"Platform": "Windows/32",
	"ServerName": "CN=GarlandHQ/O=Garland_IND",
	"UserName": "Anonymous",
	"UserNameList": ["Anonymous","Anonymous"],
	"UserRoles": ["$$WebClient"],
	"UserGroupNameList": [ {"Abbreviated": " *"} ]
};
Ext.nd.Session.logout= function(){
	this.callBack=function(btn){
		if (btn=="yes"){
			window.setTimeout("location.search='?logout&redirectto='+Ext.nd.Database.WebFilePath", 100);
		}
	};
	Ext.MessageBox.confirm('Logout', 'Are you sure you want to logout?', this.callBack);
};
 
Ext.nd.Session.login= function(){
	var dialog;
	if(!dialog){ // lazy initialize the dialog and only create it once
                dialog = new Ext.BasicDialog("login-dlg", { 
					autoCreate:true,
					title: "Login to "+Ext.nd.Database.Title,
					modal:true,
                        width:250,
                        height:160,
                        shadow:true,
                        resizable:false,
                        proxyDrag: true
                });
                dialog.addKeyListener(27, dialog.hide, dialog);
                dialog.addButton('Login', function(){document.forms['login-form'].submit()}, dialog);
                dialog.addButton('Cancel', dialog.hide, dialog);
			Ext.DomHelper.append(dialog.body, 
				{tag:'form', id:'login-form', action:'names.nsf?Login', method:'POST', 
					children:[
						{tag:'dl', children:[
								{tag:'dt', html:'User Name:'},
								{tag:'dd', children:[{tag:'input', type:'text', name:'username', value:''}]},
								{tag:'dt', html:'Password:'},
								{tag:'dd', children:[
										{tag:'input', type:'password', name:'password', value:''},
										{tag:'input', type:'hidden', name:'redirectto', value:Ext.nd.Database.WebFilePath}
									]
								}
							]
						}
					]
				}
			);
            }
            dialog.show();
};
