/*
**  应用码头
*/
EBOS.dock = (function(){
	return {
		getPos : function(callback){
			EBOS.CONFIG.dockPos = 'left';
			EBOS.dock.setPos();
			callback && callback();
			return;
			$.ajax({
				type : 'POST',
				url : ajaxUrl,
				data : 'ac=getDockPos',
				success : function(i){
					EBOS.CONFIG.dockPos = i;
					EBOS.dock.setPos();
					callback && callback();
				}
			});
		},
		setPos : function(){
			//桌面大小设置在此
			var desktop = $('#desk-' + EBOS.CONFIG.desk), desktops = $('#desk .desktop-container');
			var desk_w = desktop.css('width', '100%').width(), desk_h = desktop.css('height', '100%').height();
			//清除dock位置样式
			$('#dock-container').removeClass('dock-top').removeClass('dock-left').removeClass('dock-right');
			$('#dock-bar').removeClass('top-bar').removeClass('left-bar').removeClass('right-bar').hide();
			if(EBOS.CONFIG.dockPos == 'top'){
				$('#dock-bar').addClass('top-bar').children('#dock-container').addClass('dock-top');
				desktops.css({
					'width' : desk_w,
					'height' : desk_h - 143,
					'left' : desk_w,
					'top' : 73
				});
				desktop.css({
					'left' : 0
				});
			}else if(EBOS.CONFIG.dockPos == 'left'){
				$('#dock-bar').addClass('left-bar').children('#dock-container').addClass('dock-left');
				desktops.css({
					'width' : desk_w - 100,
					'height' : desk_h,
					'left' : desk_w + 100,
					'top' : 0
				});
				desktop.css({
					'left' : 100
				});
			}else if(EBOS.CONFIG.dockPos == 'right'){
				$('#dock-bar').addClass('right-bar').children('#dock-container').addClass('dock-right');
				desktops.css({
					'width' : desk_w - 73,
					'height' : desk_h - 70,
					'left' : desk_w,
					'top' : 0
				});
				desktop.css({
					'left' : 0
				});
			}
			$('#dock-bar').show();
			//EBOS.taskbar.resize();
		},
		updatePos : function(pos, callback){
			$.ajax({
				type : 'POST',
				url : ajaxUrl,
				data : 'ac=setDockPos&dock=' + pos,
				success : function(){
					EBOS.CONFIG.dockPos = pos;
					callback && callback();
				}
			});
		}
	}
})();