var g_popDivMinHeight = 400;
var g_popDivInitHeight = -1;
function popDivList(w,h,title)
{
	//ListAllDevsOnLAN();	
	g_popDivInitHeight = h;
	var dObj = document.getElementById("div_pop_list");
	var dObjBk = document.getElementById("div_pop_list_bk");	
	dObj.style.width = w + "px";
	dObj.style.height = h + "px";
	dObjBk.style.width = w + "px";
	dObjBk.style.height = h + "px";
	var tab = document.getElementById("tab_pop_list");
	var tabPack = document.getElementById("div_pop_list_tab_pack");
	var popTitle = document.getElementById("div_pop_title");
	popTitle.innerText = title;
	dObj.style.display = "block";	
	//dObj.style.width = w + "px";	
	//dObj.style.height = h + "px";	
	//tabPack.style.height = (h - 30) + "px";	
	
	
	dObjBk.style.display = "block";	
	//dObjBk.style.width = w + "px";	
	//dObjBk.style.height = h + "px";	
	
	tab.width = "100%";
	var dPage = getPageDisplaySize();
	//左侧菜单宽度
/*	var leftMargin = 280 + 4;
	dObj.style.left = parseInt((dPage.w - w - leftMargin)/2,10) + leftMargin; 
	dObj.style.top = parseInt((dPage.h - h)/2,10); 
	dObjBk.style.left = dObj.style.left;
	dObjBk.style.top = dObj.style.top;*/
	
	resizePopDivList(w,h,true);
	
}
var g_countResizeTimes = 0;
function resizePopDivList(w,h,isInit)
{	
	if(!isInit & g_countResizeTimes == 0)
		g_countResizeTimes = 1;
	else
		g_countResizeTimes = 0;
	
	var dPage = getPageDisplaySize();
	//alert(((g_initDisplayPageObj == null)?"":g_initDisplayPageObj.w)+" == "+dPage.w);
	if(g_initDisplayPageObj == null)
	{
		return;
	}
	var dObjMask = document.getElementById("div_pop_list_mask");
	var dObjBk = document.getElementById("div_pop_list_bk");
	var dObj = document.getElementById("div_pop_list");	
	var tabPack = document.getElementById("div_pop_list_tab_pack");
	
	var bkInitWidth = (dObjBk.style.width).replace("px","")
	var bkInitHeight = (dObjBk.style.height).replace("px","")
	
	bkInitWidth = (w == -1)?bkInitWidth:w;
	bkInitHeight = (h == -1)?bkInitHeight:h;
	//alert(w+"--"+h+isInit+"{"+g_initDisplayPageObj.h+" - "+dPage.h);
	var initLeftMargin = 280 + 4;
	var bkCurrentWidth = -1;
	if(w == -1)
	{
		var spanW = g_initDisplayPageObj.w - dPage.w;
		bkCurrentWidth = bkInitWidth - spanW;
	}
	else
	{
		var forcastWidth = dPage.w - initLeftMargin - 114;
		bkCurrentWidth = (bkInitWidth > forcastWidth)?forcastWidth:bkInitWidth; 
	}
	//alert(w + " = 【" + bkInitWidth +" - (" + g_initDisplayPageObj.w+" - "+dPage.w+") = "+bkCurrentWidth+"】 - "+dPage.w+",,bkCurrentWidth = "+bkCurrentWidth);
	
	var dValue = g_initDisplayPageObj.h - dPage.h;
	bkInitHeight = (dValue == 0 & g_popDivInitHeight != -1)?g_popDivInitHeight:bkInitHeight;//alert(bkInitHeight+" - "+dValue+"********"+g_initDisplayPageObj.w+" - "+dPage.w);
	var bkCurrentHeight = bkInitHeight - ((dValue<0)?0:dValue);
	bkCurrentHeight = (bkCurrentHeight < g_popDivMinHeight)?g_popDivMinHeight:bkCurrentHeight;
	tabPack.style.height = (bkCurrentHeight - (34)) + "px";	
	
	if(bkCurrentWidth < 0)
		return;
	
//	if(g_initDisplayPageObj.w == dPage.w & !isInit)
//		return;
	
	dObjBk.style.width = bkCurrentWidth +"px";//alert("bkCurrentWidth = "+bkCurrentWidth + " = " +dObjBk.style.width);
	dObj.style.width = dObjBk.style.width;
	dObjBk.style.height = bkCurrentHeight +"px";
	dObj.style.height = dObjBk.style.height;
	if(dObjMask != null)
	{
		dObjMask.style.width = dPage.w +"px";
		dObjMask.style.height = dPage.h +"px";
	}
	
	dObjBk.style.top = parseInt((dPage.h - bkCurrentHeight)/2,10);
	dObj.style.top = dObjBk.style.top;	
	
	
	dObj.style.left = parseInt((dPage.w - bkCurrentWidth - initLeftMargin)/2,10) + initLeftMargin; 
	dObjBk.style.left = dObj.style.left;
	
	g_initDisplayPageObj = getPageDisplaySize();	
}
function popListOnload(div)
{
	div.scrollTop = 0;
}