function confirmSubmit()
{
var agree=confirm("Are you certain you wish to delete this order?");
if (agree)
	return true ;
else
	return false ;
}

function validateEmpty(fld, nme) 
	 {
		var error = "";
	 
		if (fld.value.length == 0) 
		{
			fld.style.background = 'White';
			fld.style.border = '1px solid #a54399';
			error = "The required field (" + nme + ") has not been filled in.\n";
		} else {
			fld.style.background = 'White';

		}
		return error;  
	}

	function trim(s)
	{
	  return s.replace(/^\s+|\s+$/, '');
	}

	function validateEmail(fld) 
	{
		var error="";
		var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
		var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
		var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
	   
		if (fld.value == "") 
		{
			fld.style.background = 'White';
			fld.style.border = '1px solid #a54399';
			error = "You didn't enter an email address.\n";
		} else if (!emailFilter.test(tfld)) {              //test email for illegal characters
			fld.style.background = 'White';
			fld.style.border = '1px solid #a54399';
			error = "Please enter a valid email address.\n";
		} else if (fld.value.match(illegalChars)) {
			fld.style.background = 'White';
			fld.style.border = '1px solid #a54399';
			error = "The email address contains illegal characters.\n";
		} else {
			fld.style.background = 'White';
		}
		return error;
	}	
	
		function validatePhone(fld) 
		{
			var error = "";
			var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');    
		
		   if (fld.value == "") 
		   {
				error = "You didn't enter a phone number.\n";
				fld.style.background = 'white';
				fld.style.border = '1px solid #a54399';
			} else if (isNaN(parseInt(stripped))) {
				error = "The phone number contains illegal characters.\n";
				fld.style.border = '1px solid #a54399';
				fld.style.background = 'White';
			} else if (!(stripped.length >= 6)) {
				error = "The phone number is the wrong length.\n";
				fld.style.border = '1px solid #a54399';
				fld.style.background = 'White';
			}
			return error;
		}
		
		function validateLength(fld)
		{
			var error= "";
			var len_val = fld.value;
			var my_val = (parseInt(len_val, 10));
			if(my_val > 75)
			{
				error = "\nYour Company Info includes " + my_val + " words.\nPlease reduce the number to 75 or less";
				fld.style.background = 'Yellow';
			}
		return error;
		}
		
		function validateCountry(fld, nme)
		{
			var error= "";
			if (fld.value == "")
			{
			error = "\nYou have not chosen a country";
			fld.style.background = 'Yellow';
			}
			return error;
		}

<!-- BOF function to validate the enquiry form -->	
	 function validateFormOnSubmit(enqForm) 
	 {
		var reason = "";
		  reason += validateEmpty(enqForm.firstname, "First name");
		  reason += validateEmpty(enqForm.lastname, "Last name");
  		  reason += validatePhone(enqForm.telephone);
		  reason += validateEmail(enqForm.email);
		  reason += validateEmpty(enqForm.enquiry, "Enquiry");
	 	if (reason != "") 
	{
		alert("Some fields need correction:\n" + reason);
		return false;
  	}
  		return true;
	}
<!-- EOF function to validate the enquiry form -->	

<!-- BOF function to validate the terms checkbox -->	

	function validateTerms(fld)
		{
			var error= "";
			if (!fld.checked)
			{
			error = "\nYou have not accepted our Terms and Conditions\n";
			fld.style.background = 'Yellow';
			}
			return error;
		}
<!-- EOF function to validate the terms checkbox -->	


<!-- BOF function to validate the message on page 3 form -->	

	function validateMessage(messageForm)
	{
		var reason = "";
	    reason += validateEmpty(messageForm.message, "Message");
		if (reason != "") 
		{
			alert("Some fields need correction:\n" + reason);
			return false;
		} 
			return true;
			
	}	
<!-- BOF function to validate the order form -->	

function validateDeliveryAddress(deliveryForm) 
 {
	var reason = "";
	  reason += validateEmpty(deliveryForm.first_name, "Your first name");
	  reason += validateEmpty(deliveryForm.last_name, "Your last name");
	  reason += validateEmpty(deliveryForm.house, "Your house name or number");
	  reason += validateEmpty(deliveryForm.address_1, "Address 1");
	  reason += validateEmpty(deliveryForm.town, "Town or City");
	  reason += validateEmpty(deliveryForm.postcode, "Your postcode");
	  reason += validateEmpty(deliveryForm.county, "Your county");

	if (reason != "") 
	{
		alert("Some fields need correction:\n" + reason);
		return false;
	}
		return true;
}

function validateCheckout(checkout)
{
	var reason = "";
	  reason += validateEmpty(checkout.first_name, "Your first name");
	  reason += validateEmpty(checkout.last_name, "Your last name");
	  reason += validateEmpty(checkout.house, "Your house name or number");
	  reason += validateEmpty(checkout.address_1, "Address 1");
	  reason += validateEmpty(checkout.town, "Town or City");
	  reason += validateEmpty(checkout.postcode, "Your postcode");
	  reason += validateEmpty(checkout.county, "Your county");
	  reason += validatePhone(checkout.telephone);
	  reason += validateEmail(checkout.email);
	  reason += validateTerms(checkout.terms_agreed);
	
	if (reason != "") 
	{
		alert("Some fields need correction:\n" + reason);
		return false;
	}
		return true;
}

function checkImageChosen(image_upload)
{
	var reason = "";
	reason += validateEmpty(image_upload.pic, "");
	if (reason != "") 
	{
		alert("Upload button was pressed, but no image was chosen.\nPlease choose an image to upload." );
		return false;
	}
		return true;
}


function validateExtras(extras)
{
	var reason = "";

	if (extras.add_card_message.checked && extras.card_message.value.length == 0)
	{
		reason += "You have asked for a message card, but have not included any text for your card!";
		extras.card_message.style.border = '1px solid #a54399';
	}

	if (reason != "") 
	{
		alert("Some fields need correction:\n" + reason);
		return false;
	}
		return true;
	
}
<!-- EOF function to validate the order form -->

<!-- BOF function to count the words in the text areas-->

	function cnt(w,x){
	var y=w.value;
	var r = 0;
	a=y.replace(/\s/g,' ');
	a=a.split(' ');
	for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}
	x.value=r;
	} 
<!-- EOF function to count the words in the text areas-->// JavaScript Document
	
