<!--
	function ValidateContact()
		{
			if (document.getElementById('First Name').value.length < 1)
				{
					alert("Please tell us your first name...");
					return false;
				}
				
			if (document.getElementById('Last Name').value.length < 1)
				{
					alert("Please tell us your last name...");
					return false;
				}
				
			var strEmail = document.getElementById('Email Address').value;
			var apos = strEmail.indexOf("@");
			var dotpos = strEmail.lastIndexOf(".");
			if (strEmail == "" || apos < 1 || dotpos - apos < 2)
				{
					alert("Please enter a valid Email address...");
					return false;
				}
				
			if (document.getElementById('Area of Interest').value == 'Please select category...')
				{
					alert("Please select an Area of Interest...");
					return false;
				}
				
			if (document.getElementById('Nature of Enquiry').value == 'Type your enquiry here...')
				{
					alert("Please give us details of your enquiry...");
					return false;
				}
				
			document.frmContact.submit();
		}

//============================================================================================================================

	function AddToCart_abilia(nStock, nItemRef, strFieldName, strSizeFld)
		{
			var nStock		= getValue(nStock);
			var nQty		= getValue(document.getElementById(strFieldName).value);
			
			if (nQty > nStock)
				{
					if (nStock == 1)
						{
							alert('Sorry, but there is only ' + nStock + ' of this item currently available...');
						}
					else
						{
							alert('Sorry, but there are only ' + nStock + ' of this item currently available...');
						}
					document.getElementById(strFieldName).value = nStock;
				}
			else
				{
					location.href = '../../Cart_AddNew_abilia.asp?ItemRef=' + nItemRef + '&Qty=' + nQty;
				}
		}
		
//============================================================================================================================

	function AddToCart_Stylophone()
		{
			var strSize	= document.getElementById('Stylophone_Size').value
			
			if (strSize == '---')
				{
					alert('Please select a Stylophone T-Shirt size...');
					return false;
				}
				
			arrValues = strSize.split('|');
			
			var nStock		= getValue(arrValues[1]);
			var nItemRef	= arrValues[0];
			var nQty		= getValue(document.getElementById('QtyStylophone').value);
			
			if (nQty > nStock)
				{
					if (nStock == 1)
						{
							alert('Sorry, but there is only ' + nStock + ' of this item currently available...');
						}
					else
						{
							alert('Sorry, but there are only ' + nStock + ' of this item currently available...');
						}
					document.getElementById('QtyStylophone').value = nStock;
				}
			else
				{
					location.href = '../../Cart_AddNew_abilia.asp?ItemRef=' + nItemRef + '&Qty=' + nQty;
				}
		}
		
//============================================================================================================================

	function AddToCart_Rolfaroo()
		{
			var strSize	= document.getElementById('Rolfaroo_Size').value
			
			if (strSize == '---')
				{
					alert('Please select a Rolfaroo T-Shirt size...');
					return false;
				}
				
			arrValues = strSize.split('|');
			
			var nStock		= getValue(arrValues[1]);
			var nItemRef	= arrValues[0];
			var nQty		= getValue(document.getElementById('QtyRolfaroo').value);
			
			if (nQty > nStock)
				{
					if (nStock == 1)
						{
							alert('Sorry, but there is only ' + nStock + ' of this item currently available...');
						}
					else
						{
							alert('Sorry, but there are only ' + nStock + ' of this item currently available...');
						}
					document.getElementById('QtyRolfaroo').value = nStock;
				}
			else
				{
					location.href = '../../Cart_AddNew_abilia.asp?ItemRef=' + nItemRef + '&Qty=' + nQty;
				}
		}
		
//============================================================================================================================

	function AddToCart_DVDs(nStock, nItemRef)
		{
			var nStock	= getValue(nStock);
			var nQty	= getValue(document.getElementById('Qty').value);
			
			if (nQty > nStock)
				{
					if (nStock == 1)
						{
							alert('Sorry, but there is only ' + nStock + ' of this item currently available...');
						}
					else
						{
							alert('Sorry, but there are only ' + nStock + ' of this item currently available...');
						}
					document.getElementById('Qty').value = nStock;
				}
			else
				{
					document.getElementById('apDiv1').style.visibility = 'hidden';
					document.getElementById('CartFrame').style.visibility = 'visible';
					document.getElementById('CartFrame').src = '../../Cart_AddNew.asp?ItemRef=' + nItemRef + '&Qty=' + nQty;
				}
		}
			
