<!--
function addEvent(Groups) {
	var GroupArray
	GroupArray = Groups.split('@@');
	var options
	options="";
	var ni = document.getElementById('myDiv');
	var n2 = document.getElementById('more');
	var numi = document.getElementById('theValue');
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "my"+num+"Div";
	var newdiv = document.createElement('div');
	newdiv.setAttribute("id",divIdName);
	for (var i = 0; i < GroupArray.length - 1; i++) {
		options = options + "<option value='" + GroupArray[i] + "' title='" + GroupArray[i] +  "'>" + GroupArray[i] + "</option>";
		
	}
	if (num == 3) {
		n2.style.display = "none";
	}
// newdiv.innerHTML = "Element Number "+num+" has been added! <a href=\"javascript:;\" onclick=\"removeEvent(\'"+divIdName+"\')\">Remove the div &quot;"+divIdName+"&quot;</a>";					
	newdiv.innerHTML = "<table border='0' cellspacing='0' cellpadding='0'><tr><td width='120'><p>Select product :</p></td><td><select name='product_group"+num+"' class='formobjects' title='Product Group' onChange='JavaScript: document.enquiry.submit()'><option value='Select' title='Select the Group' selected}; )?gt;>Select Group</option>"+options+"</select></td><td colspan='2'>&nbsp;&nbsp;<select name='product"+num+"' class='formobjects' title='Products' onChange='JavaScript: document.enquiry.submit()'><option selected value='Select' title='Select the Products'>Select product</option></select></td></tr><tr><td>&nbsp;</td><td nowrap colspan='2' class='NavGroup'><span class='navarrows'>&raquo;</span><a href=\"javascript:;\" onclick=\"removeEvent(\'"+divIdName+"\')\">remove item </a></td></tr></table>";
ni.appendChild(newdiv);
	}

	function amendEvent(Groups, Products, Selected_Product, Selected_Group, number) {

		var d = document.getElementById("myDiv");
		
		var GroupArray
		GroupArray = Groups.split('@@');
		ProductsArray = Products.split('@@');
		var options;
		options = "";
		theproducts = ""
		var ni = document.getElementById('myDiv');
		var n2 = document.getElementById('more');
		var numi = document.getElementById('theValue');
		var num = (document.getElementById("theValue").value -1)+ 2;
		numi.value = num;
		var divIdName = "my"+num+"Div";
		var newdiv = document.createElement('div');
		newdiv.setAttribute("id",divIdName);
		
		for (var i = 0; i < GroupArray.length - 1; i++) {
			options = options + "<option value='" + GroupArray[i] + "' title='" + GroupArray[i] + "'";
			if (Selected_Group == GroupArray[i] ) {
				options = options + " selected";
			}
			options = options + ">" + GroupArray[i] + "</option>";	
		}

		for (var i = 0; i < ProductsArray.length - 1; i++) {
			theproducts = theproducts + "<option value='" + ProductsArray[i] + "' title='" + ProductsArray[i] +  "'";
		
			if (Selected_Product == ProductsArray[i] ) {
				theproducts = theproducts + " selected";
			}
			theproducts = theproducts + ">" + ProductsArray[i] + "</option>";	
		}
		if (num == 3) {
			n2.style.display = "none";
		}

// newdiv.innerHTML = "Element Number "+num+" has been added! <a href=\"javascript:;\" onclick=\"removeEvent(\'"+divIdName+"\')\">Remove the div &quot;"+divIdName+"&quot;</a>";					
		newdiv.innerHTML = "<table border='0' cellspacing='0' cellpadding='0'><tr><td width='120'><p>Select product :</p></td><td><select name='product_group"+num+"' class='formobjects' title='Product Group' onChange='JavaScript: document.enquiry.submit()'><option value='Select' title='Select the Group' selected}; )?gt;>Select Group</option>"+options+"</select></td><td colspan='2'>&nbsp;&nbsp;<select name='product"+num+"' class='formobjects' title='Products' onChange='JavaScript: document.enquiry.submit()'><option selected value='Select' title='Select the Products'>Select product</option>"+theproducts+"</select></td></tr><tr><td>&nbsp;</td><td nowrap colspan='2' class='NavGroup'><span class='navarrows'>&raquo;</span><a href=\"javascript:;\" onclick=\"removeEvent(\'"+divIdName+"\')\">remove item </a></td></tr></table>";
		ni.appendChild(newdiv);
	}

	function removeEvent(divNum) {
		var n2 = document.getElementById('more');
		var d = document.getElementById('myDiv');
		var olddiv = document.getElementById(divNum);
		d.removeChild(olddiv);
		document.getElementById("theValue").value = document.getElementById("theValue").value -1;
		n2.style.display = "block";
	}

	function Change_To_Send() {
		var Name = document.enquiry.name.value.toString().toLowerCase();
		var Organisation = document.enquiry.organisation.value.toString().toLowerCase();
	 	var Address = document.enquiry.address.value.toString().toLowerCase();
		var Country = document.enquiry.country.value.toString().toLowerCase();
		var Postcode = document.enquiry.postcode.value.toString().toLowerCase();
		var Comments = document.enquiry.comments.value.toString().toLowerCase();
		valid = true; // assume valid
		if (trim(document.enquiry.enquiry_type.value) !== "More Information" &  trim(document.enquiry.enquiry_type.value) !== "Quote" & trim(document.enquiry.enquiry_type.value) !== "Free demonstration" & trim(document.enquiry.enquiry_type.value) !== "Telephone") {
			valid = false; 
			alert('Please select the type of enquiry!');
			document.enquiry.enquiry_type.focus(); 	
		}
  		else if (!check_valid_essential_contents(document.enquiry.name.value)) {
    		valid = false; 
			alert('Please enter a valid name!');
        	document.enquiry.name.focus(); 		
		}
		else if (Name.indexOf("http:") > -1 || Name.indexOf("https:") > -1) {
    		valid = false; 
			alert('Please enter a valid name!');
        	document.enquiry.name.focus(); 		
		}
		else if (!check_valid_essential_contents(document.enquiry.organisation.value)) {
    		valid = false; 
			alert('Please enter a valid organisation name!');
        	document.enquiry.organisation.focus(); 		
		}	
		else if (Organisation.indexOf("http:") > -1 || Organisation.indexOf("https:") > -1) {
    		valid = false; 
			alert('Please enter a valid organisation name!');
        	document.enquiry.organisation.focus(); 		
		}
		else if (!check_valid_nonessential_contents(document.enquiry.address.value)) {
    		valid = false; 
			alert('Please enter a valid address!');
        	document.enquiry.organisation.focus(); 		
		}
		else if (Address.indexOf("http:") > -1 || Address.indexOf("https:") > -1) {
    		valid = false; 
			alert('Please enter a valid address!');
        	document.enquiry.address.focus(); 		
		}
		else if (!check_valid_nonessential_contents(document.enquiry.country.value)) {
    		valid = false; 
			alert('Please enter a valid country!');
        	document.enquiry.country.focus(); 		
		}
		else if (Country.indexOf("http:") > -1 || Country.indexOf("https:") > -1) {
    		valid = false; 
			alert('Please enter a valid country!');
        	document.enquiry.country.focus(); 		
		}
		else if (!check_valid_nonessential_contents(document.enquiry.postcode.value)) {
    		valid = false; 
			alert('Please enter a valid postcode!');
        	document.enquiry.postcode.focus(); 		
		}
			else if (Postcode.indexOf("http:") > -1 || Postcode.indexOf("https:") > -1) {
    		valid = false; 
			alert('Please enter a valid postcode!');
        	document.enquiry.postcode.focus(); 		
		}
		else if (!check_valid_nonessential_telephone_contents(document.enquiry.telephone.value)) {
    		valid = false; 
			alert('Please enter a valid telephone number!');
        	document.enquiry.telephone.focus(); 		
		}
		else if (!check_valid_nonessential_telephone_contents(document.enquiry.fax.value)) {
    		valid = false; 
			alert('Please enter a valid fax number!');
        	document.enquiry.fax.focus(); 		
		}
		else if (!check_valid_email_contents(document.enquiry.email.value)) {
			valid = false; 
			document.enquiry.email.focus(); 
		}
		else if (!check_valid_nonessential_contents(document.enquiry.comments.value)) {
    		valid = false; 
			alert('Please enter a valid enquiry!');
        	document.enquiry.comments.focus(); 		
		}
		else if (Comments.indexOf("http:") > -1 || Comments.indexOf("https:") > -1) {
    		valid = false; 
			alert("Sorry  - to try and stop spam the letters 'https:' or 'http:' is not allowed to be entered as part of the enquiry!");
        	document.enquiry.comments.focus(); 		
		}
		else if ((document.enquiry.Captcha_Answer.value).toLowerCase() !== "imas" ) {
			valid = false; 
			alert('Please correctly indentify the letters!');
			document.enquiry.Captcha_Answer.focus(); 
		}
	
		if (valid == true) {
			document.getElementById("send").value = "Yes";		
			document.enquiry.submit();	// un-comment to submit form
		}
	}

	
	function check_valid_email_contents(inputbox) {
			if (inputbox == "") {
				alert("Please complete a valid Email Address");
				return false
			}
			
			var teststring 

			teststring = trim(inputbox.toString())
			
			if (isblank(teststring)) {
				alert("Please complete a valid Email Address");
				return false
			}		

			// Convert inputbox to string			
			
			outputstring = removeblank(teststring)

			// Check for at least 7 chrs

			if (outputstring.length <= 6){
				alert("The email address you have entered is not in a valid format");				
				return false;
			}

			// Check for Illegal Characters

			var illegalchrs = new Array("*","£","$","!")

			var counter
	
			for (counter=0; counter <= illegalchrs.length; counter++){
				if (outputstring.indexOf(illegalchrs[counter]) != -1){
				alert("You have entered an invalid character in your email address");				
				return false;
				}				
			}

			// Check for the @ and the dots


			// First check that they both exist

			var atpositionback = outputstring.lastIndexOf("@")

			var dotpositionback = outputstring.lastIndexOf(".")

			var atpositionfront = outputstring.indexOf("@")


			if (atpositionback == -1){
				alert("The email address you have entered is not in a valid format");				
				return false;
			}

			if (dotpositionback == -1){
				alert("The email address you have entered is not in a valid format");				
				return false;
			}

			if (atpositionfront != atpositionback){
				alert("The email address you have entered is not in a valid format");				
				return false;
			}

			if (atpositionback > dotpositionback){
				alert("The email address you have entered is not in a valid format");				
				return false;
			}				
		return true
	}	
	
	function check_valid_essential_contents(inputbox) {
		var teststring
		var outputstring
		teststring = trim(inputbox.toString())
		if (inputbox == "") {
			return false
		}
		if (isblank(teststring)) {
			return false
		}
		outputstring = removeblank(teststring)	
		if (!isNaN(outputstring)) {
			return false
		}
		if (outputstring.length < 2) {
			return false
		}			
		return true
	}	
		
	function check_valid_nonessential_contents(inputbox) {
		var teststring
		var outputstring
		teststring = trim(inputbox.toString())
		if (inputbox == "") {
			return true
		}
		if (isblank(teststring)) {
			return true
		}
		outputstring = removeblank(teststring)	
		if (!isNaN(outputstring)) {
			return false
		}
		if (outputstring.length < 2) {
			return false
		}			
		return true
	}	
	
	function isblank(inbox) {
		for (var i = 0; i <  inbox.length; i++) {
			var c = inbox.charAt(i)
			if (c != " "){		
				return false;
			}
		}
		return true
	}
	
	function removeblank(inbox) {
		var output = ""
		for( var i = 0; i <  inbox.length; i++) {
			var c = inbox.charAt(i)
			if (c != " "){		
				output = output + c			
			}
		}
		return output
	}
	
	function trim(str) {	
		return str.replace(/^\s*|\s*$/g,"");
	}


	var never = new Date()
    never.setTime(never.getTime() + 2000*24*60*60*1000);


