function MM_preloadImages() { //v3.0
  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_swapImgRestore() { //v3.0
  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_findObj(n, d) { //v4.01
  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() { //v3.0
  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];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

myimgOrPage = null;
flashCanPlay = false;
function testFlash(theVersion,imgOrPage,altfile){
flashVersion = theVersion //version to test for, if fail do you want an image to replace or go to an html page (values are "image" or "page". alt is either the html page or image file
plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (i = 0; i < words.length; ++i){
		if (isNaN(parseInt(words[i])))
		continue;
		pluginVersion = words[i]; 
	    }
	flashCanPlay = pluginVersion >= flashVersion;
	
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<scr' + 'ipt type="text/vbscript"\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('Sub dropdown_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call dropdown_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('Sub swfmenu_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call swfmenu_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('flashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flashVersion)))\n');
	document.write('</scr' + 'ipt\> \n');
}

if ( flashCanPlay ) {
// do nothing, flashCanPlay = true;
}
else {
	if (imgOrPage =="page"){
		window.location = altfile;
		}
		else{
		myimgOrPage = "image";
		}	
	}
}
function putswf(flashfile,width,height,altimg,vars,myID,wmode){
	if((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Mac")!= -1)){
			flashfile = flashfile+"?"+vars; /*this allows Mac IE to see flash vars. Mac IE can't read flash Vars it needs to attach them to the swf in the form of file.swf?flashVars */
	}
	altTitle="You need a more recent version of the Macromedia Flash Player";
if ((myimgOrPage == "image") && (flashCanPlay == false)){
	document.write('<a href="http://www.macromedia.com/go/getflashplayer" target="_blank" title="'+altTitle+'"><img src='+altimg+' alt="'+altTitle+'" border="'+0+'"/></a>');
	}else{
		if ((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Win")!= -1) && (navigator.userAgent.indexOf("Opera") == -1) && (navigator.userAgent.indexOf("Omni") == -1)){
			msie="&msie=true";
		}else{
			msie="&msie=false";
		}
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+myID+'" width="'+width+'" height="'+height+'">');
		document.write('<param name="movie" value="'+flashfile+'" />');
		document.write('<param name="FlashVars" value="'+vars+msie+'" />');
		document.write('<param name="wmode" value="'+wmode+'" />');
		document.write('<embed src="'+flashfile+'" width="'+width+'" height="'+height+'" wmode="'+wmode+'" type="application/x-shockwave-flash" FlashVars="'+vars+msie+'" />');
		document.write('</object>');
		
	} 
}
// MOTORTECH FORM VALIDATION AND SUBMISSION
// FUNCTION TO VALIDATE ENQUIRY FORM ENTRIES
// userName
// eMail
// telephone
// make
// model
// year
// enquiry
// code
function validate(){
// SET UP ERROR MESSAGE
errorMsg = "The following error(s) exist, please rectify and try again.\r\n";
// INITIALISE ERROR COUNTER
hasErrors = 0;
// CREATE REG EX EXPRESSIONS
var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
var tre = /^\d{7,}$/;
var validYear = /^\d{4,}$/;
var validCode = /^\d{5,}$/;
var alphaNumeric = /[^\sa-zA-Z0-9!@$%&()'",.?_]/;
		// FUNCTION TO VALIDATE USER NAME ENTERED
		if(document.motortechForm.userName.value == "") {
				hasErrors ++;
				errorMsg += "• Name - Please enter a contact name.\r\n";
				document.motortechForm.userName.focus();
				document.motortechForm.userName.select();
		} else {
				// Check for number and type of characters entered
				if (alphaNumeric.test(document.motortechForm.userName.value)){
						hasErrors ++;
						errorMsg += "• Name - Invalid characters entered, letters and numbers only.\r\n";		
						document.motortechForm.userName.value = "";
						document.motortechForm.userName.focus();
						document.motortechForm.userName.select();
				}
		}
		
		// FUNCTION TO VALIDATE E-MAIL ENTERED
		if (document.motortechForm.eMail.value == "") {
				hasErrors ++;
				errorMsg += "• Email - Please enter an email address.\r\n";
				document.motortechForm.eMail.focus();
				document.motortechForm.eMail.select();
		} else {
				if (!re.test(document.motortechForm.eMail.value)){
						hasErrors ++;
						errorMsg += "• Email - Please enter a VALID email address.\r\n";
						document.motortechForm.eMail.value="";
						document.motortechForm.eMail.focus();
						document.motortechForm.eMail.select();
				}
		}
		
		// FUNCTION TO VALIDATE TELEPHONE NUMBER ENTERED
		if (!document.motortechForm.telephone.value == ""){
				if (!tre.test(document.motortechForm.telephone.value)){
						hasErrors ++;
						errorMsg += "• Phone - Not a recognised phone number, please enter a minimum of 7 NUMBERS only.\r\n";
						document.motortechForm.telephone.value="";
						document.motortechForm.telephone.focus();
						document.motortechForm.telephone.select();
				}
		}
		
		// FUNCTION TO VALIDATE MAKE ENTERED
		if (!document.motortechForm.make.value == ""){
				if (alphaNumeric.test(document.motortechForm.make.value)){
						hasErrors ++;
						errorMsg += "• Make - Invalid characters entered, letters and numbers only.\r\n";
						document.motortechForm.make.value="";
						document.motortechForm.make.focus();
						document.motortechForm.make.select();
				}
		}
		
		// FUNCTION TO VALIDATE MODEL ENTERED
		if (!document.motortechForm.model.value == ""){
				if (alphaNumeric.test(document.motortechForm.model.value)){
						hasErrors ++;
						errorMsg += "• Model - Invalid characters entered, letters and numbers only.\r\n";
						document.motortechForm.model.value="";
						document.motortechForm.model.focus();
						document.motortechForm.model.select();
				}
		}
		
		// FUNCTION TO VALIDATE YEAR ENTERED
		if (!document.motortechForm.year.value == ""){
				if (!validYear.test(document.motortechForm.year.value)){
						hasErrors ++;
						errorMsg += "• Year - Invalid characters entered, 4 NUMBERS only.\r\n";
						document.motortechForm.year.value="";
						document.motortechForm.year.focus();
						document.motortechForm.year.select();
				}
		}
		
		// FUNCTION TO VALIDATE ENQUIRY ENTERED
		if (!document.motortechForm.enquiry.value == ""){
				if (alphaNumeric.test(document.motortechForm.enquiry.value)){
						hasErrors ++;
						errorMsg += "• Enquiry - Invalid characters entered, letters and numbers only.\r\n";
						//document.motortechForm.enquiry.value="";
						document.motortechForm.enquiry.focus();
						document.motortechForm.enquiry.select();
				}
		}
		
		// FUNCTION TO VALIDATE CODE ENTERED
		if(document.motortechForm.code.value == "") {
				hasErrors ++;
				errorMsg += "• Security Code - You MUST enter the Security Code.\r\n";
				document.motortechForm.code.focus();
				document.motortechForm.code.select();
		} else if (document.motortechForm.code.value.length > 4) {
				if (alphaNumeric.test(document.motortechForm.code.value)){
						hasErrors ++;
						errorMsg += "• Security Code - Invalid characters entered, 5 LETTERS and/or NUMBERS only.\r\n";
						document.motortechForm.code.value="";
						document.motortechForm.code.focus();
						document.motortechForm.code.select();
				}
		} else {
				//alert(document.motortechForm.code.value.length);
				hasErrors ++;
				errorMsg += "• Security Code - Not enough characters entered, MUST be exactly 5 LETTERS and/or NUMBERS only.\r\n";
				document.motortechForm.code.focus();
				document.motortechForm.code.select();
		}
		
		// ALL ENTRIES VALIDATED SO SUBMIT FORM
		if(hasErrors < 1) {
				//alert("Submit Form");
				document.motortechForm.submit();
		} else {
				alert(errorMsg);	
				return false;
		}
}
// Swap statement text
function Commitment(){
	document.getElementById('content').innerHTML="<table width=\"750\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"globaltext\"><tr><td width=\"16\" background=\"images/products_left_shim.gif\"></td><td valign=\"top\" align=\"left\"><br /><i>We are an independently run company, owned since October 2004; we have a strong reputation for service built on experience.<br />You can trust our integrity; we will be honest and straightforward in all our dealings with you.<br /><br />You will find our staff courteous, friendly and knowledgeable. We will listen carefully to your needs, and we will strive to acheive a high standard of workmanship.<br /><br />You can be confident in your choice; our service to you is guaranteed. We are members of the MTA giving you a further guarantee of quality, and further peace of mind.<br /><br />If you find you have any issues in the way we conducted our business with you, please feel free to contact Stuart or Marcel.<br /><br />Your vehicle will be safe in our hands for all repairs and maintenance by our team of experienced and tructworthy technicians. We use top quality products and materials in all aspects of our business.<br /><br />We are proud of the quality of our service and will satisfy all customers' requirements.<br /><br />We sincerely value your business with us.</i><br /><br /><b>Marcel Schreuder &amp; Stuart Cocking</b><br /><br /><a href=\"pdf/Commitment Statement.pdf\" title=\"Commitment Statement\" target=\"_blank\"><img src=\"images/pdf_logo.gif\" alt=\"Download...\" title=\"Download...\" width=\"24\" height=\"25\" border=\"0\" />&nbsp;Download...</a></td><td width=\"20\" background=\"images/global_rightspacer.gif\"></td></tr><tr><td width=\"16\"><img src=\"images/products_left_shim.gif\" width=\"35\" height=\"273\" /></td><td align=\"center\" valign=\"middle\"><img src=\"images/Stu_And_Marcel.jpg\" alt=\"Marcel and Stuart\" title=\"Marcel and Stuart\" width=\"468\" height=\"273\" border=\"0\" /></td><td width=\"20\"><img src=\"images/global_rightspacer.gif\" alt=\"\" width=\"20\" height=\"273\" border=\"0\" /></td></tr></table>";
}
function Mission(){
	document.getElementById('content').innerHTML="<table width=\"750\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"globaltext\"><tr><td width=\"16\" background=\"images/products_left_shim.gif\"></td><td valign=\"top\" align=\"left\"><br /><i>At Motortech 4x4 we are a team of highly trained and professional automotive technicians.<br /><br />Our commitment is to ensure you, as a customer, have the best advice and customer service in our industry.</i><br /><br /><a href=\"pdf/Mission Statement.pdf\" title=\"Mission Statement\" target=\"_blank\"><img src=\"images/pdf_logo.gif\" alt=\"Download...\" title=\"Download...\" width=\"24\" height=\"25\" border=\"0\" />&nbsp;Download...</a></td><td width=\"20\" background=\"images/global_rightspacer.gif\"></td></tr><tr><td width=\"16\"><img src=\"images/products_left_shim.gif\" width=\"35\" height=\"273\" /></td><td align=\"center\" valign=\"middle\"><a href=\"pdf/Testimonials.pdf#\" title=\"Testimonials\" target=\"_blank\"><img src=\"images/Testimonials.gif\" alt=\"Testimonials\" title=\"Testimonials\" width=\"468\" height=\"273\" border=\"0\" /></a></td><td width=\"20\"><img src=\"images/global_rightspacer.gif\" alt=\"\" width=\"20\" height=\"273\" border=\"0\" /></td></tr></table>";
}
/*****************************************/
/* FUNCTION TO VALIDATE LOG IN FORM */
/*****************************************/
function logUser() {
// SET UP ERROR MESSAGE
errorMsg = "The following error(s) exist, please rectify and try again.\r\n";
// INITIALISE ERROR COUNTER
hasErrors = 0;
// CREATE REG EX EXPRESSIONS
var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
var alphaNumeric = /[^\sa-zA-Z0-9!@$%&()'",.?_]/;
	// FUNCTION TO VALIDATE USER NAME ENTERED
	if(document.logUserForm.username.value == "") {
			hasErrors ++;
			errorMsg += "• Name - Please enter a username.\r\n";
			document.logUserForm.username.focus();
			document.logUserForm.username.select();
	} else {
			// Check for number and type of characters entered
			if (alphaNumeric.test(document.logUserForm.username.value)){
					hasErrors ++;
					errorMsg += "• Name - Invalid characters entered, letters and/or numbers only.\r\n";		
					document.logUserForm.username.value = "";
					document.logUserForm.username.focus();
					document.logUserForm.username.select();
			}
	}
	// FUNCTION TO VALIDATE PASSWORD ENTERED
	if(document.logUserForm.password.value == "") {
			hasErrors ++;
			errorMsg += "• Password - Please enter a password.\r\n";
			document.logUserForm.password.focus();
			document.logUserForm.password.select();
	} else {
			// Check for number and type of characters entered
			if (alphaNumeric.test(document.logUserForm.password.value)){
					hasErrors ++;
					errorMsg += "• Password - Invalid characters entered, letters and/or numbers only.\r\n";		
					document.logUserForm.password.value = "";
					document.logUserForm.password.focus();
					document.logUserForm.password.select();
			}
	}	
	// ALL ENTRIES VALIDATED SO SUBMIT FORM
		if(hasErrors < 1) {
				//alert("Submit Form");
				document.logUserForm.submit();
		} else {
				alert(errorMsg);	
				return false;
		}
}
/***********************************************/
/* VALIDATE EVENTS FORM */
/***********************************************/
function validateEvents(){
// SET UP ERROR MESSAGE
errorMsg = "The following error(s) exist, please rectify and try again.\r\n";
// INITIALISE ERROR COUNTER
hasErrors = 0;
// CREATE REG EX EXPRESSIONS
var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
var tre = /^\d{7,}$/;
var validYear = /^\d{4,}$/;
var validCode = /^\d{5,}$/;
var alphaNumeric = /[^\sa-zA-Z0-9!@$%&()'",.?_\-]/;
// FUNCTION TO VALIDATE TITLE ENTERED
if(document.events_form.Title.value == "") {
		hasErrors ++;
		errorMsg += "• Title - Please enter a title for the event.\r\n";
		document.events_form.Title.focus();
		document.events_form.Title.select();
} else {
		// Check for number and type of characters entered
		if (alphaNumeric.test(document.events_form.Title.value)){
				hasErrors ++;
				errorMsg += "• Title - Invalid characters entered, letters and numbers only.\r\n";		
				document.events_form.Title.value = "";
				document.events_form.Title.focus();
				document.events_form.Title.select();
		}
}	
	
// FUNCTION TO VALIDATE LOCATION ENTERED
if(document.events_form.Location.value == "") {
		hasErrors ++;
		errorMsg += "• Location - Please enter a location for the event.\r\n";
		document.events_form.Location.focus();
		document.events_form.Location.select();
} else {
		// Check for number and type of characters entered
		if (alphaNumeric.test(document.events_form.Location.value)){
				hasErrors ++;
				errorMsg += "• Location - Invalid characters entered, letters and numbers only.\r\n";		
				document.events_form.Location.value = "";
				document.events_form.Location.focus();
				document.events_form.Location.select();
		}
}

// FUNCTION TO VALIDATE START DATE ENTERED
if(document.events_form.start.value == "") {
		hasErrors ++;
		errorMsg += "• Start - Please enter a start date for the event.\r\n";
		document.events_form.start.focus();
		document.events_form.start.select();
} else {
		// Check for number and type of characters entered
		if (alphaNumeric.test(document.events_form.start.value)){
				hasErrors ++;
				errorMsg += "• Start - Invalid characters entered, letters and numbers only.\r\n";		
				document.events_form.start.value = "";
				document.events_form.start.focus();
				document.events_form.start.select();
		}
}

// FUNCTION TO VALIDATE END DATE ENTERED
if(document.events_form.end.value == "") {
		hasErrors ++;
		errorMsg += "• End - Please enter a end date for the event.\r\n";
		document.events_form.end.focus();
		document.events_form.end.select();
} else {
		// Check for number and type of characters entered
		if (alphaNumeric.test(document.events_form.end.value)){
				hasErrors ++;
				errorMsg += "• End - Invalid characters entered, letters and numbers only.\r\n";		
				document.events_form.end.value = "";
				document.events_form.end.focus();
				document.events_form.end.select();
		}
}
		
// FUNCTION TO VALIDATE DESCRIPTION ENTERED
if(document.events_form.Description.value == "") {
		hasErrors ++;
		errorMsg += "• Description - Please enter a description for the event.\r\n";
		document.events_form.Description.focus();
		document.events_form.Description.select();
} else {
		// Check for number and type of characters entered
		if (alphaNumeric.test(document.events_form.Description.value)){
				hasErrors ++;
				errorMsg += "• Description - Invalid characters entered, letters and numbers only.\r\n";		
				document.events_form.Description.value = "";
				document.events_form.Description.focus();
				document.events_form.Description.select();
		}
}

	// ALL ENTRIES VALIDATED SO SUBMIT FORM
		if(hasErrors < 1) {
				//alert("Submit Form");
				document.events_form.submit();
		} else {
				alert(errorMsg);	
				return false;
		}
		
}

/***********************************************/
/* VALIDATE GALLERY FORM */
/***********************************************/
function validateGallery(){
// SET UP ERROR MESSAGE
errorMsg = "The following error(s) exist, please rectify and try again.\r\n";
// INITIALISE ERROR COUNTER
hasErrors = 0;
// CREATE REG EX EXPRESSIONS
var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
var tre = /^\d{7,}$/;
var validYear = /^\d{4,}$/;
var validCode = /^\d{5,}$/;
var alphaNumeric = /[^\sa-zA-Z0-9!@$%&()'",.?:_\\\-]/;
// FUNCTION TO VALIDATE DESCRIPTION ENTERED
if(document.addPictureForm.comments.value == "") {
		hasErrors ++;
		errorMsg += "• Description - Please enter a description for the image.\r\n";
		document.addPictureForm.comments.focus();
		document.addPictureForm.comments.select();
} else {
		// Check for number and type of characters entered
		if (alphaNumeric.test(document.addPictureForm.comments.value)){
				hasErrors ++;
				errorMsg += "• Description - Invalid characters entered, letters and numbers only.\r\n";		
				document.addPictureForm.comments.value = "";
				document.addPictureForm.comments.focus();
				document.addPictureForm.comments.select();
		}
}

// FUNCTION TO VALIDATE CATALOGUE ENTERED
if((document.addPictureForm.catalogue.value == "") && (!document.addPictureForm.catalogue2.value == "")) {
		if (alphaNumeric.test(document.addPictureForm.catalogue2.value)){
				hasErrors ++;
				errorMsg += "• Catalogue - Invalid characters entered, letters and numbers only.\r\n";		
				document.addPictureForm.catalogue.value = "";
				document.addPictureForm.catalogue2.value = "";
				document.addPictureForm.catalogue2.focus();
				document.addPictureForm.catalogue2.select();
		}
} else if ((!document.addPictureForm.catalogue.value == "") && (document.addPictureForm.catalogue2.value == "")) {
		document.addPictureForm.catalogue2.value = "";
		document.addPictureForm.catalogue.focus();
} else {
		hasErrors ++;
		errorMsg += "• Catalogue - Select from the dropdown list OR create a new catalogue.\r\n";	
		document.addPictureForm.catalogue.value = "";
		document.addPictureForm.catalogue2.value = "";
		document.addPictureForm.catalogue.focus();
}

// FUNCTION TO VALIDATE IMAGE ENTERED
if(document.addPictureForm.image.value == "") {
		hasErrors ++;
		errorMsg += "• Image - Please choose an image to upload.\r\n";
		document.addPictureForm.image.focus();
		document.addPictureForm.image.select();
} else {
		// Check for number and type of characters entered
		if (alphaNumeric.test(document.addPictureForm.image.value)){
				hasErrors ++;
				errorMsg += "• Image - Invalid characters entered, letters and numbers only.\r\n";		
				document.addPictureForm.image.value = "";
				document.addPictureForm.image.focus();
				document.addPictureForm.image.select();
		}
}

// ALL ENTRIES VALIDATED SO SUBMIT FORM
if(hasErrors < 1) {
		//alert("Submit Form");
		document.addPictureForm.submit();
} else {
		alert(errorMsg);	
		return false;
}
		
}

// REDIRECT TO URL PASSED IN ADMIN FORM
function newWin(URL) {
	window.location=(URL);
}

/***********************************************/
/* VALIDATE NEWSLETTER FORM */
/***********************************************/
function addNewsletter() {
// SET UP ERROR MESSAGE
errorMsg = "The following error(s) exist, please rectify and try again.\r\n";
// INITIALISE ERROR COUNTER
hasErrors = 0;
// CREATE REG EX EXPRESSIONS
var alphaNumeric = /[^\sa-zA-Z0-9!@$%&()'",.?_\-]/;

		// FUNCTION TO VALIDATE IMAGE ENTERED
		if(document.addNewsletterForm.image.value == "") {
				hasErrors ++;
				errorMsg += "• Newsletter - Please choose a newsletter to upload.\r\n";
				document.addNewsletterForm.image.focus();
				document.addNewsletterForm.image.select();
		} else {
				// Check for number and type of characters entered
				if (alphaNumeric.test(document.addNewsletterForm.image.value)){
						hasErrors ++;
						errorMsg += "• Newsletter - Invalid characters entered, letters and numbers only.\r\n";		
						document.addNewsletterForm.image.value = "";
						document.addNewsletterForm.image.focus();
						document.addNewsletterForm.image.select();
				}
		}
		
		// ALL ENTRIES VALIDATED SO SUBMIT FORM
		if(hasErrors < 1) {
				//alert("Submit Form");
				document.addNewsletterForm.submit();
		} else {
				alert(errorMsg);	
				return false;
		}
}

/***********************************************/
/* VALIDATE NEWSLETTER SUBSCRIPTION FORM */
/***********************************************/
function checkSubEmail() {
		// SET UP ERROR MESSAGE
		errorMsg = "The following error(s) exist, please rectify and try again.\r\n";
		// INITIALISE ERROR COUNTER
		hasErrors = 0;
		// CREATE REG EX EXPRESSIONS
		var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		// FUNCTION TO VALIDATE E-MAIL ENTERED
		if (document.subscriptionForm.email.value == "") {
				hasErrors ++;
				errorMsg += "• Email - Please enter an email address.\r\n";
				document.subscriptionForm.email.focus();
				document.subscriptionForm.email.select();
		} else {
				if (!re.test(document.subscriptionForm.email.value)){
						hasErrors ++;
						errorMsg += "• Email - Please enter a VALID email address.\r\n";
						document.subscriptionForm.email.value="";
						document.subscriptionForm.email.focus();
						document.subscriptionForm.email.select();
				}
		}
		
		if ((document.subscriptionForm.subscription[0].checked == false) && (document.subscriptionForm.subscription[1].checked == false)) {
				hasErrors ++;
				errorMsg += "• Subscription - Please tick either Subscribe or Unsubscribe.\r\n";
				document.subscriptionForm.subscription[0].checked = true;
				document.subscriptionForm.subscription[0].focus();
				document.subscriptionForm.subscription[0].select();
		}

		// ALL ENTRIES VALIDATED SO SUBMIT FORM
		if(hasErrors < 1) {
				//alert("Submit Form");
				document.subscriptionForm.submit();
		} else {
				alert(errorMsg);	
				return false;
		}
}

function confirmDelete(theURL){
	var answer = confirm('Are you sure you want to delete this entry?');
	if (answer){
		window.location = theURL;
	}
}