<!-- Short functions below in alphabetical order for easy Find / Edit. More complex functions are below these...

	function Alerts(strAuthentication,strSourcePage){		//This function is called from Index.asp and pops up applicable alerts...
		if (strAuthentication == 'Failed'){
			alert('Sorry, but the submitted Login was not found; please try again. If you are a registered User and require further assistance please contact us on 0207 257 6260.');
			document.location.href = strSourcePage;}}
	
	function Confirm_Action(URL,Msg){	//Function called when Buttons clicked to confirm action before loading the button URL...
		if (confirm(Msg) == true) {location.href = URL;} else {return false;}}
	
	function Date_Reset(fieldname){document.getElementById(fieldname).value = 'dd/mm/yyyy';} //Resets a Date field to dd/mm/yyyy...
	
	function FilterPage(strSourcePage,strSearch,strSubID,strTable,strOrderBy,strPages){
		var strFilter = document.getElementById('Filter').value;
		var strURL = strSourcePage + '?Filter=' + strFilter + '&Search=' + strSearch + '&SubID=' + strSubID;
		strURL = strURL + '&Table=' + strTable + '&OrderBy=' + strOrderBy + '&Pages=' + strPages;
		document.location.href = strURL;}
		
	function FormatCurrency(strValue){
		strValue = strValue.toString().replace(/\£|\,/g,'');
		dblValue = parseFloat(strValue);
		blnSign = (dblValue == (dblValue = Math.abs(dblValue)));
		dblValue = Math.floor(dblValue*100+0.50000000001);
		intPence = dblValue%100;
		strPence = intPence.toString();
		dblValue = Math.floor(dblValue/100).toString();
		if(intPence<10)
			strPence = "0" + strPence;
		for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
			dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
			dblValue.substring(dblValue.length-(4*i+3));
		return (((blnSign)?'':'-') + '£' + dblValue + '.' + strPence);}
		
	function getValue(num)
	{
		var noJunk = ""
		var withDollar = ""
		var foundDecimal = 0
		var foundAlphaChar = 0
		num += "";
	
		if (num == "") { return(0); }
		for (i=0; i <= num.length; i++)
		{
			var thisChar = num.substring(i, i+1);
			if (thisChar == ".")
			{
			  foundDecimal = 1;
			  noJunk = noJunk + thisChar;
			}
			if ((thisChar < "0") || (thisChar > "9"))
			{
			  if ((thisChar != "$") && (thisChar !=".") && (thisChar != ",") && (thisChar != " ") && (thisChar !="")) foundAlphaChar = 1;
			}
			else 
	 {
		withDollar = withDollar + thisChar
		noJunk = noJunk + thisChar
	 }
	
	 if ((thisChar == "$") || (thisChar == ".") || (thisChar == ","))
	 {
	   withDollar = withDollar + thisChar
	 }
	  }
		 if (foundDecimal) { return parseFloat(noJunk); }
		 else if (noJunk.length > 0) { return parseFloat(noJunk); }
		 else return 0;
	}


	function Highlight(RowID)		//Changes text and background colour when mouse hovered over...
		{document.getElementById("RowID_" + RowID).style.background = '#969696';
		document.getElementById("RowID_" + RowID).style.color = '#FFFFFF';}	
	
	function Highlight_Off(RowID)	//Returns text and background colour to original when mouse moved away...
		{document.getElementById("RowID_" + RowID).style.background = '#FFFFFF';
		document.getElementById("RowID_" + RowID).style.color = '#323232';}
		
	function IsNumeric(strValue){	//Called during form validation...
		var ValidChars = "0123456789.", IsNumber=true, Char;
		for (i = 0; i < strValue.length && IsNumber == true; i++){
			Char = strValue.charAt(i);
			if (ValidChars.indexOf(Char) == -1){
				IsNumber = false;}}
		return IsNumber;}
		
	function ReloadOpener(){if (window.event.clientX < 0 && window.event.clientY < 0)	//hack to detect whether window closing (called from Body onUnload event)...
		{opener.location.reload(true);}}												//this function fires when pop-up closed using window control not a button...

//******************** IFRAME SCROLLING calling code starts here ************************************		
	var timer_id;
	
	function scroll_iframe(frm,inc,dir) {
		if (timer_id) clearTimeout(timer_id);
		if (window.frames[frm]) {
		if (dir == "v") window.frames[frm].scrollBy(0, inc);
		else window.frames[frm].scrollBy(inc, 0);
		timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
			}
		}

	function stopScroll() { if (timer_id) clearTimeout(timer_id); }

