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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
		return true;
	} else {
		return false;
	}
}
function IsNumeric(sText) {
   var ValidChars = "0123456789.";
   var Char;
   var IsNumeber = true;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) {
         IsNumber = false;
      }
   }
   return IsNumber;
}
function CheckFBForm() {
	with (document.Feedback) {
		if (Name.value == "") {
			alert('Please enter your name');
			return false;
		} else if (Email.value == "") {
			alert('Please enter your email address');
			return false;
		} else if (isEmail(Email.value) == false) {
			alert('Your email address appears to be invalid. Please check it and try again.');
			return false;
		} else if (Message.value == "") {
			alert('Please enter your message.');
			return false;
		} else if (Message.value.length > 2000) {
			alert('Sorry, your message is too long. Please edit it down./n Maximum length 2000 characters.');
			return false;
		}
	}
}
function CheckComments() {
	with (document.CommentsForm) {
		if (Name.value == "") {
			alert('Please enter your name');
			return false;
		} else if (Email.value == "") {
			alert('Please enter your email address');
			return false;
		} else if (isEmail(Email.value) == false) {
			alert('Your email address appears to be invalid. Please check it and try again.');
			return false;
		} else if (Comments.value == "") {
			alert('Please enter your comments.');
			return false;
		} else if (Comments.value.length > 2000) {
			alert('Sorry, your message is too long. Please edit it down./n Maximum length 2000 characters.');
			return false;
		} else if (Validate.value == "") {
			alert('Please enter the validation word shown in the image.');
			return false;
		} else if (Validate.value.length != 5) {
			alert('The validation word should contain 5 letters.');
			return false;
		}
	}
}
function TextAreaLimit(FieldID,MaxLength) {
	var lastChar = MaxLength - 1;
	var myField = document.getElementById(FieldID);	
	if (myField.value.length > MaxLength) {		
		alert('Message size is limited to 2000 characters.');
		myField.value = myField.value.substring(0,lastChar);
	}
}