//============================================================================================================================

	function AddToCart_CDs(nStock, nItemRef)
		{
			var nStock	= getValue(nStock);
			var nQty	= getValue(document.getElementById('Qty').value);
			
			if (nQty > nStock)
				{
					if (nStock == 1)
						{
							alert('Sorry, but there is only ' + nStock + ' of this item currently available...');
						}
					else
						{
							alert('Sorry, but there are only ' + nStock + ' of this item currently available...');
						}
					document.getElementById('Qty').value = nStock;
				}
			else
				{
					document.getElementById('apDivBackCover').style.visibility = 'hidden';
					document.getElementById('CartFrame').style.visibility = 'visible';
					document.getElementById('CartFrame').src = '../../Cart_AddNew.asp?ItemRef=' + nItemRef + '&Qty=' + nQty;
				}
		}
			
//============================================================================================================================
	function AddToCart_Books(nStock, nItemRef)
		{
			var nStock	= getValue(nStock);
			var nQty	= getValue(document.getElementById('Qty').value);
			
			if (nQty > nStock)
				{
					if (nStock == 1)
						{
							alert('Sorry, but there is only ' + nStock + ' of this item currently available...');
						}
					else
						{
							alert('Sorry, but there are only ' + nStock + ' of this item currently available...');
						}
					document.getElementById('Qty').value = nStock;
				}
			else
				{
					document.getElementById('apDiv7').style.visibility = 'hidden';
					document.getElementById('CartFrame').style.visibility = 'visible';
					document.getElementById('CartFrame').src = '../../Cart_AddNew.asp?ItemRef=' + nItemRef + '&Qty=' + nQty;
				}
		}
			
//============================================================================================================================

	function ValidateEmail()
		{
			if (document.getElementById('firstname').value.length < 1)
				{
					alert("Please tell us your first name...");
					return false;
				}
				
			if (document.getElementById('lastname').value.length < 1)
				{
					alert("Please tell us your last name...");
					return false;
				}
				
			var strEmail = document.getElementById('email').value;
			var apos = strEmail.indexOf("@");
			var dotpos = strEmail.lastIndexOf(".");
			if (strEmail == "" || apos < 1 || dotpos - apos < 2)
				{
					alert("Please enter a valid Email address...");
					return false;
				}
				
			document.form1.submit();
		}
			
//============================================================================================================================
			
	function Alerts(strAuthentication)	//This function is called from Index.asp and pops up applicable alerts...
		{
			if (strAuthentication == 'Expired')
				{
					alert('Session expired due to inactivity: Please re-login to continue...');
					document.location.replace('Index.asp');
				}
			if (strAuthentication == 'Failed')
				{
					alert('Invalid authentication supplied; please re-try...');
					document.location.replace('Index.asp');
				}
			if (strAuthentication == 'Inactive')
				{
					alert('This login has been suspended; please telephone 020 8736 5662.');
					document.location.replace('Index.asp');
				}
			if (strAuthentication == 'Mail Sent')
				{
					alert('Your authentication details have been sent to your email address.');
					document.location.replace('Index.asp');
				}
			if (strAuthentication == 'Mail Failed')
				{
					alert('The supplied email address does not match any of our records; please re-try or contact us on 020 8736 5662.');
					document.location.replace('Index.asp');
				}
			if (strAuthentication == 'RegSaved')
				{
					alert('Your online registration application has been received and we will process your details as soon as possible.');
					document.location.replace('Index.asp');
				}
		}

//============================================================================================================================

	function MM_swapImgRestore() {var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}
	function MM_preloadImages() {var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}
	function MM_findObj(n, d) {var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;}
	function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}
		
//============================================================================================================================

//Calendar handlers (for Calendar.asp)...

	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(fieldname)
		{
			document.getElementById(fieldname).value = '' + padout(day) + '/' + padout(month - 0 + 1) + '/' + year;
			ComboChanged();
			new_win.close();
		}
	
//============================================================================================================================

	function Confirm_Action(URL, Msg)	//Function called when Buttons clicked to confirm action before loading the button URL...
		{	
			if (confirm(Msg) == true)
				{
					location.replace(URL);
				}
			else
				{
					return false;
				}
		}
		
