	function postFile(type, url, parmData) {
		if (window.XMLHttpRequest) {              
			AJAX=new XMLHttpRequest();              
		} else {                                  
			AJAX=new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (AJAX) {
			if (type == 'POST') {
  			AJAX.open("POST", url, false);
	  		AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		  	AJAX.send(parmData);
			} else {
  			AJAX.open("GET", url, false);
	  		AJAX.send(null);
			}
		  return AJAX.responseText;
		} else {
			 return false;
		}
	}

	//uk postalcode
	function checkPostCode (toCheck) {
		// Permitted letters depend upon their position in the postcode.
		var alpha1 = "[abcdefghijklmnoprstuwyz]";                       // Character 1
		var alpha2 = "[abcdefghklmnopqrstuvwxy]";                       // Character 2
		var alpha3 = "[abcdefghjkstuw]";                                // Character 3
		var alpha4 = "[abehmnprvwxy]";                                  // Character 4
		var alpha5 = "[abdefghjlnpqrstuwxyz]";                          // Character 5
		
		// Array holds the regular expressions for the valid postcodes
		var pcexp = new Array ();
	
		// Expression for postcodes: AN NAA, ANN NAA, AAN NAA, and AANN NAA
		pcexp.push (new RegExp ("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1,2})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));
		
		// Expression for postcodes: ANA NAA
		pcexp.push (new RegExp ("^(" + alpha1 + "{1}[0-9]{1}" + alpha3 + "{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));
	
		// Expression for postcodes: AANA  NAA
		pcexp.push (new RegExp ("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1}" + alpha4 +"{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));
		
		// Exception for the special postcode GIR 0AA
		pcexp.push (/^(GIR)(\s*)(0AA)$/i);
		
		// Standard BFPO numbers
		pcexp.push (/^(bfpo)(\s*)([0-9]{1,4})$/i);
		
		// c/o BFPO numbers
		pcexp.push (/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);
		
		// Overseas Territories
		pcexp.push (/^([A-Z]{4})(\s*)(1ZZ)$/i);
	
		// Load up the string to check
		var postCode = toCheck;
	
		// Assume we're not going to find a valid postcode
		var valid = false;
		
		// Check the string against the types of post codes
		for ( var i=0; i<pcexp.length; i++) {
			if (pcexp[i].test(postCode)) {
				// The post code is valid - split the post code into component parts
				pcexp[i].exec(postCode);
				// Copy it back into the original string, converting it to uppercase and
				// inserting a space between the inward and outward codes
				postCode = RegExp.$1.toUpperCase() + " " + RegExp.$3.toUpperCase();
				// If it is a BFPO c/o type postcode, tidy up the "c/o" part
				postCode = postCode.replace (/C\/O\s*/,"c/o ");
				// Load new postcode back into the form element
				valid = true;
				// Remember that we have found that the code is valid and break from loop
				break;
			}
		}
		// Return with either the reformatted valid postcode or the original invalid 
		// postcode
		if (valid) {return postCode;} else return false;
	}
	// End Uk Postalcode
	
	var ccErrorNo = 0;
	var ccErrors = new Array ()
	
	ccErrors [0] = "Unknown card type";
	ccErrors [1] = "No card number provided";
	ccErrors [2] = "Credit card number is in invalid format";
	ccErrors [3] = "Credit card number is invalid";
	ccErrors [4] = "Credit card number has an inappropriate number of digits";
	
	function checkCreditCard (cardnumber, cardname) {
			 
		// Array to hold the permitted card characteristics
		var cards = new Array();
	
		// Define the cards we support. You may add addtional card types.
		
		//  Name:      As in the selection box of the form - must be same as user's
		//  Length:    List of possible valid lengths of the card number for the card
		//  prefixes:  List of possible prefixes for the card
		//  checkdigit Boolean to say whether there is a check digit
		
		cards [0]  = {name: "Visa",             length: "13,16",                prefixes: "4",                                           checkdigit: true};
		cards [1]  = {name: "MasterCard",       length: "16",                   prefixes: "51,52,53,54,55",                              checkdigit: true};
		cards [2]  = {name: "DinersClub",       length: "14,16",                prefixes: "305, 36, 38, 54,55",                          checkdigit: true};
		cards [3]  = {name: "CarteBlanche",     length: "14",                   prefixes: "300,301,302,303,304,305",                     checkdigit: true};
		cards [4]  = {name: "American Express", length: "15",                   prefixes: "34,37",                                       checkdigit: true};
		cards [5]  = {name: "Discover",         length: "16",                   prefixes: "6011,622,64,65",                              checkdigit: true};
		cards [6]  = {name: "JCB",              length: "16",                   prefixes: "35",                                          checkdigit: true};
		cards [7]  = {name: "enRoute",          length: "15",                   prefixes: "2014,2149",                                   checkdigit: true};
		cards [8]  = {name: "Solo",             length: "16,18,19",             prefixes: "6334, 6767",                                  checkdigit: true};
		cards [9]  = {name: "Switch",           length: "16,18,19",             prefixes: "4903,4905,4911,4936,564182,633110,6333,6759", checkdigit: true};
		cards [10] = {name: "Maestro",          length: "12,13,14,15,16,18,19", prefixes: "5018,5020,5038,6304,6759,6761",               checkdigit: true};
		cards [11] = {name: "VisaElectron",     length: "16",                   prefixes: "417500,4917,4913,4508,4844",                  checkdigit: true};
		cards [12] = {name: "LaserCard",        length: "16,17,18,19",          prefixes: "6304,6706,6771,6709",                         checkdigit: true};

		// Establish card type
		var cardType = -1;
		for (var i=0; i<cards.length; i++) {
			// See if it is this card (ignoring the case of the string)
			if (cardname.toLowerCase () == cards[i].name.toLowerCase()) {
				cardType = i;
				break;
			}
		}
		// If card type not found, report an error
		if (cardType == -1) {
			 ccErrorNo = 0;
			 return false; 
		}
		// Ensure that the user has provided a credit card number
		if (cardnumber.length == 0)  {
			 ccErrorNo = 1;
			 return false; 
		}
		// Now remove any spaces from the credit card number
		cardnumber = cardnumber.replace (/\s/g, "");
		// Check that the number is numeric
		var cardNo = cardnumber
		var cardexp = /^[0-9]{13,19}$/;
		if (!cardexp.exec(cardNo))  {
			 ccErrorNo = 2;
			 return false;
		}
		// Now check the modulus 10 check digit - if required
		if (cards[cardType].checkdigit) {
			var checksum = 0;                                  // running checksum total
			var mychar = "";                                   // next char to process
			var j = 1;                                         // takes value of 1 or 2
			// Process each digit one by one starting at the right
			var calc;
			for (i = cardNo.length - 1; i >= 0; i--) {
				// Extract the next digit and multiply by 1 or 2 on alternative digits.
				calc = Number(cardNo.charAt(i)) * j;
				// If the result is in two digits add 1 to the checksum total
				if (calc > 9) {
					checksum = checksum + 1;
					calc = calc - 10;
				}
				// Add the units element to the checksum total
				checksum = checksum + calc;
				// Switch the value of j
				if (j ==1) {j = 2} else {j = 1};
			} 
			// All done - if checksum is divisible by 10, it is a valid modulus 10.
			// If not, report an error.
			if (checksum % 10 != 0)  {
			 ccErrorNo = 3;
			 return false; 
			}
		}  
		// The following are the card-specific checks we undertake.
		var LengthValid = false;
		var PrefixValid = false; 
		var undefined; 
		// We use these for holding the valid lengths and prefixes of a card type
		var prefix = new Array ();
		var lengths = new Array ();
		// Load an array with the valid prefixes for this card
		prefix = cards[cardType].prefixes.split(",");
		// Now see if any of them match what we have in the card number
		for (i=0; i<prefix.length; i++) {
			var exp = new RegExp ("^" + prefix[i]);
			if (exp.test (cardNo)) PrefixValid = true;
		}
	
		// If it isn't a valid prefix there's no point at looking at the length
		if (!PrefixValid) {
			 ccErrorNo = 3;
			 return false; 
		}
	
		// See if the length is valid for this card
		lengths = cards[cardType].length.split(",");
		for (j=0; j<lengths.length; j++) {
			if (cardNo.length == lengths[j]) LengthValid = true;
		}
	
		// See if all is OK by seeing if the length was valid. We only check the 
		// length if all else was hunky dory.
		if (!LengthValid) {
			 ccErrorNo = 4;
			 return false; 
		}
		
		// The credit card is in the required format.
		return true;
	}
	
	function checkForm(myForm) {
		retCODE = true;

    with (myForm) {

      document.getElementById("submit_error_message").style.display = "none";

			Contact0FirstName.style.background           = "#FFFFFF";
			Contact0LastName.style.background            = "#FFFFFF";
			Contact0Email.style.background               = "#FFFFFF";
			Contact0Phone1.style.background              = "#FFFFFF";
			Contact0StreetAddress1.style.background      = "#FFFFFF";
			Contact0StreetAddress2.style.background      = "#FFFFFF";
			Contact0City.style.background                = "#FFFFFF";
			Contact0Country.style.background             = "#FFFFFF";
			Contact0State.style.background               = "#FFFFFF";
			Contact0PostalCode.style.background          = "#FFFFFF";
			CreditCard0CardType.style.background         = "#FFFFFF";
			CreditCard0CardNumber.style.background       = "#FFFFFF";
			CreditCard0ExpirationMonth.style.background  = "#FFFFFF";
			CreditCard0ExpirationYear.style.background   = "#FFFFFF";
			CreditCard0VerificationCode.style.background = "#FFFFFF";
			Contact0Amount.style.background              = "#FFFFFF";

			if (Contact0FirstName.value==null || Contact0FirstName.value=="") {
				Contact0FirstName.style.background = "#FF9F9F";
				retCODE = false;
			}
			if (Contact0LastName.value==null || Contact0LastName.value=="") {
				Contact0LastName.style.background = "#FF9F9F";
				retCODE = false;
			}
			if (Contact0Email.value==null || Contact0Email.value=="") {
				Contact0Email.style.background = "#FF9F9F";
				retCODE = false;
			}
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Contact0Email.value) == false) {
				Contact0Email.style.background = "#FF9F9F";
				retCODE = false;
			}
			if (Contact0Phone1.value==null || Contact0Phone1.value=="" || (/^([-0-9+ ()) ]+)$/.test(Contact0Phone1.value) == false)) {
					Contact0Phone1.style.background = "#FF9F9F";
					retCODE = false;
			}
			if (CreditCard0CardType.value==null || CreditCard0CardType.value=="") {
				CreditCard0CardType.style.background = "#FF9F9F";
				retCODE = false;
			}
			if (CreditCard0CardNumber.value==null || CreditCard0CardNumber.value=="") {
				CreditCard0CardNumber.style.background = "#FF9F9F";
				retCODE = false;
			} else {
  			if (!checkCreditCard(CreditCard0CardNumber.value,CreditCard0CardType.value)) {
	  			CreditCard0CardType.style.background = "#FF9F9F";
		  		CreditCard0CardNumber.style.background = "#FF9F9F";
			  	retCODE = false;
  			}
			}

      var d = new Date();
			jahr  = d.getFullYear();
			monat = d.getMonth()+1;

      if ((CreditCard0ExpirationMonth.value==null || CreditCard0ExpirationMonth.value=="") || (CreditCard0ExpirationYear.value==jahr && CreditCard0ExpirationMonth.value < monat) || (CreditCard0ExpirationYear.value==null || CreditCard0ExpirationYear.value=="" || CreditCard0ExpirationYear.value<jahr) ) {
				document.getElementsByName('CreditCard0ExpirationMonth')[0].style.background = "#FF9F9F";
				document.getElementsByName('CreditCard0ExpirationYear')[0].style.background = "#FF9F9F";
				retCODE = false;
			}
			
			if ((/[\-\+\d]/.test(CreditCard0VerificationCode.value) == false) || (CreditCard0VerificationCode.value==null || CreditCard0VerificationCode.value=="" || CreditCard0VerificationCode.value.length<3 || CreditCard0VerificationCode.value.length>4)) {
				CreditCard0VerificationCode.style.background = "#FF9F9F";
				retCODE = false;
			}
			
			if (Contact0StreetAddress1.value==null || Contact0StreetAddress1.value=="") {
				if (Contact0StreetAddress2.value!=null && Contact0StreetAddress2.value!="") {
					Contact0StreetAddress1.value = Contact0StreetAddress2.value;
					Contact0StreetAddress2.value = "";
				}
			}
			if (Contact0StreetAddress1.value==null || Contact0StreetAddress1.value=="" || Contact0StreetAddress1.value.length<3) {
				Contact0StreetAddress1.style.background = "#FF9F9F";
				retCODE = false;
			}
			if (Contact0StreetAddress2.value!=null && Contact0StreetAddress2.value!="" && Contact0StreetAddress2.value.length<3) {
					Contact0StreetAddress2.style.background = "#FF9F9F";
					retCODE = false;
			}
			if (Contact0City.value==null || Contact0City.value=="") {
				Contact0City.style.background = "#FF9F9F";
				retCODE = false;
			}
			if (Contact0Country.value==null || Contact0Country.value=="") {
				Contact0Country.style.background = "#FF9F9F";
				retCODE = false;
			}
			if (Contact0Country.value=="United States" || Contact0Country.value== "Canada" || Contact0Country.value=="Australia") {
				if (Contact0State.value==null || Contact0State.value=="") {
					Contact0State.style.background   = "#FF9F9F";
					retCODE = false;
				}
			} else {
				Contact0State.value = 'na';
			}
			// Check PostalCode
			if (Contact0PostalCode.value==null || Contact0PostalCode.value=="") {
				Contact0PostalCode.style.background = "#FF9F9F";
				retCODE = false;
			} else {
				for (var i=0; i<array_countries.length; i++) {
					if (Contact0Country.value == array_countries[i].cname) { 
	
						if (array_countries[i].czip == "none") {
							if (/^([-0-9+ ) ]+)$/.test(Contact0PostalCode.value) == false){
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
						} else if (array_countries[i].czip=="GRP-US"){
							reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
							if (!reZip.test(Contact0PostalCode.value)) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
						} else if (array_countries[i].czip=="GRP-UK"){
							var myPostCode = Contact0PostalCode.value;
							if (!checkPostCode (myPostCode)) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							} 
						} else if (array_countries[i].czip=="GRP-CA"){
							strlen = Contact0PostalCode.value.length; 
							if (strlen!==6){
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
							Contact0PostalCode.value=Contact0PostalCode.value.toUpperCase();  // in case of lowercase
							if('ABCEGHJKLMNPRSTVXY'.indexOf(Contact0PostalCode.value.charAt(0))<0) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
							if('0123456789'.indexOf(Contact0PostalCode.value.charAt(1))<0) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
							if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(Contact0PostalCode.value.charAt(2))<0) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
							if('0123456789'.indexOf(Contact0PostalCode.value.charAt(3))<0) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
							if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(Contact0PostalCode.value.charAt(4))<0) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
							if('0123456789'.indexOf(Contact0PostalCode.value.charAt(5))<0) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
						} else if (array_countries[i].czip=="GRP-3") {
							reZip = new RegExp(/(^\d{3}$)/);
							if (!reZip.test(Contact0PostalCode.value)) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
						} else if (array_countries[i].czip=="GRP-4") {
							reZip = new RegExp(/(^\d{4}$)/);
							if (!reZip.test(Contact0PostalCode.value)) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
						} else if (array_countries[i].czip=="GRP-5") {
							reZip = new RegExp(/(^\d{5}$)/);
							if (!reZip.test(Contact0PostalCode.value)) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
						} else if (array_countries[i].czip=="GRP-6"){
							reZip = new RegExp(/(^\d{6}$)/);
							if (!reZip.test(Contact0PostalCode.value)) {
								Contact0PostalCode.style.background = "#FF9F9F";
								retCODE = false;
								break;
							}
						}
						break;
					}
				}//endfor
			}

			if (Contact0Amount.value==null || Contact0Amount.value=="" || Contact0Amount.value==0) {
				retCODE = false;
				Contact0Amount.style.background = "#FF9F9F";
			}

			if (Contact0Amount.value > 5000) {
				retCODE = false;
			  Contact0Amount.value = 5000;
				Contact0Amount.style.background = "#FFFFFF";
				alert("The maximum allowable amount per transaction is US $5000.\nWe apologize for the inconvenience.");
			}

		 if (!retCODE) {
				document.getElementById("submit_error_message").style.display = "block";
			} else {
				var orderButton = Order;
				if (orderButton != null) {
					orderButton.disabled = true;
				}
			}
		}
		return retCODE;
	}

	function changeState(){
		selected_country = document.getElementById('Contact0Country').value;
		if (selected_country == "US" || selected_country == "CA" || selected_country == "AU") {  
			if (selected_country == "US") {
				array_states = array_states_us;
			} else if (selected_country == "CA") {
				array_states = array_states_ca;
			} else if (selected_country == "AU") {
				array_states = array_states_au;
			}
			allStates = "<select class='default-input sale-text-req' name='Contact0State' id='Contact0State'><option value=''>Please select your State</option>";
			for (var i = 0; i < array_states.length; i++) {
				allStates += "<option value='" + array_states[i].scode + "'>" + array_states[i].sname + "</option>";
			}
			allStates += "</select>";
			document.getElementById('Contact0State1').innerHTML = allStates;
			document.getElementById('Contact0State').focus()
		} else {
			document.getElementById('Contact0State1').innerHTML = "<input type='hidden' name='Contact0State' id='Contact0State' value='na' style='display:none;' />";
			document.getElementById('Contact0PostalCode').focus()
		}
	}
