
function MoveNormOrder(FromNorm, ToNorm)
{
	ToNormTmp = document.getElementById('ThisNorm_'+ToNorm).value
	FromNormTmp = document.getElementById('ThisNorm_'+FromNorm).value
	document.getElementById('ThisNorm_'+ToNorm).value = FromNormTmp;
	document.getElementById('ThisNorm_'+FromNorm).value = ToNormTmp;
	document.form1.submit();
}

function DeleteNormOrder(NormOrderNum)
{
	document.form1.DeleteThisNormOrderNOW.value = NormOrderNum;
	document.form1.submit();
}

function InsertBiographics(ID)
{
	document.form1.InsertBiogHere.value = ID;
	document.form1.submit();
}


function DeleteDomain(Domain)
{
	var DEL = confirm("Are you sure you want to delete "+Domain+"?");
	if(DEL)
	{
		document.form1.Del_Domain.value = Domain;
		document.form1.submit();
	}
}

function DuplicateDomain(OldName)
{
	var NewName=prompt("Please enter a new domain name: ", OldName);
	if(NewName != null)
	{
		if( (NewName != OldName) && (NewName != "") )
		{
			document.form1.Dup_Domain.value = NewName;
			document.form1.submit();
		}
		else
		{
			alert('You need to enter a new name for the domain.');
		}
	}
}

function AddBiographics()
{
	document.form1.AddBiog.value = "Yes";
	document.form1.submit();
}

function DelBiographics(BIOGID)
{
	document.form1.DelBiog.value = BIOGID;
	document.form1.submit();
}

function CheckQ()
{
	var FormValid = true;
	for (allQ = parseInt(document.form1.StartQ.value); allQ <= parseInt(document.form1.EndQ.value); allQ++)
	{
		var RadioSelected = false;
		var ThisQ = "q" + allQ;
		RadioSelected = CheckRadioButton(ThisQ);
		if( (RadioSelected ==  false) && (FormValid == true) )
		{
			document.form1["q" + document.form1.StartQ.value][0].focus();
			document.form1[ThisQ][0].focus();
			if(document.form1['ALT'].value == "Yes")
			{
				alert(document.form1.ErrorTXT.value + '' + document.form1['ALT-' + ThisQ].value + '.');
			}
			else
			{
				alert(document.form1.ErrorTXT.value + '' + allQ + '.');
			}
			FormValid = false;
		}
	}
	if(FormValid == true)
	{
		document.form1.submit();
	}
}

function CheckType()
{
	var FormValid = true;
	for (allQ = parseInt(document.form1.TypeQ.value); allQ <= parseInt(document.form1.EndQ.value); allQ++)
	{
		var RadioSelected = false;
		var ThisQ = "q" + allQ;
		RadioSelected = CheckRadioButton(ThisQ);
		if( (RadioSelected ==  false) && (FormValid == true) )
		{
			document.form1["q" + document.form1.TypeQ.value][0].focus();
			document.form1[ThisQ][0].focus();
			if(document.form1['ALT'].value == "Yes")
			{
				alert(document.form1.ErrorTXT.value + '' + document.form1['ALT-' + ThisQ].value + '.');
			}
			else
			{
				alert(document.form1.ErrorTXT.value + '' + allQ + '.');
			}
			FormValid = false;
		}
	}
	if(FormValid == true)
	{
		document.form1.submit();
	}
}

function CheckRadioButton(ThisQ)
{
	var RadioSelected = false;
	for (counter = 0; counter < document.form1[ThisQ].length; counter++)
	{
		if (document.form1[ThisQ][counter].checked)
		{
			RadioSelected = true; 
		}
	}
	return RadioSelected;
}

function ClearAll()
{
	var startQ = parseInt(document.form1.StartQ.value);
	var endQ = parseInt(document.form1.EndQ.value);
	for (allQ = startQ; allQ <= endQ; allQ++)
	{
		var ThisQ = "q" + allQ;
		for (counter = 0; counter < document.form1[ThisQ].length; counter++)
		{
			var random_num = parseInt((Math.random()*parseInt(document.form1[ThisQ].length)));
			document.form1[ThisQ][random_num].checked = true;
		}
	}
}

myWindows = new Array();
function clientwin(URL, name)
{
	var i = myWindows.length;
	// if (subWin != null && subWin.open) subWin.close();
	var winleft = 60;
	var wintop = 10;
	var width = screen.width - 120;
	var height = screen.height - 200;
	myWindows[i]=name;
	myWindows[i]=window.open(URL, name,
				"width="
				+width
				+", height="
				+height
				+", top = "
				+wintop
				+", left="
				+winleft
				+",location=yes, status=yes, menubar=yes, toolbar=yes, scrollbars=yes, resizable=yes");
}
function ChangeDomain()
{
	newshowModelessDialog('/SiftWait.htm', 'plswait', 400, 300);
	document.form1.submit();
}

function newshowModelessDialog(URL, name, width, height)
{
	var i = myWindows.length;
	var TheseArgs = "dialogWidth:"+width+"px; dialogHeight:"+height+"px; help: No; resizable: Yes; status: No; center: Yes;"
	myWindows[i]=name;
	myWindows[i]=window.showModelessDialog(URL, name, TheseArgs);
	
}
function newshowModalDialog(URL, name, width, height)
{
	var i = myWindows.length;
	var TheseArgs = "dialogWidth:"+width+"px; dialogHeight:"+height+"px; help: No; resizable: Yes; status: No; center: Yes;"
	myWindows[i]=name;
	myWindows[i]=window.showModalDialog(URL, name, TheseArgs);
	
}