//******************** IFRAME AUTO-HEIGHT calling code starts here ************************************		
	function iFrameHeight(HeaderBarHeight, FormName){
		var hei;
		if (self.innerHeight) // detects all browser types except Explorer...
			{hei = self.innerHeight;}
		else if (document.documentElement && document.documentElement.clientHeight)	// detects Explorer 6 in Strict Mode...
			{hei = document.documentElement.clientHeight;}
		else if (document.body) // detects other Explorers...
			{hei = document.body.clientHeight;}
		hei = hei - (HeaderBarHeight * 1.5);
		hei = hei + 'px';
		document.getElementById(FormName).style.height = hei;}
		
//******************** POP-UP WINDOW (Generic) calling code starts here *******************************
	function window_popup(id, URL, bars, wid, hei){
		//Get the mouse position...
			var posX = 0, posY = 0;
			var e = window.event || arguments.callee.caller.arguments[0];  //cross-browser event assignment...
			posX = (e.screenX - (wid/2)); posY = (e.screenY - hei);
		//Then open the pop-up window at the mouse position...
			strAttributes = 'help=no,status=no,scrollbars='+bars+',resizable=no,width='+wid+',height='+hei+',top='+posY+',left='+posX;
			var strURL = URL + '?id=' + id;   //pass the field name to the new window so it can be identified on close for updating...
			new_win = window.open(strURL,'new_win',strAttributes);
			//new_win.location.href = strURL;
			new_win.opener = self;}
 
	function window_popup_return(fieldname, fieldvalue){	//update the originating page (opener)...
		document.getElementById(fieldname).value = fieldvalue;
		new_win.close();}
		
//******************** COLOUR PICKER (ColourPicker.asp) calling code starts here **********************
	function colourpicker_popup(fieldname, colourtype, wid, hei){
		//Get the mouse position...
			var posX = 0, posY = 0;
			var e = window.event || arguments.callee.caller.arguments[0];  //cross-browser event assignment...
			posX = e.screenX - wid; posY = e.screenY - hei;
		//Then open the pop-up window at the mouse position...
			strAttributes = 'help=no,status=no,scrollbars=no,resizable=no,width=' + wid + ',height=' + hei + ',top=' + posY + ', left=' + posX;
			colourpicker_window = open('ColourPicker.asp','colourpicker',strAttributes);
			var startingcolour = document.getElementById(fieldname).value;
			startingcolour = String(startingcolour).substring(7, 1);
			var strURL = 'ColourPicker.asp?startingcolour=' + startingcolour + '&fieldname=' + fieldname + '&colourtype=' + colourtype;
			colourpicker_window.location.href = strURL;
			if (colourpicker_window.opener == null) colourpicker_window.opener = self;}
		
	function write_control(text){document.write(text);}	//Re-writes the control to display the Java Applet without the IE 'click to activate' message...
 
	function colourpicker_popup_return(fieldname, colourtype, hexvalue){
		var strHex = hexvalue;
		strHex = strHex.toUpperCase();
		document.getElementById(fieldname).value = strHex;
		if (colourtype == 'bg'){
			document.getElementById(fieldname).style.background = strHex;
			var strRowName = fieldname + "_Row";
			document.getElementById(strRowName).style.background = strHex;}
		if (colourtype == 'text'){
			document.getElementById(fieldname).style.color = strHex;}
		colourpicker_window.close();}

//******************** CALENDAR (Calendar.asp) calling code starts here ***********************************
	function y2k(number){return (number < 1000) ? number + 1900 : number;}
	
	var today = new Date(); var day   = today.getDate(); var month = today.getMonth(); var year  = y2k(today.getYear());
	
	function padout(number){return (number < 10) ? '0' + number : number;}
	
	function restart(formname, fieldname){document.forms[formname].elements[fieldname].value = '' + padout(day) + '/' + padout(month - 0 + 1) + '/' + year;
		calendar_window.close();}

	function calendar_popup(formname,fieldname){
		//Get the mouse position...
		var posx = 0; var posy = 0;
		if (!e) var e = window.event;
		if (e.screenX || e.screenY){
			posx = e.screenX; posy = e.screenY;}
		else if (e.screenX || e.screenY){
			posx = e.screenX + document.body.scrollLeft + document.documentElement.scrollLeft;
			posy = e.screenY + document.body.scrollTop + document.documentElement.scrollTop;}
		//then open the calendar window at the mouse position
		calendar_window=open('Calendar.asp','calendar','resizable=no, width=205, height=165, top=' + (posy - 185) + ', left=' + (posx - 235) );
		calendar_window.location.href = 'Calendar.asp?formname=' + formname + '&fieldname=' + fieldname;
		if (calendar_window.opener == null) calendar_window.opener = self;}

//-->