//============================================================================================================================
	
	function Date_Reset(fieldname)	//Resets a Date field to dd/mm/yyyy...
		{
			document.getElementById(fieldname).value = 'dd/mm/yyyy';
		}
		
//============================================================================================================================

//Element size calulator...

	function getObj(name)	//Gets the style properties of the named element...
		{
			if (document.getElementById)
				{
					this.obj = document.getElementById(name);
					this.style = document.getElementById(name).style;
				}
			else if (document.all)
				{
					this.obj = document.all[name];
					this.style = document.all[name].style;
				}
		}
	
	function getWinSize()
		{
			var iWidth = 0, iHeight = 0;
			if (self.innerWidth) // detects all browser types except Explorer...
				{
					iWidth = parseInt(self.innerWidth,10);
					iHeight = parseInt(self.innerHeight,10);
				}
			else if (document.documentElement && document.documentElement.clientWidth)	// detects Explorer 6 in Strict Mode...
				{
					iWidth = parseInt(document.documentElement.clientWidth,10);
					iHeight = parseInt(document.documentElement.clientHeight,10);
				}
			else if (document.body) // detects other Explorers...
				{
					iWidth = parseInt(document.body.clientWidth,10);
					iHeight = parseInt(document.body.clientHeight,10);
				}
			return {width:iWidth, height:iHeight};
		}
	
	function resizeElem(obj, strAttribute, nAdjH, nAdjW)
		{
			var oContent = new getObj(obj);
			var oWinSize = getWinSize();
			
			switch (strAttribute)
				{
					case 'height':
						if ((oWinSize.height - parseInt(oContent.obj.offsetTop,10))>0)
							{
								oContent.style.height = ((oWinSize.height - parseInt(oContent.obj.offsetTop,10))) + nAdjH;
							}
						break;
					case 'width':
						if ((oWinSize.width - parseInt(oContent.obj.offsetLeft,10))>0)
							{
								oContent.style.width = ((oWinSize.width - parseInt(oContent.obj.offsetLeft,10))) + nAdjW;
							}
						break;
					default:
						if ((oWinSize.height - parseInt(oContent.obj.offsetTop,10))>0)
							{
								oContent.style.height = ((oWinSize.height - parseInt(oContent.obj.offsetTop,10))) + nAdjH;
							}
						if ((oWinSize.width - parseInt(oContent.obj.offsetLeft,10))>0)
							{
								oContent.style.width = ((oWinSize.width - parseInt(oContent.obj.offsetLeft,10))) + nAdjW;
							}
						break;
				}
		}
		
//============================================================================================================================
	function FilterPage(strSourcePage, strSearch, strSubID, strSourceTable, strOrderBy, strOrderDir, strPages, strFieldName, strFilterField)
		{
			var strFilter = document.getElementById(strFieldName).value;
			var strURL = strSourcePage + '?Filter=' + strFilter + '&Search=' + strSearch + '&SubID=' + strSubID;
			strURL = strURL + '&SourceTable=' + strSourceTable + '&OrderBy=' + strOrderBy + '&Pages=' + strPages + '&OrderDir=' + strOrderDir + '&FilterField=' + strFilterField;
			document.location.replace(strURL);
		}
		
//============================================================================================================================
	
	function FilterReport(strSourcePage, strPeriod, strMonth, strFrom, strTo, strTable, strFilterField, strReportType, nFieldNo)
		{
			var strFieldName = 'Filter_' + nFieldNo
			var strFilter = document.getElementById(strFieldName).value;
			var strURL = strSourcePage + '?Filter=' + strFilter + '&Period=' + strPeriod + '&Month=' + strMonth;
			strURL = strURL + '&From=' + strFrom + '&To=' + strTo;
			strURL = strURL + '&Table=' + strTable + '&FilterField=' + strFilterField + '&ReportType=' + strReportType;
			document.location.replace(strURL);
			//alert(strTable);
		}
		
