function checkall(frm,ele)
{
	thefrm= document.getElementById(frm);
	for(var i=0; i<thefrm.elements.length; i++)
		if(thefrm.elements[i].name==ele)
			thefrm.elements[i].checked = true;
}

function uncheckall(frm,ele)
{
	thefrm= document.getElementById(frm);
	for(var i=0; i<thefrm.elements.length; i++)
		if(thefrm.elements[i].name==ele)
			thefrm.elements[i].checked = false;
}

function getarray(frm, ele, locat)
{
	thefrm= document.getElementById(frm);
	
	var s="(";
	for(var i=0; i<thefrm.elements.length; i++)
		if(thefrm.elements[i].name==ele && thefrm.elements[i].checked == true)
		{
			s=s + thefrm.elements[i].value + ",";
		}
		s=s + "-1)";
		if(s!='(-1)')
			//location="gioithieu_code.php?mode=delete_all&ids=" + s;
			location=locat +'&ids=' + s;
}

function myconfirm(frm, ele, locat, msg)
{
	if(confirm(msg))
		getarray(frm, ele, locat);
	else
		return false;
}

//select all element in selection
function selectAll(id)
{
	obj = document.getElementById(id).options;
	for(var i=0; i< obj.length; i++)
		obj[i].selected=true;
	
}
function popwindow(pop,width,height)
{
	var url = pop;
	var wd = width;
	var he = height;

	window.open(url,"","toolbar=0,menubar=0,scrollbars=yes,resizable=no,width=" + wd +",height=" + he + ";")
}
