function startup()
	{
	/* function: to highlight the menu item, this is done by retieving the page currently in the browser, and which link in the navigation matches the page.

This script will require two new classes to be added to your css (feel free to change the class names, but ensure you have the same name in your stylesheet);
	1. here, as in a.here:link, a.here:visted { color: #fff;} - which styles the link, and
	2. highlight_selected, which styles the parent of the link.
	*/

// Start by retrieving the name of the navigation element, in this case a div with an id of 'navblock', and if it doesn't exist skip the rest of the script...
	var nav = window.document.getElementById('topnav');
	if(nav != null)
	{
	// retrieve the url of the page and clean it up...
	var sloc = window.location.href.toLowerCase().replace('.html','/').replace('//','/');
		
	// retrieve all the links (a href) within the navigation...
	var as = nav.getElementsByTagName('a');
		
	//loop over all the a href links
	for(var i=0; i< as.length;i++) {

		
	// for each link in the loop, remove unwanted data...
	var sAloc = as[i].href.toLowerCase();
	sAloc = sAloc.replace('.html','/').replace('//','/');

//barrybit
//
//var myRegExp = "/"+String(sAloc)+"/";
var myRegExp = sAloc;
//var myRegExp = /becoming-customer/;
var matchLink = sloc.search(myRegExp);
if(matchLink !=-1){as[i].className = 'here';}

//var str="Visit W3Schools!";
//document.write(str.search(/W3Schools/));


	// check if the current page is the same as this link...
	if(sAloc == sloc) {

	// and if the link matches this page, adapt the class...
	as[i].className = 'here';

	// and if you want to adapt the parent menu block, uncomment the line below...
	as[i].parentNode.parentNode.parentNode.className = 'highlight_selected';
         //as[i].parentNode.parentNode.style.display = "block";


         //as[i].nextSibling.style.display = "block";
	}
	}
	}
}
startup;


var currentFontSize = 16;

function revertStyles(){
	currentFontSize = 16;
	changeFontSize(0);
}

function changeFontSize(sizeDifference){
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference);
		if(currentFontSize > 19){
			currentFontSize = 19;
		}else if(currentFontSize < 8){
			currentFontSize = 8;
		}

	setFontSize(currentFontSize);
};
function setFontSize(fontSize){
	var stObj = (document.getElementById) ? document.getElementById('containercontent') : document.all('Content');
	stObj.style.fontSize = fontSize + 'px';
};


////////////////////////////////////////
////FORM VALIDATION/////////////////////
////////////////////////////////////////
function formNewsletterValidator(){
	// Make quick references to our fields
    var name = document.getElementById('name');
    var email = document.getElementById('email');

	// Check each input in the order that it appears in the form!
    if(isEmpty(name, "Please enter your name")){       
            if(emailValidator(email, "Please enter a valid email address")){
                        return true;
            }         
    }
    return false;
}

function formContactValidator(){
	// Make quick references to our fields
    var name = document.getElementById('name');
    var email = document.getElementById('email');
    var phone = document.getElementById('phone');
    var phone = document.getElementById('enquiry');


	// Check each input in the order that it appears in the form!
    if(isEmpty(name, "Please enter your name")){       
            if(emailValidator(email, "Please enter a valid email address")){
               if(emailValidator(phone, "Please enter a  phone number")){
                  if(emailValidator(enquiry, "Please enter a  your enquiry")){
                        return true;
                  }
               }

            }
         
    }
    return false;
}



function isEqual(elemone, elemtwo, helperMsg){
	if(elemone.value == elemtwo.value){
         return true;
	}
    else{
        alert(helperMsg);
		elemone.focus(); // set the focus to this input
        return false;
    }

}

function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
    else{
	return true;
    }
}

function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphanumeric(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem, min, max){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert("Please enter between " +min+ " and " +max+ " characters");
		elem.focus();
		return false;
	}
}

function madeSelection(elem, helperMsg){
	if(elem.value == "Please Choose"){
		alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
	}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){

		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}



function validateEnquiry()

{
var contact = false;

if (document.interest.companyname.value == '')
 {
  alert('Please enter your company name');
  document.interest.companyname.focus();
  return (false);
 }

if (document.interest.name.value == '')
 {
  alert('Please enter your name');
  document.interest.name.focus();
  return (false);
 }
if (document.interest.telephone.value == '')
 {
  alert('Please enter your phone number');
  document.interest.telephone.focus();
  return (false);
 }

if (document.interest.email.value == '')
 {
  alert('Please enter your email');
  document.interest.email.focus();
  return (false);
 }

{ if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.interest.email.value))
  { 
  return (true) }
            alert("Please enter a valid email address")           
            document.interest.email.focus();
            return (false)
            }           

document.interest.submit();
}



function formEventValidator()

{
var contact = false;

if (document.event.name.value == '')
 {
  alert('Please enter your name');
  document.event.name.focus();
  return (false);
 }
if (document.event.company.value == '')
 {
  alert('Please enter your company');
  document.event.company.focus();
  return (false);
 }
if (document.event.address1.value == '')
 {
  alert('Please enter your address line 1');
  document.event.address1.focus();
  return (false);
 }
if (document.event.address2.value == '')
 {
  alert('Please enter your address line 2');
  document.event.address2.focus();
  return (false);
 }
if (document.event.city.value == '')
 {
  alert('Please enter your city');
  document.event.city.focus();
  return (false);
 }
if (document.event.postcode.value == '')
 {
  alert('Please enter your postcode');
  document.event.postcode.focus();
  return (false);
 }
if (document.event.county.value == '')
 {
  alert('Please enter your county');
  document.event.county.focus();
  return (false);
 }
if (document.event.telephone.value == '')
 {
  alert('Please enter your telephone');
  document.event.telephone.focus();
  return (false);
 }
if (document.event.email.value == '')
 {
  alert('Please enter your email');
  document.event.email.focus();
  return (false);
 }

{ if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.event.email.value))
  { 
  return (true) }
            alert("Please enter a valid email address")           
            document.event.email.focus();
            return (false)
            }           

document.event.submit();
}







