
<!--
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_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_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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
//
// Type the number of images you are rotating.

NumberOfImagesToRotate = 4;

// Specify the first and last part of the image tag. 

FirstPart = '<a href="/index.asp?content=testimonials"><img src="/images/testimonial_';
SecondPart = '.gif" border="0"></a>';


function printImage() {
var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
document.write(FirstPart + r + SecondPart);
}

//character limit for text areas
function charAlert(textField, number) {
	if(textField.value.length > number){
		/* must be > 300, not == 300 or else the substring statement on the next line
		by pressing the 'enter' key rather than clicking 'OK'. */
		textField.value= textField.value.substring(0,number)
		// set field's value equal to first 300 characters.
		textField.blur()
		/* move cursor out of form element
		to keep it from placing itself at position zero,
		causing an overwrite of the first character */
		alert("No more text can be entered")
	}
}

//validate form code
//Args groups of three: 'Object','','Test Type' 
//Added Image and Doc File type Validation - 15/11/04 Chris Lugg
//Added Password Validation - 24/11/04 Chris Lugg
function MM_validateForm() { //v4.0 ? vYM2.0
	var d,i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3) {
  		test=args[i+2];
		val=MM_findObj(args[i]);
		if (val) {
			nm=val.name;
			nm=sortName(nm);
			if ((val=val.value)!="") { //checks if variable contains an entry
				if (test.indexOf('isEmail')!=-1) { //checks if type is email
					p=val.indexOf('@');
					d=val.indexOf('.');
					if ((p<1 || p==(val.length-1))||(d<1 || d==(val.length-1))) errors+='- '+nm+' must contain an e-mail address.\n';
				} else if (test.indexOf('image') != -1) { //checks valid image file
					if (!validateImageFile(val)) {
						//validation failed
						errors+='- The '+nm+' is not a valid image file.\n';
					}
				} else if (test.indexOf('doc') != -1) { //checks valid doc file
					if (!validateDocFile(val)) {
						//validation failed
						errors+='- The '+nm+' is not a valid file.\n';
					}
				} else if (test.indexOf('password') != -1) { //checks valid password
					val2=MM_findObj('confirmPassword');
					if ((val2=val2.value)!="") { //checks confirmPassword
						if (val!=val2) { //password match
							errors += '- The passwords do not match.\n';
						} else if (val.length < 6) { //
							errors += '- The password must be 6 or more chars.\n';
						}
					} else {
						errors += '- You must confirm the password.\n';
					}
				} else if (test!='R') { //checks number validation
					num = parseFloat(val);
        			if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; //checks if type is number
        			if (test.indexOf('inRange') != -1) { //checks range for number
						p=test.indexOf(':');
          				min=test.substring(8,p);
						max=test.substring(p+1);
          				if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    				}
				} 
			} else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
		}
  	}
	if (errors) alert('The following error(s) occurred:\n'+errors+'\n');
	document.MM_returnValue = (errors == '');
}


//Rename error messages
function sortName(nm) {
	newNameOfError='';
	
	switch(nm) {	
		case "name" :
			newNameOfError = "Name";
			break;
		case "contact_name" :
			newNameOfError = "Contact Name";
			break;
		case "company" :
			newNameOfError = "Company";
			break;
			case "terms" :
			newNameOfError = "Terms";
			break;
		case "theTitle" :
			newNameOfError = "Title";
			break;
		case "subTitle" :
			newNameOfError = "Sub Title";
			break;	
		case "shortDescription" :
			newNameOfError = "Summary";
			break;
		case "bodyText" :
			newNameOfError = "Body Text";
			break;
		case "priority" :
			newNameOfError = "Priority";
			break;
		case "thumbnail" :
			newNameOfError = "Thumbnail Image";
			break;
		case "imageLarge" :
			newNameOfError = "Large Image";
			break;
		case "imageSmall" :
			newNameOfError = "Small Image";
			break;
		case "map" :
			newNameOfError = "Map";
			break;
		case "address" :
			newNameOfError = "Address";
			break;
		case "address1" :
			newNameOfError = "Address";
			break;
		case "tel" :
			newNameOfError = "Telephone";
			break;
		case "postcode" :
			newNameOfError = "Postcode";
			break;
		case "phone" :
			newNameOfError = "Phone";
			break;
		case "phone1" :
			newNameOfError = "Phone";
			break;
		case "fax" :
			newNameOfError = "Fax";
			break;
		case "image1" :
			newNameOfError = "Image 1";
			break;
		case "image2" :
			newNameOfError = "Image 2";
			break;
		case "image3" :
			newNameOfError = "Image 3";
			break;
		case "link" :
			newNameOfError = "Link";
			break;
		case "homepage" :
			newNameOfError = "Homepage";
			break;
		case "firstName" :
			newNameOfError = "First Name";
			break;
		case "surname" :
			newNameOfError = "Surname";
			break;
		case "lastname" :
			newNameOfError = "Last Name";
			break;
		case "jobTitle" :
			newNameOfError = "Job Title";
			break;
		case "image" :
			newNameOfError = "Image";
			break;
		case "email" :
			newNameOfError = "Email";
			break;
		case "text" :
			newNameOfError = "Text";
			break;
		case "date" :
			newNameOfError = "Date";
			break;
		case "location" :
			newNameOfError = "Location";
			break;
		case "closingDate" :
			newNameOfError = "Closing Date";
			break;
		case "referenceNumber" :
			newNameOfError = "Reference Number";
			break;
		case "contact" :
			newNameOfError = "Contact";
			break;
		case "linkText" :
			newNameOfError = "Link Text";
			break;
		case "username" :
			newNameOfError = "Username";
			break;
		case "password" :
			newNameOfError = "Password";
			break;
		case "position" :
			newNameOfError = "Position";
			break;
		case "pWord" :
			newNameOfError = "Software Password";
			break;
		case "wwwpWord" :
			newNameOfError = "Dashboard Password";
			break;
		case "wwwpassword" :
			newNameOfError = "wwwPassword";
			break;
		case "enquiry" :
			newNameOfError = "Enquiry";
			break;
		case "country" :
			newNameOfError = "Country";
			break;
		case "refno" :
			newNameOfError = "Reference Number";
			break;
		case "dob" :
			newNameOfError = "Date of Birth";
		case "memorableDate" :
			newNameOfError = "Memorable Date";
			break;
		case "zip" :
			newNameOfError = "Postcode";
		}
		
	return newNameOfError;
	
}

function openWindow(url, winName, height, width) {
	
	newwindow=window.open(url,''+winName+'','height='+height+',width='+width+',scrollbars=yes,menubar=yes,resizable=yes,toolbar=yes,location=no,status=no');
}


/*
Random Testimonials
By Ed Pitt (http://www.cadsmart.net)
*/

function randomTestimonial(image1, image2, image3, image4){
  var images=new Array()
	images[0]=image1
  images[1]=image2
	  images[2]=image3
	  images[3]=image4


  var calculate=Math.floor(Math.random()*(images.length))


     document.write('<a target="_blank" href="/index.asp?content=testimonials"><img src="'+images[calculate]+'" border=0 width="150" alt="Click to see more testimonials"></a>')

}

/*
Random Home Page Image
By Ed Pitt (http://www.cadsmart.net)
*/

function randomHomePageImage(image1, image2, image3, image4){
  var images=new Array()
	images[0]=image1
  images[1]=image2
	  images[2]=image3
	  images[3]=image4


  var calculate=Math.floor(Math.random()*(images.length))


     document.write('<img src="'+images[calculate]+'" border=0 width="182">')

}

//-->
