/**
 * 
 * All content on this website (including text, images, source
 * code and any other original works), unless otherwise noted,
 * is licensed under a Creative Commons License.
 * 
 * http://creativecommons.org/licenses/by-nc-sa/2.5/
 * 
 * Copyright (C) 2004-2010 Open-Xchange, Inc.
 * Mail: info@open-xchange.com 
 * 
 * @author Jan Finsel <jan.finsel@open-xchange.com>
 * 
*/
var myfullname;

function getPersonalFullName() {
	return myfullname;
}
register("Preload",function () {
	initContents("core");	
});

register("OX_Configuration_Set_Empty", function() {
    var id = config.identifier;
	internalCache.getUsers([id], function (resp) {
	    myfullname = resp[id].display_name;
	});
});

function AboutPopup() {
}
AboutPopup.openWindow = function () {
    ox.api.setModal(true);
//	showNode("modal-dialog");
//	$("modal-dialog").style.display="block";
	showNode("global_about");
	centerPopupWindow($("global_about"));
	$("global_about").style.display="block";
}
AboutPopup.closeWindow = function () {
	hideNode("global_about");
	$("global_about").style.display="none";	
	ox.api.setModal(false);
//	hideNode("modal-dialog");
//	$("modal-dialog").style.display="none";
}
function ErrorPopup() {}
    ErrorPopup.ok = function () {
	ErrorPopup.closeWindow();
}

ErrorPopup.openWindow = function (width, height) {
    ox.api.setModal(true);
//	showNode("modal-dialog");
//	$("modal-dialog").style.display="block";
	showNode("error_popup");
	centerPopupWindow($("error_popup"), width, height);
	$("error_popup").style.display = "block";
}
ErrorPopup.closeWindow = function () {
	hideNode("error_popup");
	$("error_popup").style.display="none";
	ox.api.setModal(false);
//	hideNode("modal-dialog");
//	$("modal-dialog").style.display="none";
}
register("Loaded",function() {
	addOnClose($("error_popup"),function() { ErrorPopup.closeWindow() }); 
	addOnClose($("global_about"),function() { AboutPopup.closeWindow() });
	addOnClose($("subscribe_folder"),function() { SubscribeFolder.closeWindow() });
	if(configGetKey("modules.calendar.module")) {	
		register("OX_Before_Create_Calendar",function(object) { rightshandler.checkRights("calendar",activefolder,object); });
		register("OX_Create_Object",default_calendar_create_object);
	}
	if(configGetKey("modules.contacts.module")) {	
		register("OX_Before_Create_Contact",function() { rightshandler.checkRights("contacts",activefolder); });
		register("OX_Before_Create_Distributionlist",function() { rightshandler.checkRights("distributionlist",activefolder); });
		register("OX_Create_Object",createNewContact);
	}
	if(configGetKey("modules.tasks.module")) {
		register("OX_Before_Create_Task",function() { rightshandler.checkRights("tasks",activefolder); });
	}
	if(configGetKey("modules.infostore.module")) {
		register("OX_Before_Create_InfoStore",function() { rightshandler.checkRights("infostore",activefolder); });
		register("OX_Create_Object",openNewInfoPopup);
	}
});
var corewindow=window;
fileloaded();