function checkAll(sender)
{
	var els = document.getElementsByName("ids");
	
	for (var i=0;i<els.length;i++)
	{
		var e = els[i];
		
		e.checked = sender.checked;
		//if (e.Name != "chkAll" && e.disabled==false)
		//	e.checked = form.chkAll.checked;
	}
}

function showAdd()
{
	var container = document.getElementById("body");

	container.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=50,finishOpacity=50)";
	container.style.opacity = "0.5";

	document.getElementById("add").style.display = '';
}

function hideAdd()
{
	var container = document.getElementById("body");

	container.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=50,finishOpacity=50)";
	container.style.opacity = "1";

document.getElementById("add").style.display = 'none';
}

function hidePopup()
{
	document.getElementById("popup").style.display = 'none';
	document.getElementById("popup_shim").style.display = 'none';

	//显示select
	/*
	for (i in goSelectTag)
	{
		goSelectTag[i].style.display = "";
	}
	goSelectTag.length = 0;
	*/
}

var goSelectTag = new Array();

function popUp(sender, content)
{
	//隐藏select
	/*
	with (document.all.tags("SELECT"))
	{
		for (i=0; i<length; i++)
		{
			//if( item(i).Victor != "Won" && fTagInBound(item(i)) )
			//{
				item(i).style.display = "none";
				
				goSelectTag[goSelectTag.length] = item(i);
			//}
		}
	}
	*/
	var point = fGetXY(sender);
					   
	var popup = document.getElementById("popup");
	var shim  = document.getElementById("popup_shim");
	
	document.getElementById("popup_content").innerHTML = content;

	//坐标
	var left = point.x + 25; 
	var top  = point.y + 15;
	
	if( left + popup.offsetWidth > document.body.offsetWidth )
		left = point.x - popup.offsetWidth;
		
	if( left < 50 )
		left = 50;
		
	if( top + popup.offsetHeight > document.body.offsetHeight )
		top = point.y - popup.offsetHeight;
	
	if( top < 50 )
		top = 50;

	//div
	popup.style.left = left;
	popup.style.top  = top;//point.y + 15;
	popup.style.display = "block";

	//设置iframe
	shim.style.width 	= popup.offsetWidth;
	shim.style.height 	= popup.offsetHeight;
	shim.style.top 		= popup.style.top;
	shim.style.left 	= popup.style.left;
	shim.style.zIndex 	= popup.style.zIndex - 1;
	shim.style.display 	= "block";
}

var x, y;

function Point(iX, iY){
	this.x = iX;
	this.y = iY;
}

function fGetXY(ctrl)
{
	var oTmp = ctrl;
	var pt = new Point(0,0);
	
	do 
	{
		pt.x += oTmp.offsetLeft;
		pt.y += oTmp.offsetTop;
		oTmp = oTmp.offsetParent;
	}
	while(oTmp.tagName!="BODY");
	
	return pt;
}

function fTagInBound(aTag){
	with (popup.style){
		var l = parseInt(left);
		var t = parseInt(top);
		var r = l+parseInt(width);
		var b = t+parseInt(height);
		var ptLT = fGetXY(aTag);
		return !((ptLT.x>r)||(ptLT.x+aTag.offsetWidth<l)||(ptLT.y>b)||(ptLT.y+aTag.offsetHeight<t));
	}
}

function printFrame()
{
	parent.list.focus(); 
	parent.list.print();  
}
