var popup_windows = new Array();
var wi = 0;
function OpenPopUp(DocumentName, Width, Height, Resizeable, Scrollbars, Status, Toolbar, Menubar, Location, Directories)
{
	var window_width = Width;
	var window_height = Height;
	var window_left = (screen.width - window_width)/2;
 	var window_top = (screen.height - window_height)/2 - 20;

	var d = new Date();
	WindowName = "w" + d.getTime();

	popup_windows[wi++] = window.open(DocumentName, WindowName,
	"top=" + window_top + ",left=" + window_left + ",width=" + window_width + ",height=" + window_height + ",resizable=" + Resizeable + ",scrollbars=" + Scrollbars + ",status=" + Status + ",toolbar=" + Toolbar + ",menubar=" + Menubar + ",location=" + Location + ",directories=" + Directories + "");
}

function disableForm()
{
	for (j=0; j < document.forms[0].elements.length; j++)
		document.forms[0].elements[j].disabled = true;
}

function enableForm()
{
	for (j=0; j < document.forms[0].elements.length; j++)
		document.forms[0].elements[j].disabled = false;
}

function moveSelected(fbox, tbox)
{
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++)
	{
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length;
	for (i = 0; i < fbox.options.length; i++)
	{
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].selected && fbox.options[i].value != "")
		{
			arrTbox[tLength] = fbox.options[i].text;
			tLength++;
		}
		else
		{
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
		}
	}
	arrFbox.sort();
	arrTbox.sort();
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c = 0; c < arrFbox.length; c++)
	{
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	for(c = 0; c < arrTbox.length; c++)
	{
		var no = new Option();
		no.value = arrLookup[arrTbox[c]];
		no.text = arrTbox[c];
		tbox[c] = no;
	}
}