var ON_DATA = false;


// 操作窗口控件构建
var dhxWins = new dhtmlXWindows();
dhxWins.enableAutoViewport(false);
dhxWins.setViewport(0, 0, 1, 1);
dhxWins.vp.style.border = "#909090 0px solid";
dhxWins.setImagePath("lib/dhtmlxwindows/codebase/imgs/");


//  冒泡信息
function VDiskBrowser_Popo(msg, xurl)
{
    msg = '<img src=images/msg.gif align=left><a href=#? onclick=VDiskBrowser_DialogOpen("' + xurl + '")>' + msg + '</a>';
		$(document).ready(function(){
		    $.jGrowl(msg, { 
					theme: 'manilla',
					speed: 'slow',
					sticky: ''
			});
		});
}



// 操作窗口被关闭事件
function VDiskBrowser_OnDialogClose()
{
    
}



// 刷新列表
function VDiskBrowser_BasicRefresh()
{
		
}


// 操作窗口关闭
function VDiskBrowser_DialogClose(ref){
		if(ref!=false)	VDiskBrowser_BasicRefresh();
		var winModal = dhxWins.window('w1');
		winModal.close();
		VDiskBrowser_UnLockWEB();
}

// 操作窗口显示
function VDiskBrowser_DialogOpen(xURL)
{
            var xTitle = 'Loading...';
            var winw = 300;
            var winh = 150;
			var winx = (document.body.clientWidth/2) - (winw / 2);
			var winy = (document.body.clientHeight/2) - (winh / 2);
			
			dhxWins.setViewport(0, 0, document.body.offsetWidth, document.body.offsetHeight);
			
			var winModal = dhxWins.window('w1');
			if(winModal == null)	winModal = dhxWins.createWindow("w1", winx, winy, winw, winh);
			//else alert('老窗口');
			
			winModal.attachURL(xURL);
			winModal.setText(xTitle);
			winModal.setMaxDimension("auto", "auto"); 
			winModal.button('minmax1').hide();
			winModal.button('minmax2').hide();
			winModal.button('stick').hide();
			winModal.button('park').hide();
			winModal.denyResize();
			winModal.setModal(true);
			VDiskBrowser_LockWEB();
			
			
			winModal.attachEvent("onClose", function(win){
				dhxWins.setViewport(0, 0, 0, 0);
				VDiskBrowser_UnLockWEB();
		        VDiskBrowser_OnDialogClose();
		        VDiskBrowser_OnDialogClose = function(){};
				return true;
			});
}


// 操作窗口重新设置大小
function VDiskBrowser_DialogReset(winw, winh, ti)
{
		var winModal = dhxWins.window('w1');
		if(winModal)
		{
			var winx = (document.body.clientWidth/2) - (winw / 2);
			var winy = (document.body.clientHeight/2) - (winh / 2);
			winModal.setPosition(winx, winy);
			winModal.setDimension(winw, winh);
			if(ti)	winModal.setText(ti);
		}
}



// 显示正在载入数据
function VDiskBrowser_ShowLoading(dis)
{
		try{
		ON_DATA = true;
		document.getElementById('LOADINGPANLE').innerHTML = '正在获取数据,请稍候... ';
		setTimeout("if(ON_DATA)	VDiskBrowser_LockWEB(true)", 3000);
		} catch (E) {}
}

// 取消显示正载入数据
function VDiskBrowser_UnShowLoading()
{
		try{
		ON_DATA = false;
		VDiskBrowser_UnLockWEB();
		document.getElementById('LOADINGPANLE').innerHTML = '';
		} catch (E) {}
}

// 禁止操作
function VDiskBrowser_LockWEB(showcannel)
{
		try{
			if(showcannel)
			{
				var y = document.body.clientHeight / 2 - 100;
				var x = document.body.clientWidth / 2 - 100;
				document.getElementById('DOODIV').innerHTML = '<div style="text-align:center; position: absolute; top:'+y+'px; left: '+x+'px;"><img src="images/loading.gif"><p>正在获取数据,请稍候...</div>';
			}
			else	document.getElementById('DOODIV').innerHTML = '';
			document.getElementById('DOODIV').style.display='block'
		} catch (E) {}
	
}

// 停止禁止操作
function VDiskBrowser_UnLockWEB()
{
		try{
			document.getElementById('DOODIV').innerHTML = '';
			document.getElementById('DOODIV').style.display='none'
		} catch (E) {}
	
}



