var eml_val = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

function checkit(thisForm) {
if (thisForm.forename.value=="") {
alert("Please supply your forename.");
thisForm.forename.focus();
thisForm.forename.select();
return false;
}

if (thisForm.surname.value=="") {
alert("Please supply your surname.");
thisForm.surname.focus();
thisForm.surname.select();
return false;
}

if (thisForm.details.value=="") {
alert("Please supply a few details.");
thisForm.details.focus();
thisForm.details.select();
return false;
}

if (eml_val.test(thisForm.email.value) &! thisForm.email.value=="") {
thisForm.submit();
return true; }
else {
alert("Please supply a valid e-mail address.");
thisForm.email.focus();
thisForm.email.select();
return false;
}
}

function checkcomp(thisForm) {
if (thisForm.forename.value=="") {
alert("Please supply your forename.");
thisForm.forename.focus();
thisForm.forename.select();
return false;
}

if (thisForm.surname.value=="") {
alert("Please supply your surname.");
thisForm.surname.focus();
thisForm.surname.select();
return false;
}

if (thisForm.answer1.value=="") {
alert("Please supply an answer to question 1.");
thisForm.answer1.focus();
thisForm.answer1.select();
return false;
}

if (thisForm.answer2.value=="") {
alert("Please supply an answer to question 2.");
thisForm.answer2.focus();
thisForm.answer2.select();
return false;
}

if (thisForm.answer3.value=="") {
alert("Please supply an answer to question 3.");
thisForm.answer3.focus();
thisForm.answer3.select();
return false;
}

if (eml_val.test(thisForm.email.value) &! thisForm.email.value=="") {
thisForm.submit();
return true; }
else {
alert("Please supply a valid e-mail address.");
thisForm.email.focus();
thisForm.email.select();
return false;
}
}

function checkitdilemmas(thisForm) {
if (thisForm.forename.value=="") {
alert("Please supply your forename.");
thisForm.forename.focus();
thisForm.forename.select();
return false;
}

if (thisForm.town.value=="") {
alert("Please supply your town or city.");
thisForm.town.focus();
thisForm.town.select();
return false;
}

if (thisForm.details.value=="") {
alert("Please supply a few details.");
thisForm.details.focus();
thisForm.details.select();
return false;
}

if (eml_val.test(thisForm.email.value) &! thisForm.email.value=="") {
thisForm.submit();
return true; }
else {
alert("Please supply a valid e-mail address.");
thisForm.email.focus();
thisForm.email.select();
return false;
}
}

function checkitnewsletter(thisForm) {
if (thisForm.fullname.value=="") {
alert("Please supply your Full Name.");
thisForm.fullname.focus();
thisForm.fullname.select();
return false;
}

if (eml_val.test(thisForm.email.value) &! thisForm.email.value=="") {
thisForm.submit();
return true; }
else {
alert("Please supply a valid e-mail address.");
thisForm.email.focus();
thisForm.email.select();
return false;
}
}

function nextfield(target) {
if(window.event && window.event.keyCode == 13) {
document.getElementById(target).focus();
return false; }
else
return true;
}

function onField(txtfield) {
txtfield.className='stdinputbox stdinputover'
}

function offField(txtfield) {
if (txtfield.type=='text') {
txtfield.className='stdinputbox'
} else {
txtfield.className='stdinputboxc'
}
}

function onFieldNL(txtfield) {
if (txtfield.value==txtfield.id)
txtfield.value = "";
txtfield.className='stdinputbox stdinputover'
}

function offFieldNL(txtfield) {
if (txtfield.value=="")
txtfield.value=txtfield.id;
txtfield.className='stdinputbox'
}

function setOpacity(imgname, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  obj.style.KHTMLOpacity = opacity/100;
  obj.style.MozOpacity = opacity/100;
  obj.style.opacity = opacity/100;
}

function swapimage(imgname,opacity) {

obj = document.getElementById("midimg");

if ((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Opera") == -1)) {
	obj.style.filter="progid:DXImageTransform.Microsoft.Fade(Overlap=1.00);";
	obj.filters[0].apply();
	obj.src="images/"+imgname;
	obj.filters[0].play();
	return;
	}
else 

  if (document.getElementById) {
	obj.src="images/"+imgname;
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("swapimage('"+imgname+"',"+opacity+")", 100);
    }
  }
}

