//******************************************************************************
//Registration.js v 1.0
//
//Utilities for Online Registration
//******************************************************************************

function UpdateOrFinalize(UpdateFinalizeOrContinue)
{
	document.forms[0].SubmitAction.value = UpdateFinalizeOrContinue; 
	document.forms[0].submit();
}
	
function SubmitPage(PeopleCodeID, ActionType, url)
{
	document.forms.registration.action = url;
	document.forms.registration.ActionType.value = ActionType;
	document.forms.registration.PeopleCodeID.value = PeopleCodeID;		
	document.forms.registration.submit();
}

function SubmitYTS(PeopleCodeID)
{
	document.forms.registration.PeopleCodeID.value = PeopleCodeID;
	document.forms.registration.YearTermSelected.value = 'true';
	document.forms.registration.submit();	
}

function GoToNewWin(Script) 
{
	var OldPage = document.forms[0].action;
	document.forms[0].action = Script;
	document.forms[0].target = '_blank';
	document.forms[0].submit();
	document.forms[0].target = '_self';
	document.forms[0].action = OldPage;
}

function OpenInNewWin(Link, ShowMenu, ShowToolbar, NoScroll, NotResizeable)
{
	window.open(Link,'x', 'toolbar=' +  ((ShowToolbar)? '1':'0') + ',location=0,directories=0,status=0,scrollbars=' +  ((NoScroll)? '0':'1') + ',width=600,height=400,resizable=' + 	((NotResizeable)? '0':'1') + ',menubar=' +  ((ShowMenu)? '1':'0'));
}

function openwin_local(WinName) 
{
	window.open('',WinName,'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=600,height=400,resizable=1');
}

function openwin_localnotool(WinName) 
{
	window.open('',WinName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=650,height=450,resizable=1');
} 

function CheckAll()
{
	var checked = (document.forms[0].SelectAll.value == 'Y');
	checked ? (document.forms[0].SelectAll.value = '') : (document.forms[0].SelectAll.value = 'Y');
	for (var i=0;i<document.forms[0].elements.length;i++)
	{
		var e = document.forms[0].elements[i];
		if ((e.name != 'SelectAll') && (e.type=='checkbox') && (! e.disabled))
			e.checked = ! checked;
	}
}

function CheckApproveAll()
{
	//Reset the DeclineAll Radio Button First
	document.forms[0].DeclineAll.value = '';
	var checked = 'true';
	document.forms[0].ApproveAll.value = 'Y';
	for (var i=0;i<document.forms[0].elements.length;i++)
	{
		var e = document.forms[0].elements[i];
		if ((e.name != 'ApproveAll') && (e.type=='radio') && (! e.disabled) && (e.id == 'approveradio'))
			e.checked =  checked;
	}
}

function CheckDeclineAll()
{
	//Reset the ApproveAll Radio Button First
	document.forms[0].ApproveAll.value = '';
	var checked = 'true';
	document.forms[0].DeclineAll.value = 'Y';
	for (var i=0;i<document.forms[0].elements.length;i++)
	{
		var e = document.forms[0].elements[i];
		if ((e.name != 'DeclineAll') && (e.type=='radio') && (! e.disabled) && (e.id == 'declineradio'))
			e.checked = checked;
	}
}