<!-- hide script from old browsers
function preloader() 

{     // counter
     var i = 0;


     // create object
     imageObj = new Image();


     // set image list
     images = new Array();
     images[0]="images/tipper-insulite-img1.jpg"
     images[1]="images/tipper-grablite-img1.jpg"
     images[2]="images/tipper-bulklite-img1.jpg"
     images[3]="images/specialist-refuelling-img1.jpg"
	 images[4]="images/specialist-brickdistribution-img1.jpg"
	 images[5]="images/specialist-generator-img1.jpg"
	 images[6]="images/specialist-drawbar-img1.jpg"


     // start preloading
     for(i=0; i<=7; i++) 
     {
          imageObj.src=images[i];
     }
} 

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function isValidEmail(email, required) {
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            alert("Please enter a valid email address.");
			return false;

        }
        return true;
    }
    if (email.length==0) {  
        if (required) {
            return false;
        }
        return true;
    }
    if (! allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        return false;
    }
	
    return true;
}

function allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}



function validateForm(register)
{

if(document.forms[register].name.value=="")
 {
	alert("Please enter your name in the box provided");
	document.forms[register].name.focus();
	return false;
}

else if(document.forms[register].companyname.value=="")
{
	alert("Please enter your company name in the box provided");
	document.forms[register].companyname.focus();
	return false;
}

else if(document.forms[register].contactnumber.value=="")
{
	alert("Please enter your contact number in the box provided");
	document.forms[register].contactnumber.focus();
	return false;
}

else if(document.forms[register].enquirydetails.value=="")
{
	alert("Please enter your enquiry details in the box provided");
	document.forms[register].enquirydetails.focus();
	return false;
}

else if (! isValidEmail(document.forms[register].email.value)) 
{
 	alert("Please enter a correctly formatted email address. Be sure not to include any additional spaces before and after your email address.");
 	document.forms[register].email.focus();
 	return false;
 }
	return true;
}


// end hiding script from old browsers -->


