function Workspace(selector, footer) {
	this.workspace = $(selector).get(0);
	this.footer = new Footer(footer);
	
	this.leftContent = null;
	this.rightContent = null;
	this.logo = null;

	this.disabled = true;
	
	this.createContentHolders = function() {
		this.leftContent = new ContentHolder('left');
		this.rightContent = new ContentHolder('right');
		
		$(this.workspace).append(this.leftContent.obj);
		$(this.workspace).append(this.rightContent.obj);
	}
	
	this.fit = function() {
		this.selfFit();
		this.footer.fit();
		if (this.leftContent != null) this.leftContent.fit();
		if (this.rightContent != null) this.rightContent.fit(this.leftContent.obj.offsetWidth);
		if (this.logo != null) this.logo.fit();
	}
	
	this.selfFit = function() {
		var newWidth = $(window).width();
		/*if (this.leftContent != null && this.rightContent != null) {
			if (newWidth < $(this.leftContent.obj).outerWidth() + $(this.rightContent.obj).outerWidth())
				newWidth = $(this.leftContent.obj).outerWidth() + $(this.rightContent.obj).outerWidth();
		}*/
		
		var newHeight = $(window).height()-$(this.footer.obj).outerHeight();
		
		$(this.workspace).css('width',newWidth);
		$(this.workspace).css('height',newHeight);
	}
	
	this.createLogo = function() {
		this.logo = project.Library('.center-logo');
		this.logo.show = function(delay) {
			var o = this;
			this.showTimeout = setTimeout(function(){
				$(o).stop().css('display','block').animate({opacity:1},400,"easeOutQuart");
			},delay);
		}
		this.logo.hide = function() {
			clearTimeout(this.showTimeout);
			$(this).stop().animate({opacity:0},400,"easeInQuart",function(){$(this).css('display','none');});
		}
		this.logo.fit = function() {
			var newLeft = ($(this).parent().width() - $(this).outerWidth()) / 2;
			var newTop = ($(this).parent().height() - $(this).outerHeight()) / 2;
			$(this).css('left',newLeft).css('top',newTop);
		}
		$(this.workspace).append(this.logo);
	}
	
	this.initialize = function() {
		this.createContentHolders();
		this.fit();
		this.logo.show();
		this.enable();
	}
	
	this.openAsParent = function(node) {
		var delay;
		delay = this.rightContent.unload();
		delay = this.rightContent.fillWith(this.leftContent,delay);
		this.leftContent.load(node.parentNode,delay);
	}
	this.openAsChild = function(node) {
		if (this.rightContent.node == null) this.openAsOther(node);
		else {
			var delay;
			delay = this.leftContent.unload();
			delay = this.leftContent.fillWith(this.rightContent,delay);
			this.rightContent.load(node, delay);
			this.logo.hide();
			this.rightContent.reloadSelectedItem(node.id);
		}
	}
	
	this.openAsSibling = function(node) {
		var delay;
		delay = this.rightContent.unload();
		this.rightContent.load(node,delay);
		this.leftContent.reloadSelectedItem(node.id);
	}
	
	this.openAsOther = function(node) {
		var delay1 = this.leftContent.unload();
		var delay2 = this.rightContent.unload();
		var delay = (delay1 > delay2) ? delay1 : delay2;
		this.leftContent.load(node.parentNode,delay);
		this.rightContent.load(node,delay);
		this.logo.hide();
	}
	
	this.openMainMenu = function() {
		var delay;

		delay = this.rightContent.unload();
		
		if (this.leftContent.node==null) delay = this.rightContent.load(project.Content,delay);
		else delay = this.rightContent.fillWith(this.leftContent,delay);
		
		this.logo.show(delay);
	}
	
	this.enable = function() {
		this.disabled = false;
	}
	
	this.disable = function() {
		this.disabled = true;
	}
	
	$(window).bind('resize',function(){
		project.Workspace.fit();
	});
	this.createLogo();
	this.fit();
}