<!-- 
	
	function doPop (link)
	{
		var popWnd;
		
		popWnd = window.open (link, 'wndPop', 'height=250,width=750,status=no,titlebar=no,resizable=yes,dependent=yes,scrollbars=yes');
		popWnd.focus();
	}

	function clearText (cbo, txt)
	{
		if (txt && cbo && !cbo.checked) {
			txt.value = "";
		}
	}

	function doUpload (theForm, ev)
	{
		if (ev == "UPLOAD") {					//	Adding a new upload.
			theForm.action = "./procs/document.asp";
			theForm.encoding = "multipart/form-data";
		}
		else {									//	Adding, but not doing an upload ('Back' button)
			theForm.action = "./document.asp";
		}
		
		doEvent (theForm, ev);
	}

	function doUploadMerger (theForm, ev)
	{
		if (ev == "UPLOAD") {					//	Adding a new upload.
			theForm.action = "./procs/documentmerger.asp";
			theForm.encoding = "multipart/form-data";
		}
		else {									//	Adding, but not doing an upload ('Back' button)
			theForm.action = "./document.asp";
		}
		
		doEvent (theForm, ev);
	}
	
	function doUploadInternal (theForm, ev)
	{
		if (ev == "UPLOAD") {					//	Adding a new upload.
			theForm.action = "./procs/documentinternal.asp";
			theForm.encoding = "multipart/form-data";
		}
		else {									//	Adding, but not doing an upload ('Back' button)
			theForm.action = "./documentinternal.asp";
		}
		
		doEvent (theForm, ev);
	}
		
	function doEventWithRedirect (theForm, ev, newAction)
	{
		var argv = arguments;
		var argc = arguments.length;
		var isPostBack = argc > 3 ? argv[3] : "True";
		
		theForm.action = newAction;
		doEvent (theForm, ev, isPostBack);
	}

	function doEvent (theForm, ev)
	{
		var argv = arguments;
		var argc = arguments.length;
		var isPostBack = argc > 2 ? argv[2] : "True";
		
		if (theForm._SCROLL_Y && (ev == "CHANGE")) {
			if (theForm.document.body) {
				// MSIE
				theForm._SCROLL_Y.value = document.body.scrollTop;
			}
			else {
				// NN
				theForm._SCROLL_Y.value = window.pageYOffset;
			}
		}
		
 		if (theForm.ev) {
			theForm.ev.value = ev;
			theForm.src.value = theForm.name;
			theForm.IsPostBack.value = isPostBack;
			theForm.submit();
		}
	}
	
	function submitOrNot (theForm)
	{
		if (theForm.pqs) {
			if (theForm.pqs.options[theForm.pqs.selectedIndex].value != "") {
				doEvent (theForm, 'GO');
			}
		}
	}

	function rememberPass()
	{
		if (document.frmLogin.cboRememberMe && document.frmLogin.cboRememberMe.checked) {
			var msg;
			
			msg = "WARNING:\n\n";
			msg += "Ticking this box allows this site to remember your password and means \nthat you won't have to type it in each time you visit.\n\n";
			msg += "Don't use this option unless you are the only person who has access to \nthis computer.\n\n";

			if (!confirm (msg)) {
				document.frmLogin.cboRememberMe.checked = false;
			}
		}
	}
	
	function buildArray()
	{
		var a = buildArray.arguments;
		
		for (i=0; i<a.length;i++) {
			this[i] = a[i];
		}
		
		this.length = a.length;
	}

	function go (which, num, win)
	{
		n = which.selectedIndex;
		
		if (n != 0) {
			var url = eval ("urls" + num + "[n]")
			
			if (win) {
				openWindow(url);
			}
			else {
				location.href=url;
			}
		}
	}
	
	function scrollY (YPos)
	{
		if (YPos > 0) {
			// Scroll the window by this amount.
			window.scrollBy (0, YPos);
		}
	}

	function toggleAll (cbo, multi)
	{
		var iLoop;
		
		for (iLoop = 0; iLoop < multi.options.length; iLoop++) {
			if (cbo.checked) {
				multi.options[iLoop].selected = true;
			}
			else {
				multi.options[iLoop].selected = false;
			}			
		}
	}

	function cascadeMulti (srcMulti, destMulti, lnkArr, srcArr, destArr, srcCbo, destCbo, parentNoun, newSearch)
	{
		var old_selections;
		var aDest;
		var iOtherId = -1; 
		var allSelected;
		var new_index;
		var new_value;
		var new_name;
		var any_selected;
		any_selected = false;
		allSelected = true;
		anySelected = false;
		aOptions = new Array();
		aDest = new Array();
		
		// clear the child option list
		destMulti.options.length = 0

		for (iLoop = 0; iLoop < srcMulti.options.length; iLoop++) {
			if (srcMulti.options[iLoop].selected) {
				anySelected = true;
				break;
			}
		}

		if (!anySelected) {
			// no options selected in parent multi - set the option of the child multi explicitly.
			destMulti.options[0] = new Option('Select a ' + parentNoun + ' first', '0', false, false);
		}
		else {
			for (iLoop = 0; iLoop < srcMulti.options.length; iLoop++) {
				if (srcMulti.options[iLoop].selected) {
					iCurrSource = srcMulti.options[iLoop].value;
					for (destArrLoop in lnkArr[iCurrSource]) {
						aOptions[destArrLoop] = destArrLoop;
					}
				}
			}
					
			// we now have a list of all the combined children options
			// put them into a new array and sort them, use this
			// to populate the option list
			sortedOptions = new Array();
			sortIndex=0;
			for (iLoop in aOptions) {
				if (aOptions[iLoop] != null) {
					sortedOptions[sortIndex] = aOptions[iLoop];
					sortIndex = sortIndex + 1;
				}
			}
	
			sortedOptions.sort(numberorder);
	
			//Array to hold the disciplineID/Desc values for the Industries selected
			var DiscArray = new Array(sortIndex);	
			for (i=0; i <sortIndex; i++) {
				DiscArray[i]=new Array(1);
				DiscArray[i][0]=destArr[sortedOptions[i]];
				DiscArray[i][1]=sortedOptions[i];
			}
	
			//sort the array in alphabetical order	
			DiscArray.sort();	

			//Load the Discipline list with the sorted list
			for (i=0;i<DiscArray.length;i++) {
				new_index = destMulti.options.length;
				destMulti.options[new_index] = 
				new Option(DiscArray[i][0], DiscArray[i][1]);
			}

			// we've just changed the contents of the parent multi so the child multi can't have all options selected -
			// clear the child multi's 'All' cbo.
			destCbo.checked = false;
		}

		validateMulti (srcMulti, srcCbo);
	}
	
	function validateMulti (multi, cbo)
	{
		var anySelected;
		var allSelected;
		
		if (multi.options.length == 0) {
			anySelected = false;
			allSelected = false;
		}
		else {
			anySelected = false;
			allSelected = true;

			for (iLoop = 0; iLoop < multi.options.length; iLoop++) {
				if (multi.options[iLoop].selected) {
					anySelected = true;
				}
				else {
					allSelected = false;
				}
			}
		}
		
		// resolve the state of the cbo based on the contents of the multi.
		if (allSelected && !cbo.checked) {
			cbo.checked = true;
		}
		else if (!allSelected && cbo.checked) {
			cbo.checked = false;
		}
	}
	
	function getBitArray(arrIn)
	{
		var arrOut = new Object();
		
		for (iLoop = 0 ; iLoop < arrIn.length; iLoop++) {
			arrOut[arrIn[iLoop]] = 1;
		}
		
		return(arrOut);
	}

	function numberorder(a, b)
	{
		return a - b;
	}

	function initForm (newSearch)
	{
		validateMulti (document.frmAdvSearch.rgs, document.frmAdvSearch.cboToggleRegion);
		validateMulti (document.frmAdvSearch.los, document.frmAdvSearch.cboToggleLocation);
		validateMulti (document.frmAdvSearch.dis, document.frmAdvSearch.cboToggleDivision);
		validateMulti (document.frmAdvSearch.des, document.frmAdvSearch.cboToggleDepartment);
		validateMulti (document.frmAdvSearch.pts, document.frmAdvSearch.cboTogglePositionType);
		validateMulti (document.frmAdvSearch.ets, document.frmAdvSearch.cboToggleEmploymentType);
		validateMulti (document.frmAdvSearch.ems, document.frmAdvSearch.cboToggleEmploymentMode);
	}
	
		
	function resetForm (theForm)
	{
		clearMulti (theForm.rgs);
		clearMulti (theForm.los);
		clearMulti (theForm.dis);
		clearMulti (theForm.des);
		clearMulti (theForm.pts);
		clearMulti (theForm.ems);
		clearMulti (theForm.ets);
		clearCbo (theForm.cboToggleRegion);
		clearCbo (theForm.cboToggleLocation);
		clearCbo (theForm.cboToggleDivision);
		clearCbo (theForm.cboToggleDepartment);
		clearCbo (theForm.cboTogglePositionType);
		clearCbo (theForm.cboToggleEmploymentType);
		clearCbo (theForm.cboToggleEmploymentMode);
		clearText (theForm.txtFreeText);
	}
	
	function clearText (text)
	{
		if (text) {
			text.value = '';
		}
	}

	function clearMulti (multi)
	{
		if (multi) {
			for (iLoop = 0; iLoop < multi.options.length; iLoop++) {
				multi.options[iLoop].selected = false;
			}
		}
	}
	
	function clearCbo (cbo)
	{
		if (cbo && cbo.checked) {
			cbo.checked = false;
		}
	}

	function ValidateForm (x)
	{
		var strError = "",
			blnReturn = false,
			intCount = 0
	
		// Do the validation.

		if (x.txtRecipientName.value == "")
		{
			strError += (++intCount + ". Please enter your friend's name.\n")
		}

		if (x.txtRecipientEmail.value == "")
		{
			strError += (++intCount + ". Please enter your friend's email address.\n")
		}
		else if (x.txtRecipientEmail.value.indexOf("@") == -1)
		{
			strError += (++intCount + ". Please enter a valid email address for your friend.\n")
		}

		if (x.txtSenderName.value == "")
		{
			strError += (++intCount + ". Please enter your name.\n")
		}

		if (x.txtSenderEmail.value == "")
		{
			strError += (++intCount + ". Please enter your email address.\n")
		}
		else if (x.txtSenderEmail.value.indexOf("@") == -1)
		{
			strError += (++intCount + ". Please ensure that your email address is valid.\n")
		}
		
		if (strError != "")
		{
			var strErrorBPlate
			
			strErrorBPlate = "The following errors were detected on this form.\n"
			strErrorBPlate += "Please correct these errors and resubmit the form to continue.\n\n"
			
			alert (strErrorBPlate + strError)
		}
		else
		{
			blnReturn = true
		}
		
		return blnReturn
	}

	function roundMe (x)
	{
		var intDPAt;
		var intLen;
		var intNumDPs;
		
		if (x && (x.value.toString() != "") && (!isNaN (x.value)))
		{
			intDPAt = x.value.toString().indexOf(".");
			
			if (intDPAt == -1)
			{
				// No decimal point entered - append one.
				x.value = x.value.toString() + ".0";
			}
			else if (intDPAt == 0)
			{
				// Decimal point in first position - prepend "0".
				x.value = "0" + x.value.toString();
			}
			
			intDPAt = x.value.toString().indexOf(".");
			intLen = x.value.toString().length;
			intNumDPs = ((intLen - intDPAt) - 1);

			if (intNumDPs > 1)
			{
				// Truncate to one decimal place if more than one entered.
				x.value = x.value.toString().substr(0, (intDPAt + 2));
			}
		}
	}

// -->