// name is a string of the name of your cookie
// value is the value corresponding to name
	function SetCookie(name, value) { 
	
		var expString = "; expires=" + never.toGMTString();
		document.cookie = name + "=" + escape(value) + expString;
	}

	// returns value of cookie or null if cookie does not exist
	function GetCookie(name) 
	{
		var result = null;
		var myCookie = " " + document.cookie + ";";
		var searchName = " " + name + "=";
		var startOfCookie = myCookie.indexOf(searchName);
		var endOfCookie;
	
		if (startOfCookie != -1) 
		{
			startOfCookie += searchName.length; // skip past name of cookie
			endOfCookie = myCookie.indexOf(";", startOfCookie);
			result = unescape(myCookie.substring(startOfCookie, endOfCookie));
		}
		return result;
	}

	use_cookies = "unsure";

	function saveValue(element) { 

		if (document.images && use_cookies == "unsure")
		use_cookies = (confirm("Will you allow the values you enter into this form "
					   +"to be stored as cookies so that those values will be pre-filled the next "
					   +"time you return to this page?") ? "yes":"no");
		if (document.images && use_cookies == "yes") 
		{
			if ((element.type == "text")
			|| (element.type == "password")
			|| (element.type == "textarea")
			|| (element.type == "radio")) 
			{
				val = element.value;
			} 
			else if (element.type.indexOf("select") != -1) 
			{
				val = "";
				for(k=0;k<element.length;k++)
				if (element.options[k].selected)
					val += k+" ";
			} 
			else if (element.type == "checkbox") 
			{
				val = element.checked;
			}
			SetCookie("memory_"+element.form.name+"_"+element.name,val);
		}	
	}

	function storedValues() 
	{
		if (document.images) 
		{ // only do it in JavaScript 1.1 browsers
			for (i=0;i<document.forms.length;i++) {
			for (j=0;j<document.forms[i].elements.length; j++) 
				{
				cookie_name = "memory_"+document.forms[i].name+"_"
					+document.forms[i].elements[j].name;
				val = GetCookie(cookie_name);
				if (val) 
					{
					if ((document.forms[i].elements[j].type == "text")
						|| (document.forms[i].elements[j].type == "password")
						|| (document.forms[i].elements[j].type == "textarea")) 
						{
						document.forms[i].elements[j].value = val;
						} 
					else if (document.forms[i].elements[j].type.indexOf("select") != -1) 
						{
						document.forms[i].elements[j].selectedIndex = -1;
						while (((pos = val.indexOf(" ")) != -1) && (val.length > 1)) 
							{
							sel = parseInt(val.substring(0,pos));
							val = val.substring(pos+1,val.length);
							if (sel < document.forms[i].elements[j].length)
								document.forms[i].elements[j].options[sel].selected = true;
							}
						} 
					else if (document.forms[i].elements[j].type == "checkbox") 
						{
						document.forms[i].elements[j].checked = val;
						} 
					else if (document.forms[i].elements[j].type == "radio") 
						{
						if (document.forms[i].elements[j].value == val)
							document.forms[i].elements[j].checked = true;
						}
					}
				}
			}
		}
	}

	function check_valid_nonessential_telephone_contents(inputbox) {
		var teststring
		teststring  = trim(inputbox.toString())
		
		if (inputbox == "") {
			return true
		}
		
		if (isblank(teststring)) {
			return true
		}
				
		outputstring = removeblank(teststring)		
		for (var i = 0; i <  outputstring.length; i++) {			
			var c = outputstring.charAt(i)			
			if ((c != " ") & (c != "-") & (c != ".") & (c != "+") & c != "(" & c != ")" & isNaN(c)){		
				return false
			}
		}
		
		if (outputstring.length < 10) {
			return false
		}
							
		return true
	}
//-->