function toggleDiv(idDiv)
//IN:  the ID of the DIV we are collapsing/expanding
{
	theDIV = document.getElementById(idDiv);
	
	if (theDIV.style.display == "block")
	{
		theDIV.style.display = "none";
	}
	else
	{
		theDIV.style.display = "block";
	}
}

function toggleManyTrs(idTr, intNum)
{
	for(x = 0; x < intNum; x++)
	{
		currTr = document.getElementById(idTr + x);
		if(currTr && currTr.style.backgroundColor != 'red') {
			firstTr = currTr;
			break;
		}
	}
	
	var ie4 = document.all;
	
	if(ie4)
	{
		if(firstTr.style.display == "inline")
			newDisplay = "none";
		else
			newDisplay = "inline";
	}
	else
	{
		if(firstTr.style.display == "table-row")
			newDisplay = "none";
		else
			newDisplay = "table-row";
	}

	for(x = 0; x < intNum; x++)
	{
		currTr = document.getElementById(idTr + x);
		if(currTr && currTr.style.backgroundColor != 'red') {
			currTr.style.display = newDisplay;
		}
	}
}

function toggleTr(idTr)
//IN:  the ID of the TR we are collapsing/expanding
{
	theTR = document.getElementById(idTr);
	var ie4 = document.all;
	var ns4 = document.layers;
	var ns6 = document.getElementById && !document.all;
	
	if(ie4)
	{
		if(theTR.style.display == "inline")
			theTR.style.display = "none";
		else
			theTR.style.display = "inline";
	}
	else
	{
		if(theTR.style.display == "table-row")
			theTR.style.display = "none";
		else
			theTR.style.display = "table-row";
	}
}


var popUpWin=0;
function popUpWindow(URLStr, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left=5,top=5,screenX=5,screenY=5');
}

function disableCtrlModifer(evt)
{
var disabled = {a:0, c:0, x:0, p:0};
var ctrlMod = (window.event)? window.event.ctrlKey : evt.ctrlKey;
var key = (window.event)? window.event.keyCode : evt.which;
key = String.fromCharCode(key).toLowerCase();
return (ctrlMod && (key in disabled))? false : true;
}



window.onload = function() {
	if(window.document.getElementById('moduleMaterial'))
	{
		var element = window.document.getElementById('moduleMaterial');
		element.onselectstart = function () { return false; } // ie
		element.onmousedown = function () { return null; } // mozilla
	}
}

function selectAllItems() {
	checked = window.document.getElementById('selectAllBox').checked;
	els = window.document.getElementsByName('ordermod_id[]');
	for(var i=0;i<els.length;i++)
		els[i].checked = checked;
}