
	var report = true;
	var btnDeleteClick = false;
	var btnDelete2Click = false;
	var btnDelete3Click = false;
	var btnAddClick = false;
	var btnDeleteAllClick = false;
	var btnUpdateClick = false;
	var btnRenameClick = false;
	var btnAddExistingClick = false;
	var btnNewRootClick = false;
	var btnCopyClick = false;
	var btnPasteNewClick = false;
	var btnOtherClick = false;
	var btnSearchClick = false;
	var btnEditClick = false;
	var btnLogOn = false;
	var btnCheckImport = false;
	var extraInfo = "";
	var NSEvent;
	var gToggle = true;
	var gPublic = true;
	var gOverRide = true;
	
	function newFunction()
	{
		try
		{
			return (true);
		}
		catch (e)
		{
			reportError("newFunction()",e);
			
			return (false);
		}
	}
	
	function nothing()
	{
	}
	
	function reportError(fn,e)
	{
		
		if (report)
			alert ("Sorry - an error has occured...\n\n" + fn + ": >> " + e.description);
		
	}
	
	function setUpRollovers()
	{
	
		try
		{
			if(document.images)
			{
				pics = new Array();
				pics[1] = new Image();
				pics[1].src = "/images2/buthome2.jpg";
				pics[2] = new Image();
				pics[2].src = "/images2/buthomedown2.jpg";

				pics[3] = new Image();
				pics[3].src = "/images2/butcontact2.jpg";
				pics[4] = new Image();
				pics[4].src = "/images2/butcontactdown2.jpg";


				pics[5] = new Image();
				pics[5].src = "/images2/butterms2.jpg";
				pics[6] = new Image();
				pics[6].src = "/images2/buttermsdown2.jpg";

				pics[7] = new Image();
				pics[7].src = "/images2/butmyaccount2.jpg";
				pics[8] = new Image();
				pics[8].src = "/images2/butmyaccountdown2.jpg";

				pics[9] = new Image();
				pics[9].src = "/images2/butcheckout2.jpg";
				pics[10] = new Image();
				pics[10].src = "/images2/butcheckoutdown2.jpg";

				pics[11] = new Image();
				pics[11].src = "/images2/butevents2.jpg";
				pics[12] = new Image();
				pics[12].src = "/images2/buteventsdown2.jpg";
			}
		}
		catch (e)
		{
			reportError("setUpRollovers()",e);
		}
	}
	
	function rolloverChanger(from,to)
	{
		try
		{
			if(document.images)
			{
				document.images[from].src = pics[to].src;
			}
		}
		catch (e)
		{
			//reportError("rolloverChanger()",e);
		}
	}
	
	function checkSearch()
	{
		try
		{
			if (document.search.txtSearchFor.value == "")
				return(false);
			return (true);
		}
		catch (e)
		{
			reportError("checkSearch()",e);
		}
	}
	
	function DHTMLSetup()
	{
		try
		{
			if (!document.all && document.getElementById)
			{
				document.getElementById("HTMLBody").addEventListener("contextmenu",NetscapeEvent,false);
			}
		}
		catch (e)
		{
			reportError("DHTMLSetup()",e);
		}
	}
	
	function NetscapeEvent(e)
	{
		try
		{
			NSEvent = e;
		}
		catch (e2)
		{
			reportError("NetscapeEvent(e)",e2);
		}
	}
	
	function rightClickTest()
	{
		try
		{
			if (!report)
			{
				if (document.all)
				{
					alert ("IE: " + window.event.clientX + " " + window.event.clientY);
				}
				else if (document.getElementById)
				{
					alert ("NS: " + NSEvent.clientX + " " + NSEvent.clientY);
				}
			}
		}
		catch (e)
		{
			reportError("rightClickTest()",e);
		}
	}
	
	function rightClick()
	{
		try
		{
			if (!report)
			{
				if (document.all)
				{
					if (window.event.srcElement.tagName == "INPUT" || window.event.srcElement.tagName == "TEXTAREA")
					{
						//window.event.shiftKey
						return(true);
					}
					else
						return(false);
				
				}
				else
					return(false);
					
			}
			else
				return(true);
			
		}
		catch (e)
		{
			reportError("rightClick()",e);
		}
	}
	
	function checkEditViewCatForm()
	{
		try
		{
			if (btnDeleteClick)
			{
				btnDeleteClick = false;
				
				return (checkSure("Are you REALLY SURE you wish to DELETE this CATEGORY ?"));
			}
			
			if (btnAddClick)
			{
				btnAddClick = false;
				
				if (document.editView.addCategoryName.value == "")
				{
					document.editView.addCategoryName.focus();
					alert ("Sorry - you need to enter a category name.");
					return (false);
				}
			}
			
			if (btnRenameClick)
			{
				btnRenameClick = false;
	
				if (document.editView.categoryName.value == "")
				{
					document.editView.categoryName.focus();
					alert ("Sorry - you need to enter a category name.");
					return (false);
				}
			}
			
			if (btnUpdateClick)
			{
				btnUpdateClick = false;
	
				if (document.editView.categoryName.value == "")
				{
					document.editView.categoryName.focus();
					alert ("Sorry - you need to enter a category name.");
					return (false);
				}
			}
				
			if (btnPasteNewClick)
			{
				btnPasteNewClick = false;
	
				return (true);
			}
					
			return (true);
		}
		catch (e)
		{
			reportError("checkEditViewCatForm()",e);
			
			return (false);
		}
	}
	
	function checkAddEditMsgForm()
	{
		try
		{	
			if (btnDeleteClick)
			{
				btnDeleteClick = false;
				
				if (onlyOne)
					extraInfo = "This is the ORIGINAL webMessage.\n\n";
					
				return (checkSure(extraInfo + "Are you REALLY SURE you wish to DELETE the WEBMESSAGE from THIS category ?"));
			}
			else if (btnDeleteAllClick)
			{
				btnDeleteAllClick = false;
				
				return (checkSure("This will DELETE the ORIGINAL WEBMESSAGE.\n\nAre you REALLY SURE you wish to DELETE the WEBMESSAGE from EVERY category ?"));
			}
			else if (btnAddExistingClick)
			{
				btnAddExistingClick = false;
				
				if (document.addEdit.existingWebMessageId[document.addEdit.existingWebMessageId.selectedIndex].value == -1)
				{
					document.addEdit.existingWebMessageId.focus();
					alert ("Sorry - no existing webMessages available.");
					return (false);
				}
			}
			else
			{
				if (document.addEdit.webMessageName.value == "")
				{
					document.addEdit.webMessageName.focus();
					alert ("Sorry - you need to enter a webMessage name.");
					return (false);
				}
			
				if (document.addEdit.webMessageValue.value == "")
				{
					document.addEdit.webMessageValue.focus();
					alert ("Sorry - you need to enter a webMessage value.");
					return (false);
				}
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkAddEditMsgForm()",e);
			
			return (false);
		}
	}
	
	function checkAddSupplierForm()
	{
		try
		{
			if (document.add.supplierName.value == "")
			{
				document.add.supplierName.focus();
				alert ("Sorry - you need to enter a supplier name.");
				return (false);
			}
			
			if (document.add.supplierBasePath.value == "")
			{
				document.add.supplierBasePath.focus();
				alert ("Sorry - you need to enter a supplier base path. (e.g. http://www.domain.com/BasePath)");
				return (false);
			}
			
			return (true)
		
		}
		catch (e)
		{
			reportError("checkAddSupplierForm()",e);
			
			return (false);
		}
	}
	
	function checkEditViewSupplierForm()
	{
		try
		{
			if (btnOtherClick)
			{
				btnOtherClick = false;
				
				if (document.editView.otherSupplierId[document.editView.otherSupplierId.selectedIndex].value == -1)
				{
					document.editView.otherSupplierId.focus();
					alert ("Sorry - you need to select another supplier.");
					return (false);
				}
				
				return (true);
			}
			else
			{
				if (document.editView.supplierName.value == "")
				{
					document.editView.supplierName.focus();
					alert ("Sorry - you need to enter a supplier name.");
					return (false);
				}
			
				if (document.editView.supplierBasePath.value == "")
				{
					document.editView.supplierBasePath.focus();
					alert ("Sorry - you need to enter a supplier base path. (e.g. http://www.domain.com/BasePath)");
					return (false);
				}
			
				return (true)
			}
		}
		catch (e)
		{
			reportError("checkEditViewSupplierForm()",e);
			
			return (false);
		}
	}
	
	function checkAddProductForm()
	{
		try
		{
			if (btnAddExistingClick)
			{
				btnAddExistingClick = false;
				
				if (document.add.existingProductId[document.add.existingProductId.selectedIndex].value == -1)
				{
					document.add.existingProductId.focus();
					alert ("Sorry - no existing products available.");
					return (false);
				}
			}
			else if (btnPasteNewClick)
			{
				btnPasteNewClick = false;
				
				return (true);
			}	
			else
			{
				if (document.add.productName.value == "")
				{
					document.add.productName.focus();
					alert ("Sorry - you need to enter a product name.");
					return (false);
				}
			
				if (document.add.productSupplierId[document.add.productSupplierId.selectedIndex].value == -1)
				{
					document.add.productSupplierId.focus();
					alert ("Sorry - you need to select a supplier.");
					return (false);
				}
			
				return (true)
			}
		}
		catch (e)
		{
			reportError("checkAddProductForm()",e);
			
			return (false);
		}
	}
	
	function checkEditViewProductForm()
	{
	
		try
		{
			if (btnDeleteClick)
			{
				btnDeleteClick = false;
				
				// page variable
				
				if (onlyOne)
					extraInfo = "This is the ORIGINAL product.\n\n";
				
				return (checkSure(extraInfo + "Are you REALLY SURE you wish to DELETE the PRODUCT from THIS category ?"));
			}
			else if (btnDeleteAllClick)
			{
				btnDeleteAllClick = false;
				
				return (checkSure("This will DELETE the ORIGINAL product.\n\nAre you REALLY SURE you wish to DELETE the PRODUCT from EVERY category ?"));
			}
			else if (btnCopyClick)
			{
				btnCopyClick = false;
				
				return (true);
			}
			else
			{
				if (document.editView.productName.value == "")
				{
					document.editView.productName.focus();
					alert ("Sorry - you need to enter a product name.");
					return (false);
				}
			
				if (document.editView.productSupplierId[document.editView.productSupplierId.selectedIndex].value == -1)
				{
					document.editView.productSupplierId.focus();
					alert ("Sorry - you need to select a supplier.");
					return (false);
				}
			
				return (true)
			}
		}
		catch (e)
		{
			reportError("checkEditViewProductForm()",e);
			
			return (false);
		}
	}
	
	function addNewSupplierPart1Toggle()
	{
		try
		{
			show("part1");
			hide("part2");
			hide("part3");
		}
		catch (e)
		{
			reportError("addNewSupplierPart1Toggle()",e);
		}
	}
	
	function addNewSupplierPart2Toggle()
	{
		try
		{
			show("part2");
			hide("part1");
			hide("part3");
		}
		catch (e)
		{
			reportError("addNewSupplierPart2Toggle()",e);
		}
	}
	
	function addNewSupplierPart3Toggle()
	{
		try
		{
			show("part3");
			hide("part2");
			hide("part1");
		}
		catch (e)
		{
			reportError("addNewSupplierPart3Toggle()",e);
		}
	}
	
	function checkAddProductItem()
	{
		try
		{
			if (btnAddExistingClick)
			{
				btnAddExistingClick = false;
				
				return (true);
			}
			else if (btnPasteNewClick)
			{
				btnPasteNewClick = false;
				
				return (true);
			}
			else
			{
				if (document.add.productItemName.value == "")
				{
					document.add.productItemName.focus();
					alert ("Sorry - you need to enter a product item name.");
					return (false);
				}
			
				return (true);
			}
		}
		catch (e)
		{
			reportError("checkAddProductItem()",e);
			
			return (false);
		}
	}
	
	function checkEditViewProductItem()
	{
		try
		{
			if (btnCopyClick)
			{
				btnCopyClick = false;
				
				return (true);
			}
			else if (btnDeleteClick)
			{
				btnDeleteClick = false;
				
				if (onlyOne)
					extraInfo = "This is the ORIGINAL ITEM.\n\n";
				
				return (checkSure(extraInfo + "Are you REALLY SURE you wish to DELETE the ITEM from THIS product ?"));
			}
			else if (btnDeleteAllClick)
			{
				btnDeleteAllClick = false;
				
				return (checkSure("This will DELETE the ORIGINAL ITEM.\n\nAre you REALLY SURE you wish to DELETE the ITEM from EVERY product ?"));
			}
			else
			{
				if (document.editView.productItemName.value == "")
				{
					document.editView.productItemName.focus();
					alert ("Sorry - you need to enter a product item name.");
					return (false);
				}
			
				return (true);
			}
		}
		catch (e)
		{
			reportError("checkEditViewProductItem()",e);
			
			return (false);
		}
	}
	
	function checkCreateNewAccountStep1()
	{
		var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
		
		try
		{
			document.add.accountEmailAddress.value = trim(document.add.accountEmailAddress.value);
			
			if (!emailFilter.test(document.add.accountEmailAddress.value))
			{
				document.add.accountEmailAddress.focus();
				alert ("Sorry - you need to enter a valid email address.");
				return (false);
			}
			
			if (document.add.accountTypeId[document.add.accountTypeId.selectedIndex].value == -1)
			{
				document.add.accountTypeId.focus();
				alert ("Sorry - you need to select an account type.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkCreateNewAccountStep1()",e);
			
			return (false);
		}
	}
	
	function checkAddIndividualAccount()
	{
		try
		{
			if (document.add.accountFirstName.value == "")
			{
				document.add.accountFirstName.focus();
				alert ("Sorry - you need to enter your First Name.");
				return (false);
			}
			
			if (document.add.accountLastName.value == "")
			{
				document.add.accountLastName.focus();
				alert ("Sorry - you need to enter your Last Name.");
				return (false);
			}
			
			if (document.add.accountPassword1.value.length < 5)
			{
				document.add.accountPassword1.focus();
				alert ("Sorry - your password needs to be at least 5 characters long.");
				return (false);
			}
			
			if (document.add.accountPassword1.value != document.add.accountPassword2.value)
			{
				document.add.accountPassword2.focus();
				alert ("Sorry - you need re-enter your password.");
				return (false);
			}
			
			if (document.add.accountAddress1.value == "")
			{
				document.add.accountAddress1.focus();
				alert ("Sorry - you need to enter the First Line of your address.");
				return (false);
			}
			
			if (document.add.accountTownCity.value == "")
			{
				document.add.accountTownCity.focus();
				alert ("Sorry - you need to enter your Town / City.");
				return (false);
			}
			
			if (document.add.accountCountyState.value == "")
			{
				document.add.accountCountyState.focus();
				alert ("Sorry - you need to enter your County / State.");
				return (false);
			}
			
			if (document.add.accountCountryId[document.add.accountCountryId.selectedIndex].value == -1)
			{
				document.add.accountCountryId.focus();
				alert ("Sorry - you need to enter your Country.");
				return (false);
			}
			
			if (document.add.accountLandLineTel.value == "")
			{
				document.add.accountLandLineTel.focus();
				alert ("Sorry - you need to enter your Telephone number.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkAddIndividualAccount()",e);
			
			return (false);
		}
	}
	
	function checkAdminAddTradeAccount()
	{
		try
		{
			
			var lOneChecked, colInput
			
			var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
			
			if (document.add.accountFirstName.value == "")
			{
				document.add.accountFirstName.focus();
				alert ("Sorry - you need to enter your First Name.");
				return (false);
			}
			
			if (document.add.accountLastName.value == "")
			{
				document.add.accountLastName.focus();
				alert ("Sorry - you need to enter your Last Name.");
				return (false);
			}
			
			if (!emailFilter.test(document.add.accountEmailAddress.value))
			{
				document.add.accountEmailAddress.focus();
				alert ("Sorry - you need to enter a valid email address.");
				return (false);
			}
			
			if (document.add.accountPassword.value.length < 5)
			{
				document.add.accountPassword.focus();
				alert ("Sorry - your password needs to be at least 5 characters long.");
				return (false);
			}
			
			if (document.add.accountCompanyName.value == "")
			{
				document.add.accountCompanyName.focus();
				alert ("Sorry - you need to enter a company name.");
				return (false);
			}
			
			//if (document.add.accountCompanyCode.value == "")
			//{
				//document.add.accountCompanyCode.focus();
				//alert ("Sorry - you need to enter a company code.");
				//return (false);
			//}
			
			if (document.add.accountAddress1.value == "")
			{
				document.add.accountAddress1.focus();
				alert ("Sorry - you need to enter the First Line of your address.");
				return (false);
			}
			
			if (document.add.accountTownCity.value == "")
			{
				document.add.accountTownCity.focus();
				alert ("Sorry - you need to enter your Town / City.");
				return (false);
			}
			
			if (document.add.accountCountyState.value == "")
			{
				document.add.accountCountyState.focus();
				alert ("Sorry - you need to enter your County / State.");
				return (false);
			}
			
			if (document.add.accountCountryId[document.add.accountCountryId.selectedIndex].value == -1)
			{
				document.add.accountCountryId.focus();
				alert ("Sorry - you need to enter your Country.");
				return (false);
			}
			
			colInput = document.getElementsByTagName("input");

			for (var i=0;i < colInput.length;i++)
			{
				if (colInput[i].type == "radio")
				{
					if (colInput[i].checked)
					{
						lOneChecked = true;
					}
				}
			}
			
			if (!lOneChecked)
			{
				alert ("You need to enter a Trader Price Field.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkAdminAddTradeAccount()",e);
			
			return (false);
		}
	}
	
	function checkAddTradeAccount()
	{
		try
		{
			if (document.add.accountFirstName.value == "")
			{
				document.add.accountFirstName.focus();
				alert ("Sorry - you need to enter your First Name.");
				return (false);
			}
			
			if (document.add.accountLastName.value == "")
			{
				document.add.accountLastName.focus();
				alert ("Sorry - you need to enter your Last Name.");
				return (false);
			}
			
			if (document.add.accountPassword1.value.length < 5)
			{
				document.add.accountPassword1.focus();
				alert ("Sorry - your password needs to be at least 5 characters long.");
				return (false);
			}
			
			if (document.add.accountPassword1.value != document.add.accountPassword2.value)
			{
				document.add.accountPassword2.focus();
				alert ("Sorry - you need re-enter your password.");
				return (false);
			}
			
			if (document.add.accountCompanyName.value == "")
			{
				document.add.accountCompanyName.focus();
				alert ("Sorry - you need to enter a company name.");
				return (false);
			}
			
			if (document.add.accountAddress1.value == "")
			{
				document.add.accountAddress1.focus();
				alert ("Sorry - you need to enter the First Line of your address.");
				return (false);
			}
			
			if (document.add.accountTownCity.value == "")
			{
				document.add.accountTownCity.focus();
				alert ("Sorry - you need to enter your Town / City.");
				return (false);
			}
			
			if (document.add.accountCountyState.value == "")
			{
				document.add.accountCountyState.focus();
				alert ("Sorry - you need to enter your County / State.");
				return (false);
			}
			
			if (document.add.accountCountryId[document.add.accountCountryId.selectedIndex].value == -1)
			{
				document.add.accountCountryId.focus();
				alert ("Sorry - you need to enter your Country.");
				return (false);
			}
			
			if (document.add.accountLandLineTel.value == "")
			{
				document.add.accountLandLineTel.focus();
				alert ("Sorry - you need to enter your Telephone number.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkAddTradeAccount()",e);
			
			return (false);
		}
	}
	
	function checkEditUpgradeAccount()
	{
		try
		{
			var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
		
			document.edit.accountAlterEmailAddress1.value = trim(document.edit.accountAlterEmailAddress1.value);
			document.edit.accountAlterEmailAddress2.value = trim(document.edit.accountAlterEmailAddress2.value);
			
			if (!emailFilter.test(document.edit.accountAlterEmailAddress1.value))
			{
				document.edit.accountAlterEmailAddress1.focus();
				alert ("Sorry - you need to enter a valid email address.");
				return (false);
			}
			
			if (document.edit.accountAlterEmailAddress1.value != document.edit.accountAlterEmailAddress2.value)
			{
				document.edit.accountAlterEmailAddress2.focus();
				alert ("Sorry - you need to re-enter your email address.");
				return (false);
			}
			
			if (document.edit.accountPassword1.value == "")
			{
				document.edit.accountPassword1.focus();
				alert ("Sorry - you need to enter a Password.");
				return (false);
			}
			
			if (document.edit.accountPassword1.value.length < 5)
			{
				document.edit.accountPassword1.focus();
				alert ("Sorry - you need to enter a Password at least 5 characters long.");
				return (false);
			}
			
			if (document.edit.accountPassword1.value != document.edit.accountPassword2.value)
			{
				document.edit.accountPassword2.focus();
				alert ("Sorry - you need to re-enter your password.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkEditUpgradeAccount()",e);
			
			return (false);
		}
	}
	
	function checkEditUpgradeTradeAccount()
	{
		try
		{
			var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
		
			document.edit.accountAlterEmailAddress1.value = trim(document.edit.accountAlterEmailAddress1.value);
			document.edit.accountAlterEmailAddress2.value = trim(document.edit.accountAlterEmailAddress2.value);
			
			if (!emailFilter.test(document.edit.accountAlterEmailAddress1.value))
			{
				document.edit.accountAlterEmailAddress1.focus();
				alert ("Sorry - you need to enter a valid email address.");
				return (false);
			}
			
			if (document.edit.accountAlterEmailAddress1.value != document.edit.accountAlterEmailAddress2.value)
			{
				document.edit.accountAlterEmailAddress2.focus();
				alert ("Sorry - you need to re-enter your email address.");
				return (false);
			}
			
			if (document.edit.accountPassword1.value == "")
			{
				document.edit.accountPassword1.focus();
				alert ("Sorry - you need to enter a Password.");
				return (false);
			}
			
			if (document.edit.accountPassword1.value.length < 5)
			{
				document.edit.accountPassword1.focus();
				alert ("Sorry - you need to enter a Password at least 5 characters long.");
				return (false);
			}
			
			if (document.edit.accountPassword1.value != document.edit.accountPassword2.value)
			{
				document.edit.accountPassword2.focus();
				alert ("Sorry - you need to re-enter your password.");
				return (false);
			}
			
			if (document.edit.accountCompanyName.value == "")
			{
				document.edit.accountCompanyName.focus();
				alert ("Sorry - you need to enter a company name.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkEditUpgradeTradeAccount()",e);
			
			return (false);
		}
	}
	
	function checkEditAddContact()
	{
		try
		{
			if (btnAddExistingClick)
			{
				btnAddExistingClick = false;
				
				if (document.addEdit.existingContactId[document.addEdit.existingContactId.selectedIndex].value == -1)
				{	
					document.addEdit.existingContactId.focus();
					alert ("Sorry - there are no existing contacts available to add.");
					return (false);
				}
			}
			else if (btnAddClick || btnUpdateClick)
			{
				btnAddClick = false;
				btnUpdateClick = false;
				
				if (document.addEdit.contactFirstName.value == "")
				{
					document.addEdit.contactFirstName.focus();
					alert ("Sorry - you need to enter your First Name.");
					return (false);
				}
			
				if (document.addEdit.contactLastName.value == "")
				{
					document.addEdit.contactLastName.focus();
					alert ("Sorry - you need to enter your Last Name.");
					return (false);
				}
			
				if (document.addEdit.contactLine1.value == "")
				{
					document.addEdit.contactLine1.focus();
					alert ("Sorry - you need to enter the first line of your address.");
					return (false);
				}
			
				if (document.addEdit.contactTownCity.value == "")
				{
					document.addEdit.contactTownCity.focus();
					alert ("Sorry - you need to enter your Town / City.");
					return (false);
				}
			
				if (document.addEdit.contactCountyState.value == "")
				{
					document.addEdit.contactCountyState.focus();
					alert ("Sorry - you need to enter your County / State.");
					return (false);
				}
			
				if (document.addEdit.contactCountryId[document.addEdit.contactCountryId.selectedIndex].value == -1)
				{
					document.addEdit.contactCountryId.focus();
					alert ("Sorry - you need to enter your Country.");
					return (false);
				}
			
				return (true);
			}	
			else
				return (true);
		}
		catch (e)
		{
			reportError("checkEditAddContact()",e);
			
			return (false);
		}
	}
	
	function checkLogon()
	{
		try
		{
			var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
			
			if (btnLogOn)
			{
				if (!emailFilter.test(document.logon.accountEmailAddress.value))
				{
					document.logon.accountEmailAddress.focus();
					alert ("Sorry - you need to enter a valid email address.");
					return (false);
				}
			
				if (!document.logon.checkPassword.checked)
				{
					if (document.logon.accountPassword.value == "")
					{
						document.logon.accountPassword.focus();
						alert ("Sorry - you need to enter your Password.");
						return (false);
					}
				}
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkLogon()",e);
			
			return (false);
		}
	}
	
	function checkEmailAFriend()
	{
		try
		{
			var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
			
			if (!emailFilter.test(document.email.EMFYourEmail.value))
			{
				document.email.EMFYourEmail.focus();
				alert ("Sorry - you need to enter a valid email address for yourself.");
				return (false);
			}
			
			if (!emailFilter.test(document.email.EMFFriendsEmail.value))
			{
				document.email.EMFFriendsEmail.focus();
				alert ("Sorry - you need to enter a valid email address for your friend.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkEmailAFriend()",e);
			
			return (false);
		}
	}
	
	function checkAskAQuestion()
	{
		try
		{
			var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
			
			if (!emailFilter.test(document.email.EMFYourEmail.value))
			{
				document.email.EMFYourEmail.focus();
				alert ("Sorry - you need to enter a valid email address for yourself.");
				return (false);
			}
			
			if (document.email.additionalMessage.value == "")
			{
				document.email.additionalMessage.focus();
				alert ("Sorry - you need to enter a question.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkAskAQuestion()",e);
			
			return (false);
		}
	}
	
	function checkManageImages()
	{
		try
		{
			if (document.edit.imageName[document.edit.imageName.selectedIndex].value != "")
			{
				document.edit.submit();
			}
		}
		catch (e)
		{
			reportError("checkManageImages()",e);
			
			return (false);
		}
	}
	
	
	function checkManageCarriers()
	{
		try
		{
			if (document.edit.carrierName.value == "")
			{
				document.edit.carrierName.focus();
				alert ("Sorry - you need to enter a Carrier Name.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkManageCarriers()",e);
			
			return (false);
		}
	}
	
	function checkManageCountries()
	{
		try
		{
			if (document.edit.countryName.value == "")
			{
				document.edit.countryName.focus();
				alert ("Sorry - you need to enter a Country Name.");
				return (false);
			}
			
			if (document.edit.countryISOCode.value == "")
			{
				document.edit.countryISOCode.focus();
				alert ("Sorry - you need to enter a Country ISO Code.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkManageCountries()",e);
			
			return (false);
		}
	}
	
	function checkManageCurrency()
	{
		try
		{
			if (document.edit.currencyTypeName.value == "")
			{
				document.edit.currencyTypeName.focus();
				alert ("Sorry - you need to enter a Currency Name.");
				return (false);
			}
			
			if (document.edit.currencyTypeISOCode.value == "")
			{
				document.edit.currencyTypeISOCode.focus();
				alert ("Sorry - you need to enter a Currency ISO Code.");
				return (false);
			}
			
			if (document.edit.currencyTypeSymbol.value == "")
			{
				document.edit.currencyTypeSymbol.focus();
				alert ("Sorry - you need to enter a Currency Symbol.");
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkManageCountries()",e);
			
			return (false);
		}
	}
	
	function checkFileUpload()
	{
		try
		{
			if (document.upload.uploadImage.value == "")
			{
				document.upload.uploadImage.focus();
				alert ("Sorry - you need to select a file to be uploaded.");
				return (false);
			}
			return (true);
		}
		catch (e)
		{
			reportError("checkFileUpload()",e);
			
			return (false);
		}
	}
	
	function checkAdminSearch()
	{
		try
		{
			
			if (document.manage.searchAccountTypeId[document.manage.searchAccountTypeId.selectedIndex].value == -1)
			{
				alert ("You need to enter an Account Type.");
				document.manage.searchAccountTypeId.focus();
				return (false);
			}
		
			if (document.manage.searchAccountStatusId[document.manage.searchAccountStatusId.selectedIndex].value == -1)
			{
				alert ("You need to enter an Account Status.");
				document.manage.searchAccountStatusId.focus();
				return (false);
			}
		
			return(true)
		}
		catch (e)
		{
			reportError("checkAdminSearch()",e);
			
			return (false);
		}
		
	}
	
	function checkAdminNewsletter()
	{
		var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
		
		try
		{
		
			if (btnSearchClick)
			{
				if (document.manage.searchAccountTypeId[document.manage.searchAccountTypeId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Type.");
					document.manage.searchAccountTypeId.focus();
					return (false);
				}
		
				if (document.manage.searchAccountStatusId[document.manage.searchAccountStatusId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Status.");
					document.manage.searchAccountStatusId.focus();
					return (false);
				}
			}
			else
			{
				if (!emailFilter.test(document.manage.accountEmailAddress.value))
				{
					alert ("You need to enter a valid Email Address.");
					document.manage.accountEmailAddress.focus();
					return (false);
				}
				
				if (document.manage.accountAccountTypeId[document.manage.accountAccountTypeId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Type.");
					document.manage.accountAccountTypeId.focus();
					return (false);
				}
		
				if (document.manage.accountAccountStatusId[document.manage.accountAccountStatusId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Status.");
					document.manage.accountAccountStatusId.focus();
					return (false);
				}
				
			}
		
			return(true)
		}
		catch (e)
		{
			reportError("checkAdminNewsletter()",e);
			
			return (false);
		}
	}
	
	function checkAdminStandard()
	{
		var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
		
		try
		{
		
			if (btnEditClick)
			{
				// nothing
			}
			else if (btnSearchClick)
			{
				if (document.manage.searchAccountTypeId[document.manage.searchAccountTypeId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Type.");
					document.manage.searchAccountTypeId.focus();
					return (false);
				}
		
				if (document.manage.searchAccountStatusId[document.manage.searchAccountStatusId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Status.");
					document.manage.searchAccountStatusId.focus();
					return (false);
				}
			}
			else
			{
				if (!emailFilter.test(document.manage.accountEmailAddress.value))
				{
					alert ("You need to enter a valid Email Address.");
					document.manage.accountEmailAddress.focus();
					return (false);
				}
				
				if (document.manage.accountPassword.value.length < 5)
				{
					document.manage.accountPassword.focus();
					alert ("Sorry - the password needs to be at least 5 characters long.");
					return (false);
				}
				
				if (document.manage.accountAccountTypeId[document.manage.accountAccountTypeId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Type.");
					document.manage.accountAccountTypeId.focus();
					return (false);
				}
		
				if (document.manage.accountAccountStatusId[document.manage.accountAccountStatusId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Status.");
					document.manage.accountAccountStatusId.focus();
					return (false);
				}
				
			}
		
			return(true)
		}
		catch (e)
		{
			reportError("checkAdminStandard()",e);
			
			return (false);
		}
	}
	
	function checkAdminTrade()
	{
		
		var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
		var colInput, lOneChecked
		
		try
		{
		
			if (btnEditClick)
			{
				// nothing
			}
			else if (btnSearchClick)
			{
				if (document.manage.searchAccountTypeId[document.manage.searchAccountTypeId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Type.");
					document.manage.searchAccountTypeId.focus();
					return (false);
				}
		
				if (document.manage.searchAccountStatusId[document.manage.searchAccountStatusId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Status.");
					document.manage.searchAccountStatusId.focus();
					return (false);
				}
			}
			else
			{
				if (!emailFilter.test(document.manage.accountEmailAddress.value))
				{
					alert ("You need to enter a valid Email Address.");
					document.manage.accountEmailAddress.focus();
					return (false);
				}
				
				if (document.manage.accountPassword.value.length < 5)
				{
					document.manage.accountPassword.focus();
					alert ("Sorry - the password needs to be at least 5 characters long.");
					return (false);
				}
				
				if (document.manage.accountCompanyName.value == "")
				{
					document.manage.accountCompanyName.focus();
					alert ("Sorry - the Company Name needs to be entered.");
					return (false);
				}
				
				if (document.manage.accountAccountTypeId[document.manage.accountAccountTypeId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Type.");
					document.manage.accountAccountTypeId.focus();
					return (false);
				}
		
				if (document.manage.accountAccountStatusId[document.manage.accountAccountStatusId.selectedIndex].value == -1)
				{
					alert ("You need to enter an Account Status.");
					document.manage.accountAccountStatusId.focus();
					return (false);
				}
				
				colInput = document.getElementsByTagName("input");

				for (var i=0;i < colInput.length;i++)
				{
					if (colInput[i].type == "radio")
					{
						if (colInput[i].checked)
						{
							lOneChecked = true;
						}
					}
				}
				
				if (!lOneChecked)
				{
					alert ("You need to enter a Trader Price Field.");
					return (false);
				}
			}
		
			return(true)
		}
		catch (e)
		{
			reportError("checkAdminTrade()",e);
			
			return (false);
		}
		
	}
	
	function checkManageTraderPrice()
	{
		try
		{
			if (document.manage.traderPrice.value == "")
			{
				alert ("You need to enter the Trader's Price.");
				document.manage.traderPrice.focus();
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkManageTraderPrice()",e);
			
			return (false);
		}
	}
	
	function checkManageCostCenters()
	{
		try
		{
			if (document.addEdit.costCenterName.value == "")
			{
				alert ("You need to enter the cost center name.");
				document.addEdit.costCenterName.focus();
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkManageCostCenters()",e);
			
			return (false);
		}
	}
	
	function checkManageNodeSecurity()
	{
		try
		{
			if (btnDeleteClick)
			{
				btnDeleteClick = false;
				return (checkSure("Are you REALLY SURE you wish to DELETE this security GROUP ?"));
			}
			else if (btnDelete2Click)
			{
				btnDelete2Click = false;
				
				if (document.addEdit.associateNewSecurity[document.addEdit.associateNewSecurity.selectedIndex].value != "-1")
				{
					return (checkSure("Are you REALLY SURE you wish to DELETE this security ITEM ?"));
				}
				else
					return (false);
			}
			else if (btnDelete3Click)
			{
				 btnDelete3Click = false;
				
				if (document.addEdit.addDeleteSecurityItemId[document.addEdit.addDeleteSecurityItemId.selectedIndex].value != "-1")
				{
					return (checkSure("Are you REALLY SURE you wish to DIS-ASSOCIATE this security ITEM ?"));
				}
				else
					return (false);
			}
			
			if (document.addEdit.securityGroupName.value == "")
			{
				alert ("You need to enter the node security group name.");
				document.addEdit.securityGroupName.focus();
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkManageNodeSecurity()",e);
			
			return (false);
		}
	}
	
	function checkManageItemSecurity()
	{
		try
		{
			if (document.addEdit.securityItemName.value == "")
			{
				alert ("You need to enter the node security item name.");
				document.addEdit.securityItemName.focus();
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkManageItemSecurity()",e);
			
			return (false);
		}
	}
	
	function checkFindItem()
	{
		try
		{
			if (document.find.txtSearchForItemName.value == "")
			{
				alert ("You need to enter the Item Name to find.");
				document.find.txtSearchForItemName.focus();
				return (false);
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkFindItem()",e);
			
			return (false);
		}
	}
	
	function checkImportSetup()
	{
		try
		{
			if (btnCheckImport)
			{
				if (document.importData.importFileName.value == "")
				{
					alert ("You need to select the excel file to upload.");
					document.importData.importFileName.focus();
					return (false);
				}
			
				if (document.importData.importSheetName.value == "")
				{
					alert ("You need to enter the excel sheet name within the excel file.");
					document.importData.importSheetName.focus();
					return (false);
				}
			
				if (document.importData.partNumberFieldName.value == "")
				{
					alert ("You need to enter the part number field name within the excel file.");
					document.importData.partNumberFieldName.focus();
					return (false);
				}
			
				if (document.importData.descriptionFieldName.value == "")
				{
					alert ("You need to enter the description field name within the excel file.");
					document.importData.descriptionFieldName.focus();
					return (false);
				}
			
				if (document.importData.weightFieldName.value == "")
				{
					alert ("You need to enter the weight field name within the excel file.");
					document.importData.weightFieldName.focus();
					return (false);
				}
			
				if (document.importData.costFieldName.value == "")
				{
					alert ("You need to enter the cost field name within the excel file.");
					document.importData.costFieldName.focus();
					return (false);
				}
				
				if (document.importData.dealerCostFieldName.value == "")
				{
					alert ("You need to enter the dealer cost field name within the excel file.");
					document.importData.dealerCostFieldName.focus();
					return (false);
				}
					
				btnCheckImport = false;
			}
			
			return (true);
		}
		catch (e)
		{
			reportError("checkImportSetup()",e);
			
			return (false);
		}
	}
	
	function checkManagePriceField()
	{
		try
		{
			return (true);
		}
		catch (e)
		{
			reportError("checkManagePriceField()",e);
			
			return (false);
		}
	}
	
	function highlight(object)
	{
	
		try
		{
			var links = document.getElementsByTagName("A");

			if (document.all)
			{
				if (document.all(object).className == 'highlighted')
					gToggle = true;
				else
					gToggle = false;
			}
			else if (document.getElementById)
			{
				if (document.getElementById(object).className == 'highlighted')
					gToggle = true;
				else
					gToggle = false;
			}
			
			for (var i=0;i < links.length;i++)
				links[i].className = 'unHighlighted';
		
			// IE+
			if (document.all)
			{
				document.all(object).className = 'highlighted';
			}
			// NS6+
			else if (document.getElementById)
			{
				document.getElementById(object).className = 'highlighted';
			}
		}
		catch (e)
		{
			reportError("highlight(object)",e);
		}
	
	}

	function show(object)
	{
		try
		{
			// IE4+
			if (document.all)
			{
				document.all(object).className = 'showMe';
			}
			// NS6+
			else if (document.getElementById)
			{
				document.getElementById(object).className = 'showMe';
			}
		}
		catch (e)
		{
			reportError("show(object)",e);
		}
	}

	function hide(object)
	{
		try
		{
			// IE4+
			if (document.all)
			{
				document.all(object).className = 'hideMe';
			}
			// NS6+
			else if (document.getElementById)
			{
				document.getElementById(object).className = 'hideMe';
			}
		}
		catch (e)
		{
			reportError("hide(object)",e);
		}
	}
	
	function toggle(object, toggleGraphix)
	{
		try
		{
			var imgId;
			var linkId;
			
			imgId = object.replace ("node","img");
			linkId = "link" + object;
		
			// If in public mode, then check that the node is physical (not root) before toggling
		
			// IE4+
			if (document.all)
			{
				if ((gToggle || gPublic) || (gOverRide && !gPublic))
				{
					if (document.all(object).className == 'showMe')
					{
						if	((document.all(linkId).name == 'physical' && gPublic) || document.all(linkId).className == 'highlighted')
						{
							document.all(object).className = 'hideMe';
		
							if (toggleGraphix)
							{
								document.all(imgId).src = "/images/plus.gif";
							}
						}
					}
					else
					{
						document.all(object).className = 'showMe';
					
						if (toggleGraphix)
						{
							document.all(imgId).src = "/images/minus.gif";
						}
					}
				}
			}
			// NS6+
			else if (document.getElementById)
			{
				if ((gToggle || gPublic) || (gOverRide && !gPublic))
				{
					if (document.getElementById(object).className == 'showMe')
					{
						if ((document.getElementById(linkId).name == 'physical' && gPublic) || document.getElementById(linkId).className == 'highlighted')
						{
							document.getElementById(object).className = 'hideMe';
					
							if (toggleGraphix)
							{
								document.getElementById(imgId).src = "/images/plus.gif";
							}
						}
					}
					else
					{
						document.getElementById(object).className = 'showMe';
					
						if (toggleGraphix)
						{
							document.getElementById(imgId).src = "/images/minus.gif";
						}
					}
				}
			}
		}
		catch (e)
		{
			reportError("toggle(object,toggleGraphix)" + object,e);
		}
	}
	
	function popUp(where,what,x,y)
	{
		try
		{
		
			var param;
			
			if (where == "worldpay")
				param = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=" + x + ",height=" + y;
			else
				param = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + x + ",height=" + y;

			window.open (what,where,param);
		}
		catch (e)
		{
			reportError("popUp(where,what,x,y)",e);
		}
	}

	function showProductUpdateNav(viewerPage,navPage)
	{
		try
		{
			displayIFrame("viewer",viewerPage);
			displayIFrame("nav",navPage);
		}
		catch (e)
		{
			reportError("showProductUpdateNav(viewerPage,navPage)",e);
		}
	}

	function displayIFrame(iFrame,url)
	{
		try
		{
			window.parent[iFrame].document.location.href = url;
		}
		catch (e)
		{
			reportError("displayIFrame(iFrame,url)",e);
		}
	}

	function displayPage(url)
	{
		try
		{
			document.location.href = url;
		}
		catch (e)
		{
			reportError("displayPage(url)",e);
		}
	}

	function makePayment(pChangeAction)
	{
		try
		{
			if (pChangeAction)
			{
			
				popUp("worldpay","/account/makingPayment.htm",600,600);
				document.view.target = "worldpay";
				document.view.action = "https://select.worldpay.com/wcc/purchase";
				
			}
			
			document.view.submit();	
			
		}
		catch (e)
		{
			reportError("makePayment",e);
		}
	}

	function checkSure(msg)
	{
		try
		{
			var ok;
		
			ok = confirm (msg);
	
			if (ok)
			{
				return (true);
			}
			else
			{
				return (false);
			}
		}
		catch (e)
		{
			reportError("checkSure()",e);
		}
	}
	
	function refreshMainWindow(page,queryString)
	{
		try
		{
			if (flagId != "")
			{
				window.opener.document.location.href = page + queryString;
			}
			else
			{
				window.opener.document.location.href = page;
			}
		
			window.close();
		}
		catch (e)
		{
			reportError("refreshMainWindow(page,queryString)",e);
		}
	}
	
	function trim(what)
	{
		try
		{
			if (what != "")
			{
				while(what.charAt(0)==' ')
					what = what.substring(1,what.length);
		
				while(what.charAt(what.length-1)==' ')
					what = what.substring(0,what.length-1);
			}
			
			return (what);
		}
		catch (e)
		{
			reportError("trim(what)",e);
		}
	}
	
	function checkInteger(what)
	{
		try
		{
			var valid = "0123456789";
		
			what = trim(what);
		
			if (what == "")
			{
				return (false);
			}
		
			for (outer = 0; outer <= what.length-1; outer++)
			{
				if (valid.indexOf(""+what.charAt(outer)) == -1)
				{
					return (false);
				}
			}
		
			return (true);
		}
		catch (e)
		{
			reportError("checkInteger(what)",e);
		}
	}
	
	function checkDecimal(what)
	{
		try
		{
			var valid = "0123456789.";
		
			what = trim(what);
		
			if (what == "")
			{
				return (false);
			}
		
			for (outer = 0; outer <= what.length-1; outer++)
			{
				if (valid.indexOf(""+what.charAt(outer)) == -1)
				{
					return (false);
				}
			}
			
			if (what.indexOf(".") != -1)
			{
				if (what.length < 2)
				{
					return (false)
				}
				
				if ("" + what.charAt(0).indexOf(".")!= -1 || "" + what.charAt(what.length-1).indexOf(".") != -1)
				{
					return (false);
				}
			}
		
			return (true);
		}
		catch (e)
		{
			reportError("checkDecimal(what)",e);
		}
	}
	
	function getInteger(what)
	{
		try
		{
			var valid = "0123456789";
		
			what = trim(what);
		
			if (what == "")
			{
				return (NaN);
			}
		
			for (outer = 0; outer <= what.length-1; outer++)
			{
				if (valid.indexOf(""+what.charAt(outer)) == -1)
				{
					return (NaN);
				}
			}
		
			return (parseInt(what));
		}
		catch (e)
		{
			reportError("getInteger(what)",e);
		}
	}
	
	function showDIVs(path,admin)
	{
		try
		{
			var nodeList = path;
	
			gPublic = !admin;
			gOverRide = admin;
	
			if (nodeList != "")
			{
				var splitList = nodeList.split(";");
			
				for (i=0;i<=splitList.length -1;i++)
				{
					if (splitList[i] != "")
					{
						toggle(splitList[i],true);
						
						if (!gPublic)
							highlight("link" + splitList[i]);
					}
				}
			}
			
			gOverRide = false;
			
		}
		catch (e)
		{
			reportError("showDIVs(path,admin)",e);
		}
	}
	
	function bringWindowForward()
	{
		try
		{
			window.focus();
		}
		catch (e)
		{
			reportError("bringWindowForward()",e);
		}
	}
	
	function addBookmark()
	{
		window.external.addFavorite (window.location,document.title);
	}