//============================================================================================================================
		
	function FormatCurrency(strValue)	//Formats numbers as currency with £ symbol & to 2 decimal places...
		{
			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 FormatDec(amount)	//Formats numbers to 2 decimal places...
		{
			var i = parseFloat(amount);
			if (isNaN(i))
				{
					i = 0.00;
				}
			var minus = '';
			if (i < 0)
				{
					minus = '-';
				}
			i = Math.abs(i);
			i = parseInt((i + .005) * 100);
			i = i / 100;
			s = new String(i);
			if (s.indexOf('.') < 0)
				{
					s += '.00';
				}
			if (s.indexOf('.') == (s.length - 2))
				{
					s += '0';
				}
			s = minus + s;
			return s;
		}
	
//============================================================================================================================
		
	function getValue(num)	//Transposes strings / currency etc. into numbers for calculation purposes...
		{
			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;
		}
		
//============================================================================================================================

//Header Bar clock...

	function tS()
		{
			x=new Date();
			x.setTime(x.getTime());
			return x;
		}
		
	function lZ(x)
		{
			return (x>9)?x:'0'+x;
		}
		
	function y2(x)
		{
			x=(x<500)?x+1900:x;
			return String(x).substring(2,4)
		}
		
	function dT()
		{
			document.getElementById('clock').innerHTML=eval(oT);
			setTimeout('dT()',1000);
		}
		
	var dN=new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
	var mN=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
	var oT="dN[tS().getDay()]+' '+tS().getDate()+' '+mN[tS().getMonth()]+' '+y2(tS().getYear())+'";
		oT = oT + " '+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+' '+lZ(tS().getHours())+':";
		oT = oT + "'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())";
		
//============================================================================================================================

	function Highlight(RowID)		//Changes text and background colour when mouse hovered over...
		{
			document.getElementById("RowID_" + RowID).style.background = '#DFDFDF';
		}
		
//============================================================================================================================
	
	function Highlight_Off(RowID)	//Returns text and background colour to original when mouse moved away...
		{
			document.getElementById("RowID_" + RowID).style.background = '#FFFFFF';
		}
		
//============================================================================================================================

	function IsNumeric(strValue)	//Called during form validation to check if field data is numeric...
		{
			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 LowerCase(fieldname)	//Reformat to capitalise words...
		{
			document.getElementById(fieldname).value = document.getElementById(fieldname).value.toLowerCase();
		}
		
//============================================================================================================================

//Postcode search window pop-up...

	function Postcode_Search(fldPostCode, fldAddress, posX, posY)
		{
			var strPostCode = document.getElementById(fldPostCode).value;
			
			if(strPostCode.length < 6)
				{
					alert('Please enter a complete Post Code...');
					return false;	
				}

			switch (strPostCode.substring(0,1))
				{
					case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M':
						//do nothing
						break;
					case 'N': case 'O': case 'P': case 'R': case 'S': case 'T': case 'U': case 'W': case 'Y': case 'Z':
						//do nothing
						break;
					default:
						alert('Please enter a proper Post Code...');
						return false;
						break;
				}

			
			var strAttributes = 'help=no, status=no,  location=no , resizable=no, toolbar=no, menubar=no, scrollbars=yes';
			strAttributes += ', width=300, height=600, top=' + (posY - 600) + ', left=' + (posX - 300);
			
			var strURL = 'Postcode_Search.asp?fldAddress=' + fldAddress + '&strPostCode=' + strPostCode;   //pass the field name to the new window so it can be identified on close for updating...
			
			new_win = open(strURL, 'new_win', strAttributes);
			new_win.opener = self;
		}
		
//============================================================================================================================

	function roundNumber(rnum, rlength)	//Converts long decimals to the selected number of places...
		{
			if (rnum > 8191 && rnum < 10485)
				{
					rnum = rnum-5000;
					var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
					newnumber = newnumber+5000;
				}
			else
				{
					var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
				}	
			return newnumber;
		}
		
//============================================================================================================================

	function TitleCase(fieldname)	//Reformat to capitalise words...
		{
			var strLower = document.getElementById(fieldname).value.toLowerCase();
			
			var o_split = strLower.split(" ");	// Capitalise after spaces...
			for (i=0;i<o_split.length;i++)
				{o_split[i] = (o_split[i].substring(0,1)).toUpperCase() + o_split[i].substring(1);}
			strLower = o_split.join(' ');
			
			o_split = strLower.split("\n");	// Capitalise after carriage returns...
			for (i=0;i<o_split.length;i++)
				{o_split[i] = (o_split[i].substring(0,1)).toUpperCase() + o_split[i].substring(1);}
			strLower = o_split.join('\n');
			
			o_split = strLower.split("-");	// Capitalise after hyphens...
			for (i=0;i<o_split.length;i++)
				{o_split[i] = (o_split[i].substring(0,1)).toUpperCase() + o_split[i].substring(1);}
			strLower = o_split.join('-');
			
			o_split = strLower.split("Mc");	// Capitalise after 'Mc's'...
			for (i=0;i<o_split.length;i++)
				{o_split[i] = (o_split[i].substring(0,1)).toUpperCase() + o_split[i].substring(1);}
			strLower = o_split.join('Mc');
			
			o_split = strLower.split("O'");	// Capitalise after 'Mc's'...
			for (i=0;i<o_split.length;i++)
				{o_split[i] = (o_split[i].substring(0,1)).toUpperCase() + o_split[i].substring(1);}
			strLower = o_split.join("O'");

			document.getElementById(fieldname).value = strLower;
		}
		
//============================================================================================================================

	function UpperCase(fieldname)	//Reformat to capitalise words...
		{
			document.getElementById(fieldname).value = document.getElementById(fieldname).value.toUpperCase();
		}
		
//============================================================================================================================

	function Val_Currency(fieldname)	//Input form validation for currency format...
		{
			if (!IsNumeric(document.getElementById(fieldname).value))
				{
					document.getElementById(fieldname).value = FormatCurrency(0);
					alert(fieldname + " must be a number..."); 
					return false;
				}
			if (document.getElementById(fieldname).value.length < 1)
				{
					document.getElementById(fieldname).value = FormatCurrency(0);
				}
			else
				{
					document.getElementById(fieldname).value = FormatCurrency(document.getElementById(fieldname).value);
				}
		}
		
//============================================================================================================================

	function Val_Email(fieldname)	//Input form validation for email format...
		{
			if (document.getElementById(fieldname).value.indexOf('.') < 2 || document.getElementById(fieldname).value.indexOf('@') == -1)
				{
					alert(fieldname + ' must be a valid email address...');
					document.getElementById(fieldname).value = '';
					return false;
				}
		}
		
//============================================================================================================================

	function Val_Labour(fieldname)	//Input form validation for currency format...
		{
			if (!IsNumeric(document.getElementById(fieldname).value))
				{
					document.getElementById(fieldname).value = FormatCurrency(0);
					alert(fieldname + " must be a number...");
					var nLabour = getValue(document.getElementById('Labour').value);
					var nMaterials = getValue(document.getElementById('Materials').value);
					var nNet = nLabour + nMaterials;
					nVAT = nNet * .175;
					var nTotal = nNet + nVAT;
					document.getElementById('Labour').value = FormatCurrency(nLabour,2);
					document.getElementById('Materials').value = FormatCurrency(nMaterials,2);
					document.getElementById('Net').value = FormatCurrency(nNet,2);
					document.getElementById('VAT').value = FormatCurrency(nVAT,2);
					document.getElementById('Total').value = FormatCurrency(nTotal,2);
					return false;
				}
			if (document.getElementById(fieldname).value.length < 1)
				{
					document.getElementById(fieldname).value = FormatCurrency(0);
					var nLabour = getValue(document.getElementById('Labour').value);
					var nMaterials = getValue(document.getElementById('Materials').value);
					var nNet = nLabour + nMaterials;
					nVAT = nNet * .175;
					var nTotal = nNet + nVAT;
					document.getElementById('Labour').value = FormatCurrency(nLabour,2);
					document.getElementById('Materials').value = FormatCurrency(nMaterials,2);
					document.getElementById('Net').value = FormatCurrency(nNet,2);
					document.getElementById('VAT').value = FormatCurrency(nVAT,2);
					document.getElementById('Total').value = FormatCurrency(nTotal,2);
				}
			else
				{
					document.getElementById(fieldname).value = FormatCurrency(document.getElementById(fieldname).value);
					var nLabour = getValue(document.getElementById('Labour').value);
					var nMaterials = getValue(document.getElementById('Materials').value);
					var nNet = nLabour + nMaterials;
					nVAT = nNet * .175;
					var nTotal = nNet + nVAT;
					document.getElementById('Labour').value = FormatCurrency(nLabour,2);
					document.getElementById('Materials').value = FormatCurrency(nMaterials,2);
					document.getElementById('Net').value = FormatCurrency(nNet,2);
					document.getElementById('VAT').value = FormatCurrency(nVAT,2);
					document.getElementById('Total').value = FormatCurrency(nTotal,2);
				}
		}
		
//============================================================================================================================

	function Val_Net(fieldname)	//Input form validation for currency format...
		{
			if (!IsNumeric(document.getElementById(fieldname).value))
				{
					document.getElementById(fieldname).value = FormatCurrency(0);
					alert(fieldname + " must be a number...");
					document.getElementById('VAT').value = FormatCurrency(0);
					document.getElementById('Total').value = FormatCurrency(0);
					return false;
				}
			if (document.getElementById(fieldname).value.length < 1)
				{
					document.getElementById(fieldname).value = FormatCurrency(0);
					document.getElementById('VAT').value = FormatCurrency(0);
					document.getElementById('Total').value = FormatCurrency(0);
				}
			else
				{
					document.getElementById(fieldname).value = FormatCurrency(document.getElementById(fieldname).value);
					var nNet = getValue(document.getElementById('Net').value);
					nVAT = nNet * .175;
					var nTotal = nNet + nVAT;
					document.getElementById('Net').value = FormatCurrency(nNet,2);
					document.getElementById('VAT').value = FormatCurrency(nVAT,2);
					document.getElementById('Total').value = FormatCurrency(nTotal,2);
				}
		}
		
//============================================================================================================================

	function Val_VAT(fieldname)	//Input form validation for currency format...
		{
			if (!IsNumeric(document.getElementById(fieldname).value))
				{
					document.getElementById(fieldname).value = FormatCurrency(0);
					alert(fieldname + " must be a number...");
					document.getElementById('VAT').value = FormatCurrency(0);
					document.getElementById('Total').value = FormatCurrency(document.getElementById('Net').value);
					return false;
				}
			if (document.getElementById(fieldname).value.length < 1)
				{
					document.getElementById(fieldname).value = FormatCurrency(0);
					document.getElementById('VAT').value = FormatCurrency(0);
					document.getElementById('Total').value = FormatCurrency(document.getElementById('Net').value);
				}
			else
				{
					document.getElementById(fieldname).value = FormatCurrency(document.getElementById(fieldname).value);
					var nVAT = getValue(document.getElementById('VAT').value);
					var nNet = getValue(document.getElementById('Net').value);
					var nTotal = nNet + nVAT;
					document.getElementById('VAT').value = FormatCurrency(nVAT);
					document.getElementById('Total').value = FormatCurrency(nTotal);
				}
		}
			
//============================================================================================================================

	function Val_Num_0(fieldname)	//Input form validation for number to 0 decimal places...
		{
			if (!IsNumeric(document.getElementById(fieldname).value))
				{
					document.getElementById(fieldname).value = 0;
					alert("Quantity must be a number..."); 
					return false;
				}
			if (document.getElementById(fieldname).value.length < 1)
				{
					document.getElementById(fieldname).value = 0;
				}
		}
		
//============================================================================================================================

	function Val_Num_2(fieldname)	//Input form validation for number to 2 decimal places...
		{
			if (!IsNumeric(document.getElementById(fieldname).value))
				{
					document.getElementById(fieldname).value = FormatDec(0);
					alert(fieldname + " must be a number..."); 
					return false;
				}
			if (document.getElementById(fieldname).value.length < 1)
				{
					document.getElementById(fieldname).value = FormatDec(0);
				}
			else
				{
					document.getElementById(fieldname).value = FormatDec(document.getElementById(fieldname).value);
				}
		}

//============================================================================================================================

//Window pop-up...

	function window_popup(fieldname, URL, bars, wid, hei, posX, posY)
		{
			var strAttributes = 'help=no, status=no,  location=no , resizable=no, toolbar=no, menubar=no, scrollbars=' + bars;
			strAttributes += ', width=' + wid + ', height=' + hei + ', top=' + (posY + 15) + ', left=' + posX;
			
			var strURL = URL + '?fieldname=' + fieldname;   //pass the field name to the new window so it can be identified on close for updating...
			
			new_win = open(strURL, 'new_win', strAttributes);
			new_win.opener = self;
		}
 
	function window_popup_return(fieldname, fieldvalue)		//update the originating page (opener)...
		{	
			document.getElementById(fieldname).value = fieldvalue;
			ComboChanged();
			new_win.close();
		}
		
//******************** 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); }
		
		
		
		
//-->